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

Link with circular reference among 2 crates under Linux in Rust? #13

Closed
bh1xuw opened this issue Mar 30, 2020 · 1 comment
Closed

Link with circular reference among 2 crates under Linux in Rust? #13

bh1xuw opened this issue Mar 30, 2020 · 1 comment

Comments

@bh1xuw
Copy link
Owner

bh1xuw commented Mar 30, 2020

This issue is to track how to solve circular reference link error under Linux.

MacOS(llvm-lld) is OK to handle the circular references while linking.

GCC reuqire that you put the object files and libraries in the order that they depend on each other.

ld accepts the following options:

-( archives -)
--start-group archives --end-group

The specified archives are searched repeatedly until no new undefined references are created.

Yet, rust won't wrap user-defined in repeated search group.

Option 1

Use lld under Linux:

RUSTFLAGS="-C link-arg=-fuse-ld=lld" cargo test

Option 2

Use shell wrapper: #12

@bh1xuw
Copy link
Owner Author

bh1xuw commented May 11, 2020

lld works. never mind.

@bh1xuw bh1xuw closed this as completed May 11, 2020
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

1 participant