Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upCannot link to third-party Rust libraries in the same prefix `rustc` was installed to #13733
Comments
This comment has been minimized.
This comment has been minimized.
They're built in an earlier stage, so in theory this could break due to either bugs or stage markers. In practice, it's fine to link them and I do it in my Arch Linux package. https://projects.archlinux.org/svntogit/community.git/tree/trunk?h=packages/rust
Only one of these should be in the library search path. I'm not quite sure what's going wrong, but perhaps it has to do with you adding the |
This comment has been minimized.
This comment has been minimized.
No, that's the
(libsplay was compiled without the extra paths) |
This comment has been minimized.
This comment has been minimized.
|
This is indeed a bit of a problem with our directory layout. And I've brought it up with @brson before. The gist of it is that:
This means the host library (the one in That's the situation, and one possible solution is to assume convergence and not distribute target artifacts for the host architecture (have it all in |
This comment has been minimized.
This comment has been minimized.
|
I imagine it would also increase sanity in the build system to move to an all-static-ish bootstrap. |
alexcrichton
referenced this issue
Apr 25, 2014
Closed
Add an option to re-allow false positives in crate loading. #13764
This comment has been minimized.
This comment has been minimized.
|
This issue is becoming problematic for me now, because OS X 10.10 no longer searches /usr/local/lib by default for libraries. I can no longer compile rust-lua because it can't find How did rustc handle this issue before? Did it simply not search /usr/local/lib for crates, but the system linker would go ahead and search it when linking the final result to find third-party libs? I think rustc needs to simply prioritize dylibs found inside the target library root over anything else. |
This comment has been minimized.
This comment has been minimized.
|
An alternative might be to add a metadata bit to the crate that says "this is a host crate", and use that to skip the crate when looking for target crates. |
This comment has been minimized.
This comment has been minimized.
|
I still think the solution is to link Moving to a prefer-static build would likely do good things to the cross-platform story as well. For a workaround, FHS says:
|
This comment has been minimized.
This comment has been minimized.
|
@Jurily Syntax extensions need to link against |
This comment has been minimized.
This comment has been minimized.
|
Maybe we should just use |
This comment has been minimized.
This comment has been minimized.
|
FWIW I'm currently testing code to do the prioritize-target-lib-path approach right now. |
This comment has been minimized.
This comment has been minimized.
|
Hmm. In that case, |
This comment has been minimized.
This comment has been minimized.
|
@Jurily The compiler is built on top of what we install already. The difference is there's target crates and host crates. We install both, just in separate directories. |
This comment has been minimized.
This comment has been minimized.
|
Prioritizing the target lib path makes |
lilyball
added a commit
to lilyball/rust
that referenced
this issue
Jun 4, 2014
lilyball
referenced this issue
Jun 4, 2014
Closed
Prioritize target libs when there's multiple candidates #14650
This comment has been minimized.
This comment has been minimized.
|
I'm confused. I thought @thestinger's Arch build was just an ugly hack that happens to work. Is there a good reason to have a separate target set for |
jauhien
referenced this issue
Aug 10, 2014
Closed
Problems with linking with system-wide installed libraries #16402
This comment has been minimized.
This comment has been minimized.
|
This is still a problem, and still prevents me from using rust-lua on OS X 10.10. Is there any plan to resolve this? |
This comment has been minimized.
This comment has been minimized.
Gujie
commented
Oct 24, 2014
|
Hi guys, I don't know if your still working on this. I also had a linkage problem since I updated to 10.10. My programs couldn't find my third parties libraries... I solved it by adding: "set(CMAKE_EXE_LINKER_FLAGS -L/usr/local/lib)" to my CMakeLists.txt |
This comment has been minimized.
This comment has been minimized.
|
I think that the problem with OS X 10.10 is that there appears to be a |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Any chance Rust could simply pass |
This comment has been minimized.
This comment has been minimized.
|
I'd be somewhat wary of adding an arbitrary path for one OS to a place that may not be wanted. We'd have to add in the default |
This comment has been minimized.
This comment has been minimized.
|
Using the new cargo build scripts, I ran into this issue. When using the pkg-config crate, it may pass Is there any workaround or fix for this? |
steveklabnik
added
the
A-build
label
Jan 23, 2015
This comment has been minimized.
This comment has been minimized.
|
A note that may be relevant, considering the original motivation for this was an Exheres repository: Exherbo, the distro that uses that package format (package manager is Paludis), has transitioned to a multiarch setup in which each target's libraries live under |
This comment has been minimized.
This comment has been minimized.
|
Edit: disregard everything below, it's not related to this issue - I'm trying to link to native libraries, which is resolved by This is biting me with a musl-enabled build of rust installed to a custom prefix and trying to build an rlib. Musl itself and musl-rust are installed in $PREFIX, but rustc does not search $PREFIX/lib for libc.a when building an rlib.
As a result, anything trying to do Though in my case I think |
This comment has been minimized.
This comment has been minimized.
martinraison
commented
Nov 24, 2015
|
I'm having the same issue. I can't link a C library installed in |
This comment has been minimized.
This comment has been minimized.
Chuongv
commented
Dec 3, 2015
|
I am not sure if helps, but I had similar issues with linking a C library to To find out if |
brson
added
T-tools
P-low
labels
May 4, 2017
This comment has been minimized.
This comment has been minimized.
|
Assuming this is still a problem. Any updates? |
Mark-Simulacrum
added
T-dev-tools
and removed
T-tools
labels
May 24, 2017
Mark-Simulacrum
added
C-enhancement
C-bug
and removed
C-enhancement
I-wrong
labels
Jul 21, 2017
This comment has been minimized.
This comment has been minimized.
|
Triage: it's been over a year since the last comment asking for updates; the last real comment here is from 2015. The original reporter has deleted their GitHub account. As such, I'm going to give this a close; if anyone is still seeing this issue, please let me know and I'm happy to re-open. |
ghost commentedApr 24, 2014
I'm working on a repository for the Paludis package manager, and Rust has trouble with the standard system paths.
With standard invocation:
So then I had the wonderful idea to feed it
$LDPATHmanually:Lose-lose. I assume there are valid reasons for this, but it's still confusing:
rustcneeds its own set, wouldn't it make sense to link them statically?rustcfigure out which one to use?I could use a completely different directory of course, but that's an ugly workaround and would likely hurt upstream chances.