-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Allow setting of LD_LIBRARY_PATH for compilers #943
Conversation
@luca-heltai ping. |
@hegner: This looks great. Some comments:
gcc@4.4.7:
cc: /usr/bin/gcc
cxx: /usr/bin/g++
f77: /usr/bin/gfortran
fc: /usr/bin/gfortran
environment:
prepend:
LD_LIBRARY_PATH: /what/ever/you/need FYI: #561 will actually allow us to specifically specific modules to load to use a particular compiler, so it will probably solve this problem for most users. However, I think it's useful to allow adding arbitrary environment changes to the compilers, too. The above syntax uses @alalazo's module customization syntax to modify the environment here and in modules. What do you think? |
@tgamblin - no prob. I will do that and update the docs accordingly. I would propose a two stage procedure here:
Do you agree? |
@hegner: sounds good to me. I suspect for phase 1 you should be able to reuse some of @alalazo's Python code very easily. However, in |
@hegner: thinking about it, you may want to throw |
@tgamblin - same parameter name in the yaml, but I already set both LD and DYLD from it. Can make it cleaner. |
@alalazo - yapp. need to get that fixed again. Was a quick re-surrection. |
I was wondering : if we want to maintain the same level of 'security' in unsetting these variables, we could
What do you think? |
Sounds good. |
I personally like this solution. Nice PR! I had to hack around a lot of things, but with this, everything should work for my setting... |
Feature complete for now. One can set LD_LIBRARY_PATH or DYLD_LIBRARY_PATH via
Implementation wise I make the assumption that I only do a set on environment variables. Which variables can be set is kept dynamic and purely limited by the schema definition of the configuration. In case other variables may be needed, intervention is limited to exactly one place. |
Has this been tested with multiple environment variables? What about an LD_LIBRARY_PATH that contains a colon separated list of paths? |
@adamjstewart - yap. You can do that with any variable - given it is allowed by the config schema. For now only If you want to verify in a poor man's way that things are actually set, you can just add some fake paths
to your compiler config and add an echo in the compiler wrapper
Then any build will have its
|
I like this implementation a lot, but I can't help but wonder if it could be made more generic. The Intel compilers in particular make use of a lot of different environment variables (sourced from compilervars.sh). The NAG compiler requires the NAG_KUSARI_FILE variable to be set in order to use it. Yes, all of these variables could be set by first loading a module. But it would be way cooler to be able to set any necessary variables in compilers.yaml. Is there some language limitation that prevents this? |
@adamjstewart - I limited it to these two paths to prevent feature creep. Implementation wise the difference is something < 10 lines of code to allow setting any variable. Just a change on the config schema. I hope @tgamblin would be fine with that change. If yes, it's a matter of a coffee break to code and test. |
@adamjstewart see this commit: b5f89c3 : 8 lines including docs. |
I found another hiccup to this approach. While setting diff --git a/var/spack/repos/builtin/packages/cmake/package.py b/var/spack/repos/builtin/packages/cmake/package.py
index 7b2a125..0c88d3c 100644
--- a/var/spack/repos/builtin/packages/cmake/package.py
+++ b/var/spack/repos/builtin/packages/cmake/package.py
@@ -23,6 +23,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
+import os
+
class Cmake(Package):
"""A cross-platform, open-source build system. CMake is a family of
@@ -70,6 +72,10 @@ class Cmake(Package):
# Consistency check
self.validate(spec)
+ if os.environ.get('SPACK_LD_LIBRARY_PATH') != "None":
+ os.environ['LD_LIBRARY_PATH'] \
+ = os.environ.get('SPACK_LD_LIBRARY_PATH')
+
# configure, build, install:
options = ['--prefix=%s' % prefix]
options.append('--parallel=%s' % str(make_jobs)) Can anyone think of a way to transform this hack into a cleaner implementation? |
@KineticTheory You're right : we should set |
@KineticTheory thanks for testing! You are right. I broke that part when I started prefixing things with |
@davydden - not yet. will address that soon. Sorry for the delay. |
Should this PR be closed now that we can load modules for a compile? Or are there still use cases? |
@citibeth Loading the compiler module via compilers.yaml
Test 1 (default)
Test 2 (dirty)
|
I've had the same experience. I think the Forcing the user to write -- Elizabeth On Mon, Aug 29, 2016 at 10:17 PM, Kelly Thompson notifications@github.com
|
My understanding that loading modules will also fix issues experienced by @luca-heltai here https://groups.google.com/d/topic/spack/I7CQgmwHmLI/discussion |
I'm forced to use a particularly evil compiler that was built by hand. Not only do you need to load a module to RUN it, you also have to load the same module to run anything built by it. In practice, that means that --dirty is required and the module loading is redundant (for this compiler). For moderately evil compilers, I think the module loading feature in Spack is nice. I think this thread can be closed. |
This thread shouldn't be closed. Allowing compilers (even ones that don't have modules) to run in a clean environment is still a priority, I just haven't gotten to it. I actually view this issue as a pretty high priority. It's a barrier to entry for a number of users at LANL, for instance, and requiring |
I suppose the suggested improvement would address some of the issues raised in this thread, and is worth doing for that reason. It will not help me with my evil compiler because build processes at times will need to run code produced by my compiler. The LD_LIBRARY_PATH needs to be in effect not just while running the compiler, but all the time. Using |
Using compilers that RPATH properly is another issue. But the mechanism for this would also allow us to add compiler runtime paths that Spack should add to |
If spack can fix my evil compiler so I no longer need to load modules to On Wed, Sep 21, 2016 at 1:22 PM, Todd Gamblin notifications@github.com
|
Hi folks, I was asked to take a crack at updating this to be compatible with current Spack. The results are at #2275. That should likely be closed and that work integrated here but for now I've opened it as a separate PR. One question I've got: why is this done with coordination between build_environment.set_build_environment_variables and the compiler wrapper, vs. just setting 'env' in build_environment.set_build_environment_variables? If the function were used it seems like other types of modifications like prepending to LD_LIBRARY_PATH would be possible. Thanks, |
@tgamblin Perhaps a foolish question but do you mean add a variable in compilers.yaml to be used to decide how to set up PATH for a package when its binaries are run? I suppose I'm not clear how that would be achieved in general. Module files currently allow setting/prepending/etc. for specific packages, but without module files I'm not clear on how that is generally done. |
If I remember well the motivation is that until not so long ago Using just |
@alalazo - that's correct. This PR pre-dates a few improvements |
It's been a while but I think I was suggesting we could also have a section in compilers:
- compiler:
environment:
# ...
extra_rpaths:
- /path/to/some/compiler/runtime/directory
- /path/to/some/other/compiler/runtime/directory Some compilers fails to |
Yes! This is what we need for compilers like the ones I'm forced to use! On Tue, Nov 8, 2016 at 10:57 AM, Todd Gamblin notifications@github.com
|
@scheibelp: want to take a stab at the above tweaks? |
Yes I can do that. Should be ready later today |
* Update bbp-packages.yaml Adding my currentscape module to bbp-packages. * Update modules.yaml Adding my currentscape package to the whitelist. * Create package.py Added my currentscape package. * Update var/spack/repos/builtin/packages/py-currentscape/package.py Co-authored-by: Matthias Wolf <m+git@sushinara.net> * Update var/spack/repos/builtin/packages/py-currentscape/package.py Co-authored-by: Matthias Wolf <m+git@sushinara.net> * Update var/spack/repos/builtin/packages/py-currentscape/package.py Co-authored-by: Matthias Wolf <m+git@sushinara.net> * Update package.py Modified the version. Is it better now? * update bglibpy to 4.4.6 (spack#937) * Update package.py Changing tag to match the one from source on gerrit. * Bglibpy 4.4.10 (spack#938) * update bglibpy to 4.4.6 * updated to bglpy 4.4.10 v 4.4.10 does not have the pandas, pyrsistent or the bluepy-configfile dependencies * Updates Libsonata package to include readers improvements (spack#940) * update glm to 0.9.9.3 (spack#943) * Bump neurodamus for most recent patches (spack#942) Bump neurodamus-py 2.0.0 to 2.0.2: - Fixing replay to work with multiple populations - Ensure data dir when skipping model build - Fix skipping synapse creation when weight is 0 (BBPBGLIB-673) - Fix deadlock when an exception is thrown from NEURON (BBPBGLIB-678) - Logging colors only for tty Bump neurodamus-core 3.0.0 to 3.0.1: - Avoid getting nilSecRef from objects (HPCTM-1381) * Update py-sonata-network-reduction dependencies: py-pyyaml@5.3.1, py-morph-tool@0.2.10 (spack#930) * Update bbp-packages.yaml Updated currentscape version. * Update package.py Updated version & tag. * Brion and Brayns are dependent on GLM (spack#944) * Steps updates (spack#941) * gmsh: add version 4.6.0 * omega-h: new version 9.32.5.dev3 * steps: new test requirements * libsonata-report: Improves initialization performance (spack#945) * adapt brion test to a new python module name (spack#946) * Adding nvidia-hpc-sdk based on upstream PR (spack#935) * New compiler: nvhpc (NVIDIA HPC SDK) (spack#19294) * Add nvhpc compiler definition: "spack compiler add" will now look for instances of the NVIDIA HPC SDK compiler executables (nvc, nvc++, nvfortran) in supplied paths * Add the nvhpc package which installs the nvhpc compiler * Add testing for nvhpc detection and C++-standard/pic flags Based on spack#19294 * Add CUDA@11 required for latest NVIDIA-HPC-SDK * Fix legacy apis : setup_environment to setup_run_environment * NEURON and CoreNEURON should use legacy units for BBP/HBP deployment (spack#947) * Update bbp-packages.yaml Adding my currentscape module to bbp-packages. * Update modules.yaml Adding my currentscape package to the whitelist. * Create package.py Added my currentscape package. * Update var/spack/repos/builtin/packages/py-currentscape/package.py Co-authored-by: Matthias Wolf <m+git@sushinara.net> * Update var/spack/repos/builtin/packages/py-currentscape/package.py Co-authored-by: Matthias Wolf <m+git@sushinara.net> * Update var/spack/repos/builtin/packages/py-currentscape/package.py Co-authored-by: Matthias Wolf <m+git@sushinara.net> * Update package.py Modified the version. Is it better now? * Update package.py Changing tag to match the one from source on gerrit. * Update bbp-packages.yaml Updated currentscape version. * Update package.py Updated version & tag. Co-authored-by: Matthias Wolf <m+git@sushinara.net> Co-authored-by: anilbey <anil.tuncel@epfl.ch> Co-authored-by: Sergio <sergio.rivasgomez@epfl.ch> Co-authored-by: ppodhajski <podhajski@gmail.com> Co-authored-by: Fernando Pereira <ferdonline@gmail.com> Co-authored-by: asanin-epfl <53935643+asanin-epfl@users.noreply.github.com> Co-authored-by: Nadir Román Guerrero <NadirRoGue@users.noreply.github.com> Co-authored-by: Tristan Carel <tristan.carel@gmail.com> Co-authored-by: Pramod Kumbhar <pramod.kumbhar@epfl.ch> Co-authored-by: Jaquier Aurélien Tristan <aurelien.jaquier@epfl.ch>
As mentioned in issue #332 this adds the possiblity to specify an LD_LIBRARY_PATH in compilers.yaml
If considered useful, I will clean up and document.