-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
ld error while building Mercurial with Rust #71
Comments
Hmm, I'm not sure what's going on here. But I think that it's very unlikely that your problem is related to how conda-forge packages the Rust toolchain. The error is occurring at the level of conda-forge's C/binutils toolchain, but that toolchain is extremely well tested for basic operations like this. So, my best guess is that the Mercurial+Rust build system is somehow doing something unusual that triggers this error. I'm going to close this because I just can't see that this issue would be related to how we're packaging Rust. I think you might have to dig deeper into how the Mercurial+Rust build is working. |
Try installing |
Installing However, I think I understood and that this issue should be reopened and fixed so that cargo installed with conda really works 🙂 The problem is related to the fact that "cargo install does not respect LDFLAGS" rust-lang/cargo#3694 and that in conda, the library path
Therefore I was able to compile Mercurial by setting Adding the other options that are in |
Thanks for digging a bit deeper, that helps clarify the discussion. I'm not sure how we should approach this. I kind of want to say that this sort of default search path stuff is the job of the lower-level toolchain, and if there's any problem here it should be addressed at that level rather than in Rust. But I don't understand the semantics of the default library search paths in the compilers that we ship, and I could see that maybe a default RUSTFLAGS environment setting would be appropriate. |
I don't understand why rustc doesn't take into account LDFLAGS. I mean it uses the linker (via x86_64-conda-linux-gnu-cc) so it should pass the values in LDFLAGS to x86_64-conda-linux-gnu-cc. I think for conda, the options |
My guess is that the aim is to encourage reproducibility and explicitness in build processes. We may be accustomed to injecting low-level linker flags from environment variables, but it's really not a great method because it adds invisible statefulness to the build. But anyway, even if we were all convinced that rustc should obey LDFLAGS, we shouldn't make such a change in our Rust package, I think — that would be a pretty profound behavior change to apply in a vendor patch. For this feedstock, I think the question is whether we should be setting up a default RUSTFLAGS environment variable or something. |
@paugier, can you try installing |
I tried with |
Note that it works with
But it does not seem to work with |
I'm having this same issue with rust 1.60 installed from conda-forge, on Ubuntu 21.10.
|
However, @paugier's fix worked for me, running the following before building. export RUSTFLAGS="-C link-arg=-Wl,-rpath-link,$CONDA_PREFIX/lib -C link-arg=-Wl,-rpath,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" |
JFYI we recently had to build a wheel package that includes a Rust binary inside a conda environment and we stumbled on this problem. using the |
I also noticed that https://github.com/conda-forge/rust-activation-feedstock/blob/main/recipe/activate.sh#L19 adds |
I tried to build Mercurial with Rust from conda-forge. I did
It ends with an error related to the fact that the linker can't find libz:
I find it strange that /data0/opt/miniconda3/envs/env_hg_rust/x86_64-conda-linux-gnu/bin/ld can't find /data0/opt/miniconda3/envs/env_hg_rust/lib/libz.so.
I tried simple things with LIBRARY_PATH and LD_LIBRARY_PATH but without success.
I don't know if it is something related with Rust or just a conda bug. Do you see how to solve this problem?
Environment (
conda list
):Details about
conda
and system (conda info
):The text was updated successfully, but these errors were encountered: