diff --git a/crates/compiler/build/src/link.rs b/crates/compiler/build/src/link.rs index eee35d5c21..a3258ba307 100644 --- a/crates/compiler/build/src/link.rs +++ b/crates/compiler/build/src/link.rs @@ -230,7 +230,7 @@ pub fn build_zig_host_native( "build-exe", "-fPIE", shared_lib_path.to_str().unwrap(), - bitcode::BUILTINS_HOST_OBJ_PATH, + &bitcode::get_builtins_host_obj_path(), ]); } else { command.args(&["build-obj", "-fPIC"]); diff --git a/crates/compiler/test_gen/src/helpers/dev.rs b/crates/compiler/test_gen/src/helpers/dev.rs index 38ddd2fea8..4b977c3ecd 100644 --- a/crates/compiler/test_gen/src/helpers/dev.rs +++ b/crates/compiler/test_gen/src/helpers/dev.rs @@ -187,7 +187,7 @@ pub fn helper( // With the current method all methods are kept and it adds about 100k to all outputs. &[ app_o_file.to_str().unwrap(), - bitcode::BUILTINS_HOST_OBJ_PATH, + &bitcode::get_builtins_host_obj_path(), ], LinkType::Dylib, ) diff --git a/default.nix b/default.nix index 7470237f92..ec783d393c 100644 --- a/default.nix +++ b/default.nix @@ -9,6 +9,8 @@ let pkgs = import nixpkgs { }; rustPlatform = pkgs.rustPlatform; llvmPkgs = pkgs.llvmPackages_13; + # nix does not store libs in /usr/lib or /lib + nixGlibcPath = if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else ""; in rustPlatform.buildRustPackage { pname = "roc"; @@ -16,14 +18,12 @@ rustPlatform.buildRustPackage { src = pkgs.nix-gitignore.gitignoreSource [] ./.; - cargoSha256 = "sha256-ZT3lH2P0OnK8XwI89csINXIK+/AhhKVmXDqNGYMy/vk="; + cargoSha256 = "sha256-cFzOcU982kANsZjx4YoLQOZSOYN3loj+5zowhWoBWM8="; LLVM_SYS_130_PREFIX = "${llvmPkgs.llvm.dev}"; # required for zig XDG_CACHE_HOME = "xdg_cache"; # prevents zig AccessDenied error github.com/ziglang/zig/issues/6810 - # nix does not store libs in /usr/lib or /lib - NIX_GLIBC_PATH = if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else ""; # want to see backtrace in case of failure RUST_BACKTRACE = 1; @@ -77,12 +77,10 @@ rustPlatform.buildRustPackage { Security ]); - # mkdir -p $out/lib - # cp: to copy str.zig,list.zig... # wrapProgram pkgs.stdenv.cc: to make ld available for compiler/build/src/link.rs postInstall = '' cp -r target/x86_64-unknown-linux-gnu/release/lib/. $out/lib - wrapProgram $out/bin/roc --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.stdenv.cc ]} + wrapProgram $out/bin/roc --set NIX_GLIBC_PATH ${nixGlibcPath} --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.stdenv.cc ]} ''; }