spack/lib/spack
becker33 cd9691de53 cc: package search paths come before dependency paths (#4692)
Spack currently prepends include paths, library paths, and rpaths to the compile line.  This causes problems when a header or library in the package has the same name as one exported by one of its dependencies.  The *dependency's* header will be preferred over the package's, which is not what most builds expect.  This also breaks some of our production codes.

This restores the original cc behavior (from *very* early Spack) of parsing compiler arguments out by type (`-L`, `-I`, `-Wl,-rpath`) and reconstituting the full command at the end.

`<includes> <other_args> <library dirs> <rpaths>`

This differs from the original behavior in one significant way, though: it *appends* the library arguments so that dependency libraries do not shadow those in the build. 

This is safe because semantics aren't affected by *interleaving* `-I`, `-L`, and `-Wl,-rpath` arguments with others, only with each other (so the order fo two `-L` args affects the search path, but we search for all libraries on the command line using the same search path).

We preserve the following:
1. Any system directory in the paths will be listed last.
2. The root package's include/library/RPATH flags come before flags of the same type for any dependency.
3. Order will be preserved within flags passed by the build (except system paths, which are moved to be last)
4. Flags for dependencies will appear between the root flags and the system flags, and the flags for any dependency will come before those for *its* dependencies (this is for completeness -- we already guarantee this in `build_environment.py`)
2018-08-01 15:48:00 -07:00
..
docs docs: minor text changes (#8858) 2018-08-01 13:59:51 -07:00
env cc: package search paths come before dependency paths (#4692) 2018-08-01 15:48:00 -07:00
external pytest: add _pytest/_version.py and LICENSE 2018-06-20 14:35:10 -05:00
llnl bugfix: fix spack spec --yaml 2018-07-24 11:25:34 -07:00
spack cc: package search paths come before dependency paths (#4692) 2018-08-01 15:48:00 -07:00