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

Linking fails when using a crate name alias #1706

Closed
brson opened this issue Jan 30, 2012 · 2 comments
Closed

Linking fails when using a crate name alias #1706

brson opened this issue Jan 30, 2012 · 2 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone

Comments

@brson
Copy link
Contributor

brson commented Jan 30, 2012

use stdlib(name = "std");                                                                                                                                                     

fn main() {                                                                                                                                                                   
}                                                                                                                                                                             
error: linking with gcc failed with code 1
note: gcc arguments: -L/home/brian/dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib -m64 -o x86_64-unknown-linux-gnu/test/run-pass/corelib.stage1-x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu/test/run-pass/corelib.o -L/home/brian/dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib -lcore-14bd852465126fe7-0.1 -L/home/brian/dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib -lstd-79ca5fac56b63fde-0.1 -lm -lrustrt -lrt -ldl -lmorestack -Wl,-rpath,$ORIGIN/../../stage1/lib/rustc/x86_64-unknown-linux-gnu/lib -Wl,-rpath,/home/brian/dev/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustc/x86_64-unknown-linux-gnu/lib -Wl,-rpath,/home/brian/dev/rust-install/lib/rustc/x86_64-unknown-linux-gnu/lib
note: x86_64-unknown-linux-gnu/test/run-pass/corelib.o:(.data.rel+0x10): undefined reference to `_rust_crate_map_stdlib'
collect2: ld returned 1 exit status

error: aborting due to previous errors
@lht
Copy link
Contributor

lht commented Jan 31, 2012

Progress update: Patch 6632f145b3d03054d6c89d867b4d3495c326c906 works on Mac&Linux, but failed on Windows. Error like:

error: linking with gcc failed with code 1 note: gcc arguments: 
......
note: i686-pc-mingw32/stage2/bin/rustc/i686-pc-mingw32/bin/run_pass_stage2.o:(.data+0xc): 
undefined reference to `_rust_crate_map_std9' collect2: ld returned 1 exit status 

@lht
Copy link
Contributor

lht commented Jan 31, 2012

Just noticed a FIXME at https://github.com/mozilla/rust/blob/master/src/comp/middle/trans/base.rs#L5415

The crate_hash is available now by metadata::decoder::get_crate_hash, so I guess we should switch to hashes. Hopefully this could workaround the mysterious fault on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

2 participants