Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pythonPackages.geant4: init at 10.6.2 #89688

Merged
merged 1 commit into from Jun 13, 2020
Merged

Conversation

veprbl
Copy link
Member

@veprbl veprbl commented Jun 6, 2020

Starting geant4 10.6.2 g4py can not be built separately
http://geant4-data.web.cern.ch/geant4-data/ReleaseNotes/Patch4.10.6-2.txt

Also, it appears that g4py itself is now deprecated, it was moved
to environments/g4py/tests/g4pytest in the source distribution. The only
remaining imported module is Geant4, hence python package name
pythonPackages.geant4, the capitalization matches the one of the non-python
attribute.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Starting geant4 10.6.2 g4py can not be built separately
http://geant4-data.web.cern.ch/geant4-data/ReleaseNotes/Patch4.10.6-2.txt

Also, it appears that g4py itself is now deprecated, it was moved
to environments/g4py/tests/g4pytest in the source distribution.  The only
remaining imported module is Geant4, hence python package name
`pythonPackages.geant4`, the capitalization matches the one of the non-python
attribute.
@veprbl
Copy link
Member Author

veprbl commented Jun 6, 2020

@GrahamcOfBorg build geant4
@GrahamcOfBorg build python37Packages.geant4
@GrahamcOfBorg build python38Packages.geant4

Copy link
Contributor

@OmnipotentEntity OmnipotentEntity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a few things I don't understand about changes to the build. But, clearly, the python bindings aren't something that I use day to day, so I might just not be familiar enough with them. Can you please clarify?

@@ -44,6 +53,16 @@ stdenv.mkDerivation rec {
sha256 = "0vznm3pjlbihjy1wsxc4gj229k0dzc283wvil2xghyl08vwdpnpc";
};

boost_python_lib = "python${builtins.replaceStrings ["."] [""] python3.pythonVersion}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a widely known thing. But it's the first time I've encountered these particular "make boost work with python" incantations. Can you add a comment explaining? Or is this just something that everyone who needs to know already knows / explained elsewhere?

Specifically, I'm curious because this is different from the previous version in the g4py/default.nix file:

  postPatch = ''
    cd environments/g4py
  '';

  preConfigure = ''
    # Fix for boost 1.67+
    substituteInPlace CMakeLists.txt \
    --replace "find_package(Boost)" "find_package(Boost 1.40 REQUIRED COMPONENTS python${builtins.replaceStrings ["."] [""] python.pythonVersion})"
    for f in `find . -name CMakeLists.txt`; do
      substituteInPlace "$f" \
        --replace "boost_python" "\''${Boost_LIBRARIES}"
    done
  '';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is a known breaking change in boost. With respect to upstream this is https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2059

"-DGEANT4_USE_RAYTRACER_X11=${if enableRaytracerX11 then "ON" else "OFF"}"
"-DGEANT4_USE_SYSTEM_CLHEP=${if clhep != null then "ON" else "OFF"}"
"-DGEANT4_USE_SYSTEM_EXPAT=${if expat != null then "ON" else "OFF"}"
"-DGEANT4_USE_SYSTEM_ZLIB=${if zlib != null then "ON" else "OFF"}"
"-DGEANT4_BUILD_MULTITHREADED=${if enableMultiThreading then "ON" else "OFF"}"
] ++ stdenv.lib.optionals (enableMultiThreading && enablePython) [
"-DGEANT4_BUILD_TLS_MODEL=global-dynamic"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining why this is required? Does the thread local storage just not work unless it's flagged as global-dynamic? This also isn't in the original file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes building with both MT and Python. This is taken from the 10.6.2 release notes (link in the commit message, see first bullet). If you don't do this, the build won't configure.

Copy link
Contributor

@OmnipotentEntity OmnipotentEntity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me then.

@veprbl veprbl merged commit fa94261 into NixOS:master Jun 13, 2020
@veprbl veprbl deleted the pr/g4py_rework branch June 13, 2020 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants