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

Crate DAG is not respected when filling in -L flags #2354

Closed
alexcrichton opened this issue Feb 2, 2016 · 1 comment
Closed

Crate DAG is not respected when filling in -L flags #2354

alexcrichton opened this issue Feb 2, 2016 · 1 comment

Comments

@alexcrichton
Copy link
Member

Right now when Cargo passes -L flags to the compiler from the output of build scripts, the crate DAG is not preserved. For example, if crate A links against path pathA, crate B links against pathB, and B depends on A. Cargo will compile B like:

rustc b/src/lib.rs -L native=pathA -L native=pathB

Instead it should pass pathB first and in general use a topological ordering to ensure that more relevant paths come first.

This was discovered by Servo where a native library was being picked up from /usr/lib even though it was properly compiled into the build directory. The /usr/lib version wouldn't link while the build directory one was the correct one to use.

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Feb 2, 2016
Cargo needs to ensure that if a build script prints a `-L` path that it's the
first `-L` path passed to the compiler. That way the build script can be sure
that any output it generated is the first to be considered by the compiler.

Closes rust-lang#2354
bors added a commit that referenced this issue Feb 2, 2016
Cargo needs to ensure that if a build script prints a `-L` path that it's the
first `-L` path passed to the compiler. That way the build script can be sure
that any output it generated is the first to be considered by the compiler.

Closes #2354
@bors bors closed this as completed in #2355 Feb 2, 2016
@larsbergstrom
Copy link

Awesome, thanks for jumping on this so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants