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

Use the "official" cross compiler for NetBSD #40612

Merged
merged 4 commits into from
Mar 23, 2017

Conversation

TimNN
Copy link
Contributor

@TimNN TimNN commented Mar 17, 2017

The current NetBSD cross compiler is lacking, for example std::thread is not available (which causes problems for LLVM 4.0). This PR uses the official netbsd build system to compiler the cross compiler.

@alexcrichton: Can you please mirror ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/source/sets/{src,gnusrc,sharesrc,syssrc}.tgz. (Optionally you may want to use NetBSD versions 7.0.2 or 7.1, in that case you'll probably want to update the binary downloads used today as well).

I'll update the URL's afterwards (or feel free to use "allow edits from maintainers").

r? @alexcrichton

@alexcrichton
Copy link
Member

I've pushed a commit with artifacts mirrored in our S3 bucket

@alexcrichton
Copy link
Member

r=me as soon as this is green on travis, thanks @TimNN!

@TimNN
Copy link
Contributor Author

TimNN commented Mar 18, 2017

I couldn't reproduce the failure locally, however it did occur again on travis (I restarted the build). This is the failure message:

Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-netbsd)
   Compiling gcc v0.3.43
   Compiling arena v0.0.0 (file:///checkout/src/libarena)
   Compiling libc v0.2.21
   Compiling serialize v0.0.0 (file:///checkout/src/libserialize)
   Compiling rustc_platform_intrinsics v0.0.0 (file:///checkout/src/librustc_platform_intrinsics)
   Compiling filetime v0.1.10
   Compiling fmt_macros v0.0.0 (file:///checkout/src/libfmt_macros)
   Compiling log v0.0.0 (file:///checkout/src/liblog)
   Compiling graphviz v0.0.0 (file:///checkout/src/libgraphviz)
   Compiling build_helper v0.1.0 (file:///checkout/src/build_helper)
   Compiling rustc_bitflags v0.0.0 (file:///checkout/src/librustc_bitflags)
   Compiling flate v0.0.0 (file:///checkout/src/libflate)
   Compiling rustdoc v0.0.0 (file:///checkout/src/librustdoc)
   Compiling rustc_llvm v0.0.0 (file:///checkout/src/librustc_llvm)
   Compiling rustc_data_structures v0.0.0 (file:///checkout/src/librustc_data_structures)
   Compiling syntax_pos v0.0.0 (file:///checkout/src/libsyntax_pos)
   Compiling rustc_errors v0.0.0 (file:///checkout/src/librustc_errors)
   Compiling syntax v0.0.0 (file:///checkout/src/libsyntax)
error: linking with `x86_64--netbsd-gcc-sysroot` failed: exit code: 1
  |
  = note: "x86_64--netbsd-gcc-sysroot" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-netbsd/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-netbsd/release/deps/rustc_llvm-3aedc27cea629d08.0.o" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-netbsd/release/deps/librustc_llvm-3aedc27cea629d08.so" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-netbsd/release/deps/rustc_llvm-3aedc27cea629d08.crate.metadata.o" "-Wl,-O1" "-nodefaultlibs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-netbsd/release/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-netbsd/release/build/rustc_llvm-3be0c3655fb7da0f/out" "-L" "/checkout/obj/build/x86_64-unknown-netbsd/llvm/lib" "-L" "/x-tools/x86_64-unknown-netbsd/sysroot/usr/lib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-netbsd/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l" "rustllvm" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMX86Disassembler" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMX86AsmParser" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMX86CodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMX86Desc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMX86Info" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMX86AsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMX86Utils" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSystemZDisassembler" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSystemZCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSystemZAsmParser" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSystemZDesc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSystemZInfo" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSystemZAsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSparcDisassembler" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSparcCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSparcAsmParser" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSparcDesc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSparcInfo" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSparcAsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMPowerPCDisassembler" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMPowerPCCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMPowerPCAsmParser" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMPowerPCDesc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMPowerPCInfo" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMPowerPCAsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMNVPTXCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMNVPTXDesc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMNVPTXInfo" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMNVPTXAsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMSP430CodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMSP430Desc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMSP430Info" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMSP430AsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMipsDisassembler" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMipsCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMipsAsmParser" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMipsDesc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMipsInfo" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMipsAsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMCJIT" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMJSBackendCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMJSBackendDesc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMJSBackendInfo" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMipo" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMVectorize" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMLinker" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMIRReader" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMInterpreter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMExecutionEngine" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMRuntimeDyld" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMObject" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAsmParser" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMARMDisassembler" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMARMCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMARMAsmParser" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMARMDesc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMARMInfo" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMARMAsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAArch64Disassembler" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMCDisassembler" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAArch64CodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMGlobalISel" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSelectionDAG" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMDebugInfoCodeView" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMCodeGen" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMTarget" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMScalarOpts" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMInstCombine" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMInstrumentation" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMTransformUtils" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMBitWriter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMBitReader" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAnalysis" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMProfileData" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMCore" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAArch64AsmParser" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMCParser" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAArch64Desc" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAArch64Info" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAArch64AsmPrinter" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMMC" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMAArch64Utils" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "LLVMSupport" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "-l" "stdc++" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-netbsd/lib" "-l" "std-f4594d3e53dcb114" "/tmp/rustc.QRTc5unF9fuv/libcompiler_builtins-987729be881d4d32.rlib" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "util" "-shared" "-Wl,-rpath,$ORIGIN/../lib"
  = note: /x-tools/x86_64-unknown-netbsd/lib/gcc/x86_64--netbsd/4.8.4/../../../../x86_64--netbsd/bin/ld: /x-tools/x86_64-unknown-netbsd/sysroot/usr/lib/libstdc++.a(wstring-inst.o): relocation R_X86_64_32 against `pthread_cancel' can not be used when making a shared object; recompile with -fPIC
          /x-tools/x86_64-unknown-netbsd/sysroot/usr/lib/libstdc++.a(wstring-inst.o): could not read symbols: Bad value
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

Build failed, waiting for other jobs to finish...
error: Could not compile `rustc_llvm`.
error: build failed

My intuition is that this is somehow related to sccache however I really don't know (I currently have sccache disabled locally, due to other problems).

@alexcrichton
Copy link
Member

@TimNN this is likely related to --enable-llvm-static-stdcpp which isn't enabled by default (and I think needs DEPLOY=1 set outside the container)

@TimNN
Copy link
Contributor Author

TimNN commented Mar 19, 2017

@alexcrichton: Ah, thanks for the pointer, let me try that (locally).

@TimNN
Copy link
Contributor Author

TimNN commented Mar 19, 2017

I think I fixed the problem, at least my local build seems to have gotten past the previous failure:

Apparently, NetBSD has a separate libstdc++ for relocatable builds...

So let's see what travis says.

"estdc++"
} else if target.contains("netbsd") && llvm_static_stdcpp.is_some() {
// NetBSD uses a separate library when reloaction is required
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking: s/reloaction/relocation/

@TimNN
Copy link
Contributor Author

TimNN commented Mar 19, 2017

Yay, travis is green!

I removed the test commit.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 20, 2017

📌 Commit e93dea1 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Mar 21, 2017

🔒 Merge conflict

@TimNN
Copy link
Contributor Author

TimNN commented Mar 21, 2017

rebased

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 21, 2017

📌 Commit 43a51b7 has been approved by alexcrichton

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 23, 2017
Use the "official" cross compiler for NetBSD

The current NetBSD cross compiler is lacking, for example `std::thread` is not available (which causes problems for LLVM 4.0). This PR uses the official netbsd build system to compiler the cross compiler.

@alexcrichton: Can you please mirror `ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/source/sets/{src,gnusrc,sharesrc,syssrc}.tgz`. (Optionally you may want to use NetBSD versions 7.0.2 or 7.1, in that case you'll probably want to update the binary downloads used today as well).

I'll update the URL's afterwards (or feel free to use "allow edits from maintainers").

r? @alexcrichton
bors added a commit that referenced this pull request Mar 23, 2017
Rollup of 5 pull requests

- Successful merges: #40612, #40627, #40668, #40715, #40753
- Failed merges:
@bors bors merged commit 43a51b7 into rust-lang:master Mar 23, 2017
@TimNN TimNN deleted the new-netbsd-cross branch April 7, 2017 20:14
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

Successfully merging this pull request may close these issues.

4 participants