-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Cannot link to third-party Rust libraries in the same prefix rustc
was installed to
#13733
Comments
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 |
No, that's the
(libsplay was compiled without the extra paths) |
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 |
I imagine it would also increase sanity in the build system to move to an all-static-ish bootstrap. |
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. |
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. |
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:
|
@Jurily Syntax extensions need to link against |
Maybe we should just use |
FWIW I'm currently testing code to do the prioritize-target-lib-path approach right now. |
Hmm. In that case, |
@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. |
Prioritizing the target lib path makes |
When multiple candidates for a library are found, if one (and only one) candidate lives in the target library path, prioritize that one. This allows `rustc -L /usr/local/lib lib.rs` to compile successfully, whereas today it complains about multiple candidates for e.g. libstd. Fixes rust-lang#13733, rust-lang#11195.
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 |
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? |
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 |
I think that the problem with OS X 10.10 is that there appears to be a |
@alexcrichton Any chance Rust could simply pass |
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 |
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? |
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 |
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 |
I'm having the same issue. I can't link a C library installed in |
I am not sure if helps, but I had similar issues with linking a C library to To find out if |
Assuming this is still a problem. Any updates? |
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. |
feat: Add "Remove redundant parentheses" assist ![Peek 2022-12-08 22-22](https://user-images.githubusercontent.com/38225716/206542898-d6c97468-d615-4c5b-8650-f89b9c0321a0.gif) Can be quite handy when refactoring :)
fix: Correctly check for parentheses redundancy in `remove_parentheses` assist This is quite a bunch of code and some hacks, but I _think_ this time it's correct. I've added a lot of tests, most of which fail with the assist impl from rust-lang#13733 :')
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
$LDPATH
manually:Lose-lose. I assume there are valid reasons for this, but it's still confusing:
rustc
needs its own set, wouldn't it make sense to link them statically?rustc
figure 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.
The text was updated successfully, but these errors were encountered: