Closed
Description
Let's say I have 3 modules main.rs
, a.rs
and b.rs
, and two external libraries libfoo.a
and libbar.a
, and that libbar
depends on symbols defined in libfoo
.
main.rs
mod a;
mod b;
fn main() {}
a.rs
#[link(name = "foo")]
extern {}
b.rs
#[link(name = "bar")]
#[link(name = "foo")]
extern {}
Because rustc de-dupes the list of external libraries, it will pass to linker only -lfoo -lbar
. However gnu linker does not look for unresolved symbols in libraries it had already processed, so it will fail to resolve libbar's references to libfoo. The correct command line would have been -lfoo -lbar -lfoo
.
Rustc should not de-duplicate the list of libraries. Furthermore, I think it should guarantee that libs will appear in the same order on the linker command line as they did in the source file.
Metadata
Metadata
Assignees
Labels
No labels