Repository navigation
Implicit link paths - #7153
Implicit link paths#7153
Conversation
a7dea12 to
09cd996
Compare
09cd996 to
3f2eaaa
Compare
|
This will be really useful! With this branch checked out on an ubuntu 16.04 VM, I installed llvm inside a spack instance and did this: The clang compiler was picked up correctly, and the implicit link paths were deduced as: Is it correct/expected that it would be picking up those library paths related to the system's gcc compiler? |
That depends on the build. It may have compiled those in during its build. |
|
OK. So this could be an issue with the For what it's worth, here is the output of a verbose build using the clang++ compiler from the llvm package. So it does seem like the PR is doing the right thing in this case and the behaviour I'm seeing is caused by issues elsewhere. Will there be a separate PR to have spack act upon the information in the |
3f2eaaa to
8ad3608
Compare
tgamblin
left a comment
There was a problem hiding this comment.
Looks mostly good! Thanks. I added some comments. Also, this needs a few unit tests with output from different compilers. Can you add unit tests?
If you need access to the compilers, we have them on our clusters. You can module load them.
8ad3608 to
fe7506d
Compare
|
Updated for the requested changes. Unit tests are still missing. Though, I'm not sure what to expect in those tests. |
|
@mathstuf: can you just make the tests simple scripts or test cases to exercise the parsing logic? Basically I would just run each compiler with the |
This is what I don't know to write in the tests. A compiler loaded from |
Maybe I was vague. I mean you could run a compiler on the cluster and take its output and put that in the test suite to exercise things. So the test suite shouldn't actually interact with a compiler -- just some saved output, for which you'd know what to expect. |
|
Well, that'd make the test pass (or not-skipped) on that one machine and fail (or skip) on everything else. I doubt the efficacy of such a test. |
|
It's not supposed to be a machine-specific test, just a spot test to prevent regression in the parser. Let's get the output of several different compilers (on several machines if you want), and make sure And the test would read those in and validate that Agreed that it's not going to validate every machine, but it's better than nothing. |
|
That still doesn't help. My |
I added two simple tests to show what I'm talking about. Again, it's not a system test, it's a parser regression test. All I had to do was factor out the parsing part. Can you add some more for other compilers? There's another question in here which is where we should filter system paths. We're going to |
0201621 to
485b8ab
Compare
485b8ab to
5e1736b
Compare
|
Ah, I see now. Sorry, I missed that you wanted a refactor to separate out the inner logic. This makes more sense now. I updated it to also check that we don't extract incorrect paths from the compilers.
I think it should be filtered where RPATHs are handled. The implicit link paths are used no matter what. Spack should filter where it adds rpaths, not in the storage of the implicit link paths. |
|
@tgamblin: this is an update on the current state of the PR. I'm currently considering a few ways to achieve the appropriate balance in filtering paths. Originally this was failing because the following implicit link directories are detected for gcc 4.8 (i.e. this is from In particular, Currently this is addressed by following up after
I can think of three ways to proceed with this:
|
e02efdd to
063cb07
Compare
tgamblin
left a comment
There was a problem hiding this comment.
Last request: _parse_implicit_rpaths should be fully covered. The other stuff (like verbose_flag) seems unnecessary, but there are parts of that method that are not yet covered by the tests.
c35f257 to
85c693d
Compare
|
This looks great! The only question I had seems to have already been asked: why are we creating an extra field called |
@adamjstewart because the Libraries in |
a025bc9 to
222b586
Compare
Uses code from CMake to detect implicit link paths from compilers System paths are filtered out of implicit link paths Implicit link paths added to compiler config and object under `implicit_rpaths` Implicit link paths added as rpaths to compile line through env/cc wrapper Authored by: "Ben Boeckel <[email protected]>" Co-authored by: "Peter Scheibel <[email protected]>" Co-authored by: "Gregory Becker <[email protected]>"
222b586 to
bb4827c
Compare
|
The other main gist of it is that |
|
I'm seeing some odd behavior with this PR. When I run compilers:
- compiler:
environment: {}
extra_rpaths: []
flags: {}
implicit_rpaths:
- /opt/cray/cce/8.4.6/CC/x86-64/lib/x86-64
- /opt/gcc/4.8.1/snos/lib64
- /opt/cray/dmapp/default/lib64
- /opt/cray/mpt/7.5.0/gni/mpich-cray/8.4/lib
- /opt/cray/libsci/16.11.1/CRAY/8.3/x86_64/lib
- /sw/xe/darshan/3.1.3/darshan-3.1.3/lib
- /opt/cray/rca/1.0.0-2.0502.60530.1.63.gem/lib64
- /opt/cray/alps/5.2.4-2.0502.9774.31.12.gem/lib64
- /opt/cray/xpmem/0.1-2.0502.64982.5.3.gem/lib64
- /opt/cray/dmapp/7.0.1-1.0502.11080.8.74.gem/lib64
- /opt/cray/pmi/5.0.10-1.0000.11050.179.3.gem/lib64
- /opt/cray/ugni/6.0-1.0502.10863.8.28.gem/lib64
- /opt/cray/udreg/2.3.2-1.0502.10518.2.17.gem/lib64
- /opt/cray/atp/2.0.4/libApp
- /opt/cray/cce/8.4.6/craylibs/x86-64
- /opt/cray/wlm_detect/1.0-1.0502.64649.2.2.gem/lib64
- /opt/gcc/4.8.1/snos/lib/gcc/x86_64-suse-linux/4.8.1
- /opt/cray/cce/8.4.6/cray-binutils/x86_64-unknown-linux-gnu/lib
modules: []
operating_system: suse_linux11
paths:
cc: /opt/cray/craype/2.5.8/bin/cc
cxx: /opt/cray/craype/2.5.8/bin/CC
f77: /opt/cray/craype/2.5.8/bin/ftn
fc: /opt/cray/craype/2.5.8/bin/ftn
spec: [email protected]
target: x86_64
- compiler:
environment: {}
extra_rpaths: []
flags: {}
implicit_rpaths:
- /usr/lib64/gcc/x86_64-suse-linux/4.3
- /sw/EasyBuild/software/cURL/7.59.0/lib
- /sw/EasyBuild/software/OpenSSL/1.0.2m/lib
- /usr/x86_64-suse-linux/lib
modules: []
operating_system: suse_linux11
paths:
cc: /usr/bin/X11/gcc-4.3
cxx: /usr/bin/X11/g++-4.3
f77: null
fc: null
spec: [email protected]
target: x86_64
- compiler:
environment: {}
extra_rpaths: []
flags: {}
implicit_rpaths:
- /usr/lib64/gcc/x86_64-suse-linux/4.3
- /sw/EasyBuild/software/cURL/7.59.0/lib
- /sw/EasyBuild/software/OpenSSL/1.0.2m/lib
- /usr/x86_64-suse-linux/lib
modules: []
operating_system: suse_linux11
paths:
cc: null
cxx: null
f77: /usr/bin/X11/gfortran-4.3
fc: /usr/bin/X11/gfortran-4.3
spec: [email protected]
target: x86_64
- compiler:
environment: {}
extra_rpaths: []
flags: {}
implicit_rpaths:
- /usr/lib64/gcc/x86_64-suse-linux/4.7
- /sw/EasyBuild/software/cURL/7.59.0/lib
- /sw/EasyBuild/software/OpenSSL/1.0.2m/lib
- /usr/x86_64-suse-linux/lib
modules: []
operating_system: suse_linux11
paths:
cc: /usr/bin/X11/gcc-4.7
cxx: /usr/bin/X11/g++-4.7
f77: null
fc: null
spec: [email protected]
target: x86_64A user on Slack reported the same issue: implicit_rpaths:
- /cm/shared/apps/slurm/14.03.0/lib64
- /md1200-1/home/CMAP/ruben.di-battista/.opt/linux-scientific6-x86_64/gcc-4.4.7/gcc-5.5.0-2jzzwnbvmmzblo26gkspqky6hxw7pk27/lib64
- /md1200-1/home/CMAP/ruben.di-battista/.opt/linux-scientific6-x86_64/gcc-4.4.7/gcc-9.2.0-hp2yw3l6kykego2cgj3diofr27ovo35d/lib/gcc/x86_64-pc-linux-gnu/9.2.0
- /md1200-1/home/CMAP/ruben.di-battista/.opt/linux-scientific6-x86_64/gcc-4.4.7/gcc-9.2.0-hp2yw3l6kykego2cgj3diofr27ovo35d/lib64
- /md1200-1/home/CMAP/ruben.di-battista/.opt/linux-scientific6-x86_64/gcc-5.5.0/ncurses-6.1-73q5txyg6am43d4kzs34eeea6edwagcp/lib
- /md1200-1/home/CMAP/ruben.di-battista/.opt/linux-scientific6-x86_64/gcc-4.4.7/gcc-5.5.0-2jzzwnbvmmzblo26gkspqky6hxw7pk27/lib
- /md1200-1/home/CMAP/ruben.di-battista/.opt/linux-scientific6-x86_64/gcc-4.4.7/gcc-9.2.0-hp2yw3l6kykego2cgj3diofr27ovo35d/libThis user encountered build errors with numpy, and had to remove these implicit_rpaths in order to build numpy. |
|
@becker33 getting more reports of erroneous implicit RPATHs causing build failures: #12709 (comment) |
Uses code from CMake to detect implicit link paths from compilers System paths are filtered out of implicit link paths Implicit link paths added to compiler config and object under `implicit_rpaths` Implicit link paths added as rpaths to compile line through env/cc wrapper Authored by: "Ben Boeckel <[email protected]>" Co-authored by: "Peter Scheibel <[email protected]>" Co-authored by: "Gregory Becker <[email protected]>"
Resolves #7115.
Currently Spack assumes that compilers add
RPATHs for any non-standard runtime directories they use. For example, versions ofg++and the Intel compiler that support newer versions of C++ need an updatedlibstdc++.so, so they link against alibstdc++.soin$gcc_prefix/lib64. We call$gcc_prefix/lib64here an "implicit link path" because the compiler implicitly links against libaries there that were not included on the command line.While Spack-built compilers add
RPATHs for these directories, compilers installed at many sites do not. This leads to the following type of error when you run binaries built with these compilers:The solution so far has been to manually add
extra_rpathstocompilers.yaml, which forces Spack to add theRPATHs, or to tell users to load the compiler's module when running with binaries it generated. Neither of these is ideal.This PR eliminates those requirements by doing a few things:
Spack now auto-detects implicit link paths when it detects compilers, by querying compilers for what their implicit link paths are. This is borrowed from what CMake does to detect implicit link paths.
Spack adds these paths to
compilers.yamlin a newimplicit_rpathsfield:Spack's compiler wrappers now automatically inject implicit RPATHs into binaries they build.
So, in summary, you likely no longer need to fiddle with
extra_rpaths. If you do have to, file an issue, and we'll see if we need to add more detection for it.