I’m trying to compile a rust program (https://github.com/Wilfred/bfc) that uses llvm-sys
package. I came up with this derivation:
{pkgs ? (import <nixpkgs> {}).pkgsi686Linux}:
pkgs.mkShell (with pkgs; {
nativeBuildInputs = [cmake pkgconfig];
buildInputs = [
llvm_8
libxml2
libcxx
];
})
rustc and cargo are in global environment, version 1.43.
Running a cargo build with this derivation results in pages of linker error. This is the tail of error output:
(.text._ZN4llvm25PhysicalRegisterUsageInfo16doInitializationERNS_6ModuleE+0x82): undefined reference to `operator new(unsigned long)'
/nix/store/k657hq8xdx38k8y12fdsi8kljs76hbdz-binutils-2.31.1/bin/ld: /mnt/DATA/src/bfc/target/debug/deps/libllvm_sys-96db04a0640c5c87.rlib(RegisterUsageInfo.cpp.o):(.text._ZN4llvm15callDefaultCtorINS_25PhysicalRegisterUsageInfoEEEPNS_4PassEv[_ZN4llvm15callDefaultCtorINS_25PhysicalRegisterUsageInfoEEEPNS_4PassEv]+0x7): more undefined references to `operator new(unsigned long)' follow
/nix/store/k657hq8xdx38k8y12fdsi8kljs76hbdz-binutils-2.31.1/bin/ld: /mnt/DATA/src/bfc/target/debug/deps/bfc-2db857cbd7f0b5b7.10s17xnpywxk4sys.rcgu.o: file class ELFCLASS64 incompatible with ELFCLASS32
/nix/store/k657hq8xdx38k8y12fdsi8kljs76hbdz-binutils-2.31.1/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
How do I compile this llvm program on nixos?