-
Notifications
You must be signed in to change notification settings - Fork 213
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
multiple definition of __aeabi_ul2d #353
Comments
This may be caused by rust-lang/rust#70846. |
This could be addressed by using similar organization of builtins as one in Another possibility is to treat it as a regression, reverting the changes to rustc. The situation with builtins is somewhat unfortunate, since rustc doesn't have |
I originally found it odd that splitting into more object files would cause regressions, but I'm assuming what's happening here is that C code linked after Rust code pulls in intrinsics from libgcc where the object files in libgcc happen to duplicate intrinsics pulled in by Rust originally from compiler-builtins, causing a link error. This presumably didn't happen before because when an object was pulled in from Rust it defined multiple symbols and prevented those from being loaded from libgcc. I think the best solution for this issue, if any, is to link libcompiler-builtins last in the linker. That way it's only used for leftovers in terms of whatever's remaining as undefined symbols. That way if libgcc defines a duplicate symbol with compiler-builtins it will be preferred. It should be the case that all duplicate symbols have the same ABI and same semantics, I believe. |
is there any update on this? im getting the same error for multiple builtins while linking rust libs to C code,
works with nightlies before the mentioned one. rather sad to be stuck with rust 1.44 forever... |
I'm having a similar problem: https://stackoverflow.com/questions/63950040/multiple-definition-of-aeabi-ul2f-on-android-ndk-libgcc-real-a but since my code is a mix of C++ and Rust I'm not sure what to do. I don't know much about linking, LLVM, libgcc_real.a, but what I think I understood is that this problem is happening because my Rust code (which is inside |
reddit would seem to be down at the moment, any chance you could add your suggestions to this issue? @alexcrichton thanks for the hint! compiling arm code linked against libsodium, swapping from
|
Copy/pasting from the Reddit thread I linked: Me
u/VadimVP
|
Upgrading to reqwest 0.11 seems to have caused us to start hitting rust-lang/compiler-builtins#353 for some reason. `-lgcc` is already at the end of our link lines, which is supposed to prevent the error, so I guess we have to force the issue with the hacky `--allow-multiple-definition` linker flag.
I think this comment is also relevant here. This would avoid having to specify the slightly dangerous |
When working on rust support we hit this issue rust-lang/compiler-builtins#353 which seems to still be persistent even in the case you have the nightly version mentioned there. I haven't been able to reproduce the issue in a separate project, but the core seems to be that both libgcc and rust's compiler builtins module vendor some float math symbols and both are included. This change is as scoped as possible so that no real issues could sneak in with this disabled, which should mostly be covered by only passing this for the single arch. Signed-off-by: Keith Smiley <[email protected]>
When working on rust support we hit this issue rust-lang/compiler-builtins#353 which seems to still be persistent even in the case you have the nightly version mentioned there. I haven't been able to reproduce the issue in a separate project, but the core seems to be that both libgcc and rust's compiler builtins module vendor some float math symbols and both are included. This change is as scoped as possible so that no real issues could sneak in with this disabled, which should mostly be covered by only passing this for the single arch. Signed-off-by: Keith Smiley <[email protected]>
Is there any updates? I face similar problems in rust 1.61.0 |
@alexcrichton May I know how to do this? Currently I use I am targeting normal android devices |
It should already be last in the link order. Can you share the full linker command-line that is failing? |
@Amanieu Sure. Thanks for the reply! In my case, I have opencv-rust as well as my rust code.
|
It seems that libgcc is bundling multiple functions in the same object file, which somewhat defeats the point of our workaround. Perhaps we should just switch to making all compiler-builtins functions weak? |
@Amanieu Sounds reasonable! So what can I do? |
I think it should just be a matter of marking all our intrinsics with |
When working on rust support we hit this issue rust-lang/compiler-builtins#353 which seems to still be persistent even in the case you have the nightly version mentioned there. I haven't been able to reproduce the issue in a separate project, but the core seems to be that both libgcc and rust's compiler builtins module vendor some float math symbols and both are included. This change is as scoped as possible so that no real issues could sneak in with this disabled, which should mostly be covered by only passing this for the single arch. Signed-off-by: Keith Smiley <[email protected]> Signed-off-by: JP Simard <[email protected]>
Trying to compile a sample app for a custom ARM target, I get the following linker error:
This issue was introduced with rustc 1.44.0-nightly (42abbd887 2020-04-07) (
rustup toolchain install nightly-2020-04-08-x86_64-unknown-linux-gnu
). Builds on previous versions succeed. Here's the diff between the two builds.The text was updated successfully, but these errors were encountered: