Skip to content

Rust fails to build with custom llvm #29694

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
andrewrynhard opened this issue Nov 8, 2015 · 1 comment
Closed

Rust fails to build with custom llvm #29694

andrewrynhard opened this issue Nov 8, 2015 · 1 comment

Comments

@andrewrynhard
Copy link

I am getting the following error when compiling for darwin with nix:

error: linking with `cc` failed: exit code: 1
note: "cc" "-m64" "-L" "/private/var/folders/5d/pqjr3mqj0gqclvqx29wxzhfr0000gn/T/nix-build-rustc-1.4.0.drv-4/rustc-1.4.0-src.tar.gz/x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib" "x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/rustc_llvm-1bf6e69c.0.o" "-o" "x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/librustc_llvm-1bf6e69c.dylib" "x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/rustc_llvm-1bf6e69c.metadata.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/private/var/folders/5d/pqjr3mqj0gqclvqx29wxzhfr0000gn/T/nix-build-rustc-1.4.0.drv-4/rustc-1.4.0-src.tar.gz/x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib" "-l" "std-1bf6e69c" "-L" "x86_64-apple-darwin/rt" "-L" "/nix/store/lzpl4l44nrcn3k1d9yl48jwhcylb71c6-llvm-3.7.0/lib" "-L" "/private/var/folders/5d/pqjr3mqj0gqclvqx29wxzhfr0000gn/T/nix-build-rustc-1.4.0.drv-4/rustc-1.4.0-src.tar.gz/x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib" "-L" "/private/var/folders/5d/pqjr3mqj0gqclvqx29wxzhfr0000gn/T/nix-build-rustc-1.4.0.drv-4/rustc-1.4.0-src.tar.gz/.rust/lib/x86_64-apple-darwin" "-L" "/private/var/folders/5d/pqjr3mqj0gqclvqx29wxzhfr0000gn/T/nix-build-rustc-1.4.0.drv-4/rustc-1.4.0-src.tar.gz/lib/x86_64-apple-darwin" "-Wl,-force_load,x86_64-apple-darwin/rt/librustllvm.a" "-l" "LLVMInterpreter" "-l" "LLVMMCJIT" "-l" "LLVMExecutionEngine" "-l" "LLVMRuntimeDyld" "-l" "LLVMAsmParser" "-l" "LLVMLinker" "-l" "LLVMBitWriter" "-l" "LLVMipo" "-l" "LLVMVectorize" "-l" "LLVMPowerPCDisassembler" "-l" "LLVMPowerPCCodeGen" "-l" "LLVMPowerPCAsmParser" "-l" "LLVMPowerPCDesc" "-l" "LLVMPowerPCInfo" "-l" "LLVMPowerPCAsmPrinter" "-l" "LLVMMipsDisassembler" "-l" "LLVMMipsCodeGen" "-l" "LLVMMipsAsmParser" "-l" "LLVMMipsDesc" "-l" "LLVMMipsInfo" "-l" "LLVMMipsAsmPrinter" "-l" "LLVMAArch64Disassembler" "-l" "LLVMAArch64CodeGen" "-l" "LLVMAArch64AsmParser" "-l" "LLVMAArch64Desc" "-l" "LLVMAArch64Info" "-l" "LLVMAArch64AsmPrinter" "-l" "LLVMAArch64Utils" "-l" "LLVMARMDisassembler" "-l" "LLVMARMCodeGen" "-l" "LLVMARMAsmParser" "-l" "LLVMARMDesc" "-l" "LLVMARMInfo" "-l" "LLVMARMAsmPrinter" "-l" "LLVMX86Disassembler" "-l" "LLVMX86AsmParser" "-l" "LLVMX86CodeGen" "-l" "LLVMSelectionDAG" "-l" "LLVMAsmPrinter" "-l" "LLVMCodeGen" "-l" "LLVMTarget" "-l" "LLVMScalarOpts" "-l" "LLVMProfileData" "-l" "LLVMInstCombine" "-l" "LLVMInstrumentation" "-l" "LLVMTransformUtils" "-l" "LLVMipa" "-l" "LLVMAnalysis" "-l" "LLVMX86Desc" "-l" "LLVMObject" "-l" "LLVMMCParser" "-l" "LLVMBitReader" "-l" "LLVMMCDisassembler" "-l" "LLVMX86Info" "-l" "LLVMX86AsmPrinter" "-l" "LLVMMC" "-l" "LLVMX86Utils" "-l" "LLVMCore" "-l" "LLVMSupport" "-l" "ncurses" "-l" "pthread" "-l" "z" "-l" "m" "-l" "c++" "-l" "System" "-l" "c" "-l" "m" "-dynamiclib" "-Wl,-dylib" "-Wl,-install_name,@rpath/librustc_llvm-1bf6e69c.dylib" "-Wl,-rpath,@loader_path/" "-Wl,-rpath,/usr/local/lib/rustlib/x86_64-apple-darwin/lib" "-l" "compiler-rt"
note: ld: warning: directory not found for option '-L/private/var/folders/5d/pqjr3mqj0gqclvqx29wxzhfr0000gn/T/nix-build-rustc-1.4.0.drv-4/rustc-1.4.0-src.tar.gz/.rust/lib/x86_64-apple-darwin'
ld: warning: directory not found for option '-L/private/var/folders/5d/pqjr3mqj0gqclvqx29wxzhfr0000gn/T/nix-build-rustc-1.4.0.drv-4/rustc-1.4.0-src.tar.gz/lib/x86_64-apple-darwin'
Undefined symbols for architecture x86_64:
  "_ffi_type_double", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
  "_ffi_type_pointer", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
  "_ffi_type_sint16", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
  "_ffi_type_void", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
  "_ffi_type_sint64", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
  "_ffi_prep_cif", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
  "_ffi_type_sint32", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
  "_ffi_type_sint8", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
  "_ffi_type_float", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
  "_ffi_call", referenced from:
      llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) in libLLVMInterpreter.a(ExternalFunctions.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang-3.6: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
/private/var/folders/5d/pqjr3mqj0gqclvqx29wxzhfr0000gn/T/nix-build-rustc-1.4.0.drv-4/rustc-1.4.0-src.tar.gz/mk/target.mk:164: recipe for target 'x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/stamp.rustc_llvm' failed
make: *** [x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/stamp.rustc_llvm] Error 101
make: *** Waiting for unfinished jobs....
note: keeping build directory ‘/private/var/folders/5d/pqjr3mqj0gqclvqx29wxzhfr0000gn/T/nix-build-rustc-1.4.0.drv-4’
builder for ‘/nix/store/akqi1g0783qpf18gjn463a13xc8iz4wd-rustc-1.4.0.drv’ failed with exit code 2
cannot build derivation ‘/nix/store/bhz2vwccya3mc0zxjvjpapzclk6dj3x9-rust-env.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/bhz2vwccya3mc0zxjvjpapzclk6dj3x9-rust-env.drv’ failed

Here are the flags used to build rust:

configure flags: --prefix=/nix/store/0jjmq3629x5b7q5x88xaah83y59rc2q2-rustc-1.4.0 --release-channel=stable --enable-local-rust --local-rust-root=$snapshot --enable-rpath --default-linker=/nix/store/2bf6xr0v5mxlfx0lawgk6lcnw5dibk1a-clang-wrapper-3.6.2/bin/cc --default-ar=/nix/store/chh2vjk1i08fhfrmj2da38b0akcl1sgs-cctools-binutils-darwin/bin/ar --enable-clang --llvm-root=/nix/store/lzpl4l44nrcn3k1d9yl48jwhcylb71c6-llvm-3.7.0 --datadir=/nix/store/0jjmq3629x5b7q5x88xaah83y59rc2q2-rustc-1.4.0/share --infodir=/nix/store/0jjmq3629x5b7q5x88xaah83y59rc2q2-rustc-1.4.0/share/info

Is this an issue related to LD_LIBRARY_PATH and/or LIBRARY_PATH? My understanding is that nix uses a custom llvm. Has anyone built rust without the apple provided llvm?

@sanxiyn
Copy link
Member

sanxiyn commented Jan 2, 2017

Closing as a duplicate of #34486, because that issue has more information. Thanks!

@sanxiyn sanxiyn closed this as completed Jan 2, 2017
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