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

FreeBSD --disable-optimize breaks the stage 0 compile of ../src/librustc/lib.rs #30907

Open
dhuseby opened this Issue Jan 14, 2016 · 3 comments

Comments

Projects
None yet
5 participants
@dhuseby
Copy link

dhuseby commented Jan 14, 2016

I was trying to debug some of the unit test failures and made a build with the following configuration command

sh -c '../configure --prefix=/usr/local --disable-valgrind --disable-optimize --enable-debuginfo --disable-optimize-tests --enable-debuginfo-tests --enable-debug --build=x86_64-unknown-freebsd --host=x86_64-unknown-freebsd'

The build of stage 0 librustc fails with the following message:

note: "cc" "-m64" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib/rustc-ca1c9     70e.0.o" "-o" "x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib/librustc-ca1c970e.so" "x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib/rustc-ca1c970e.     metadata.o" "-nodefaultlibs" "-L" "x86_64-unknown-freebsd/rt" "-L" "/opt/rust/build/x86_64-unknown-freebsd/llvm/Release+Asserts/lib" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/ru     stlib/x86_64-unknown-freebsd/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "flate-ca1c970e" "-L" "/opt/r     ust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "graphviz-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd     /lib" "-l" "fmt_macros-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "arena-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd     /stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "rbml-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "getopts-ca1c970e" "-L" "     /opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "rustc_data_structures-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86     _64-unknown-freebsd/lib" "-l" "rustc_back-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "rustc_front-ca1c970e" "-L" "/opt/rust/bui     ld/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "syntax-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l     " "term-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "serialize-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib     /rustlib/x86_64-unknown-freebsd/lib" "-l" "log-ca1c970e" "-L" "/opt/rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "rustc_llvm-ca1c970e" "-L" "/opt/rust     /build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "std-ca1c970e" "-l" "pthread" "-l" "edit" "-l" "m" "-l" "c++" "-l" "execinfo" "-l" "pthread" "-l" "gcc_s" "-l     " "pthread" "-l" "c" "-l" "m" "-l" "rt" "-shared" "-Wl,-rpath,$ORIGIN/" "-Wl,-rpath,/usr/local/lib/rustlib/x86_64-unknown-freebsd/lib" "-l" "compiler-rt"
note: x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib/rustc-ca1c970e.0.o: file not recognized: File format not recognized

Hrm...File format not recognized. If I run the file command on the object file, I get:

x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/lib/rustc-ca1c970e.0.o: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), stripped

I then ran an --enable-optimize build--which succeeds--just to compare the command line run when compiling this part of the code. The only difference is after --cfg stage 0 the optimized build also has -O --cfg rtopt. I'm not sure how adding that avoids a bug that causes a malformed object file from being created. Or maybe adding that causes the linker to recognize the file. Not sure where the bug lies yet.

@dhuseby dhuseby self-assigned this Jan 14, 2016

@semarie

This comment has been minimized.

Copy link
Contributor

semarie commented Feb 4, 2016

I have some problem under OpenBSD when building with --disable-optimize: file not recognized: File format not recognized

@dhuseby

This comment has been minimized.

Copy link

dhuseby commented Feb 5, 2016

@semarie I wonder how many of the bsd platforms suffer from this? seems like a compiler bug to me.

@steveklabnik steveklabnik added T-compiler and removed A-compiler labels Mar 24, 2017

@sanxiyn sanxiyn removed the A-bsd label Jun 24, 2017

@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Oct 31, 2018

Triage: I am not aware of any changes, but I also don't use BSD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment