Skip to content

Nightly rust compiler failing to link on Centos 7 #37812

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

Closed
bossmc opened this issue Nov 16, 2016 · 3 comments
Closed

Nightly rust compiler failing to link on Centos 7 #37812

bossmc opened this issue Nov 16, 2016 · 3 comments

Comments

@bossmc
Copy link
Contributor

bossmc commented Nov 16, 2016

After updating to the new nightly compiler, my builds are all failing with the following error:

[root@athens ~]# rustup run nightly rustc test.rs 
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "test.0.o" "-o" "test" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1357b93f.rlib" "/root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-1357b93f.rlib" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
  = note: /usr/bin/ld: /root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1357b93f.rlib(fileline.o)(.debug_frame+0x6c): reloc against `.debug_frame': error 2
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status


error: aborting due to previous error

Inspecting the rlib with objdump reports the following errors:

[root@athens ~]# objdump -r /root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1357b93f.rlib > /dev/null
BFD: /root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1357b93f.rlib(print.o): invalid relocation type 42
BFD: BFD version 2.23.52.0.1-55.el7 20130226 assertion fail elf64-x86-64.c:334
BFD: /root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1357b93f.rlib(print.o): invalid relocation type 42
BFD: BFD version 2.23.52.0.1-55.el7 20130226 assertion fail elf64-x86-64.c:334
BFD: /root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1357b93f.rlib(print.o): invalid relocation type 42
BFD: BFD version 2.23.52.0.1-55.el7 20130226 assertion fail elf64-x86-64.c:334
BFD: /root/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1357b93f.rlib(print.o): invalid relocation type 42
BFD: BFD version 2.23.52.0.1-55.el7 20130226 assertion fail elf64-x86-64.c:334

Support for "Relocation type 42" was added to newer versions of ld (from the binutils package). On a box with binutils version 2.26.1 (Ubuntu Xenial) these errors disappear and the original link is successful.

Centos 7 currently ships with binutils version 2.23.52.0.1 which can't handle the new relocation types so can't compile any rust code.

@steveklabnik
Copy link
Member

I think this is a duplicate of #37786

It should be fixed, and tonight's nightly should have the fix.

@alexcrichton
Copy link
Member

Thanks for the report! This is indeed fixed in the most recent nightly but if it's still not working please feel free to let us know!

@bossmc
Copy link
Contributor Author

bossmc commented Nov 17, 2016

Looks good to me, good work!

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

3 participants