mirror of
https://github.com/roc-lang/roc.git
synced 2024-08-17 06:41:22 +03:00
fixed undefined _dl_catch_error_ptr
This commit is contained in:
parent
2980e195ce
commit
e0fac60ddb
@ -529,15 +529,12 @@ pub fn rebuild_host(
|
||||
}
|
||||
}
|
||||
|
||||
fn nixos_path() -> String {
|
||||
env::var("NIXOS_GLIBC_PATH").unwrap_or_else(|_| {
|
||||
panic!(
|
||||
"We couldn't find glibc! We tried looking for NIXOS_GLIBC_PATH
|
||||
to find it via Nix, but that didn't work either. Please file a bug report.
|
||||
|
||||
This will only be an issue until we implement surgical linking.",
|
||||
)
|
||||
})
|
||||
fn nix_path_opt() -> Option<String> {
|
||||
if let Some(path) = env::var_os("NIX_GLIBC_PATH") {
|
||||
Some(path.into_string().unwrap())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn library_path<const N: usize>(segments: [&str; N]) -> Option<PathBuf> {
|
||||
@ -586,21 +583,39 @@ fn link_linux(
|
||||
));
|
||||
}
|
||||
|
||||
let libcrt_path = library_path(["/usr", "lib", &architecture])
|
||||
.or_else(|| library_path(["/usr", "lib"]))
|
||||
.or_else(|| library_path([&nixos_path()]))
|
||||
.unwrap();
|
||||
let libcrt_path =
|
||||
// give preference to nix_path if it's defined, this prevents bugs
|
||||
if let Some(nix_path) = nix_path_opt() {
|
||||
library_path([&nix_path])
|
||||
.unwrap()
|
||||
} else {
|
||||
library_path(["/usr", "lib", &architecture])
|
||||
.or_else(|| library_path(["/usr", "lib"]))
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
let libgcc_name = "libgcc_s.so.1";
|
||||
let libgcc_path = library_path(["/lib", &architecture, libgcc_name])
|
||||
.or_else(|| library_path(["/usr", "lib", &architecture, libgcc_name]))
|
||||
.or_else(|| library_path(["/usr", "lib", libgcc_name]))
|
||||
.or_else(|| library_path([&nixos_path(), libgcc_name]))
|
||||
.unwrap();
|
||||
let libgcc_path =
|
||||
// give preference to nix_path if it's defined, this prevents bugs
|
||||
if let Some(nix_path) = nix_path_opt() {
|
||||
library_path([&nix_path, libgcc_name])
|
||||
.unwrap()
|
||||
} else {
|
||||
library_path(["/lib", &architecture, libgcc_name])
|
||||
.or_else(|| library_path(["/usr", "lib", &architecture, libgcc_name]))
|
||||
.or_else(|| library_path(["/usr", "lib", libgcc_name]))
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
let ld_linux = match target.architecture {
|
||||
Architecture::X86_64 => library_path(["/lib64", "ld-linux-x86-64.so.2"])
|
||||
.or_else(|| library_path([&nixos_path(), "ld-linux-x86-64.so.2"])),
|
||||
Architecture::X86_64 => {
|
||||
// give preference to nix_path if it's defined, this prevents bugs
|
||||
if let Some(nix_path) = nix_path_opt() {
|
||||
library_path([&nix_path, "ld-linux-x86-64.so.2"])
|
||||
} else {
|
||||
library_path(["/lib64", "ld-linux-x86-64.so.2"])
|
||||
}
|
||||
},
|
||||
Architecture::Aarch64(_) => library_path(["/lib", "ld-linux-aarch64.so.1"]),
|
||||
_ => panic!(
|
||||
"TODO gracefully handle unsupported linux architecture: {:?}",
|
||||
|
@ -17,10 +17,10 @@
|
||||
"homepage": "",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1441fa74d213d7cc120d9d7d49e540c1fc59bc58",
|
||||
"sha256": "152qb7ch0r4bidik33zd0a9wl0929zr0dqs5l5ksm7vh3assc7sc",
|
||||
"rev": "51acb65b302551ac7993b437cc6863fe9fa8ae50",
|
||||
"sha256": "0si8s2ji4prp614q3050x4sp282wxgp0mm5q50slcf5f75jw5yhh",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/1441fa74d213d7cc120d9d7d49e540c1fc59bc58.tar.gz",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/51acb65b302551ac7993b437cc6863fe9fa8ae50.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
}
|
||||
}
|
||||
|
41
nix/zig.nix
41
nix/zig.nix
@ -1,41 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
let
|
||||
version = "0.8.0";
|
||||
|
||||
osName = if pkgs.stdenv.isDarwin then "macos" else "linux";
|
||||
|
||||
splitSystem = builtins.split "-" builtins.currentSystem;
|
||||
arch = builtins.elemAt splitSystem 0;
|
||||
isAarch64 = arch == "aarch64";
|
||||
|
||||
archiveName = "zig-${osName}-${arch}-${version}";
|
||||
|
||||
# If your system is not aarch64, we assume it's x86_64
|
||||
sha256 = if pkgs.stdenv.isDarwin then
|
||||
if isAarch64 then
|
||||
"b32d13f66d0e1ff740b3326d66a469ee6baddbd7211fa111c066d3bd57683111"
|
||||
else
|
||||
"279f9360b5cb23103f0395dc4d3d0d30626e699b1b4be55e98fd985b62bc6fbe"
|
||||
else if isAarch64 then
|
||||
"ee204ca2c2037952cf3f8b10c609373a08a291efa4af7b3c73be0f2b27720470"
|
||||
else
|
||||
"502625d3da3ae595c5f44a809a87714320b7a40e6dff4a895b5fa7df3391d01e";
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
pname = "zig";
|
||||
version = version;
|
||||
src = pkgs.fetchurl {
|
||||
inherit sha256;
|
||||
name = "${archiveName}.tar.xz";
|
||||
url = "https://ziglang.org/download/${version}/${archiveName}.tar.xz";
|
||||
};
|
||||
phases = [ "unpackPhase" ];
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/bin
|
||||
tar -xf $src
|
||||
cp ${archiveName}/zig $out/zig
|
||||
cp -r ${archiveName}/lib $out/lib
|
||||
ln -s "$out/zig" "$out/bin/zig"
|
||||
chmod +x $out/bin/zig
|
||||
'';
|
||||
}
|
@ -17,7 +17,6 @@ let
|
||||
|
||||
linuxInputs = with pkgs;
|
||||
lib.optionals stdenv.isLinux [
|
||||
glibc_multi
|
||||
valgrind
|
||||
vulkan-headers
|
||||
vulkan-loader
|
||||
@ -33,7 +32,6 @@ let
|
||||
|
||||
llvmPkgs = pkgs.llvmPackages_12;
|
||||
|
||||
zig = import ./nix/zig.nix { inherit pkgs; };
|
||||
debugir = import ./nix/debugir.nix { inherit pkgs; };
|
||||
|
||||
inputs = with pkgs; [
|
||||
@ -72,9 +70,9 @@ in pkgs.mkShell {
|
||||
|
||||
# Additional Env vars
|
||||
LLVM_SYS_120_PREFIX = "${llvmPkgs.llvm.dev}";
|
||||
NIXOS_GLIBC_PATH =
|
||||
if pkgs.stdenv.isLinux then "${pkgs.glibc_multi.out}/lib" else "";
|
||||
LD_LIBRARY_PATH = with pkgs;
|
||||
lib.makeLibraryPath
|
||||
([ pkg-config stdenv.cc.cc.lib libffi ncurses zlib ] ++ linuxInputs);
|
||||
NIX_GLIBC_PATH =
|
||||
if pkgs.stdenv.isLinux then "${pkgs.glibc_multi.out}/lib" else "";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user