Skip to content

Commit 2a65815

Browse files
authored
Fix demo seed Killed: 9 error on macos (#2138)
We've been encountering a persistent issue when running the `hydra-node` demo on macOS with Apple Silicon (aarch64-darwin). The seed-devnet process was consistently failing with a `Killed: 9` error. The root cause of this issue was related to how the hydra-node executable was being linked on macOS. The dynamic linker (dyld) was unable to find the required shared libraries at runtime, which caused the operating system to terminate the process. Initially, I suspected aa code signing issue (which apparently is a common cause for these types of errors on aarch64-darwin, as googling suggested). But in the end, the problem was with the library search paths embedded in the executable. ### Solution The fix involved modifying the Nix build process to set the runtime search paths for its library dependencies correctly. This is done by using the `install_name_tool` command in the `postFixup` phase of the Nix derivation. Now it all seems to work (tested on my Mac machine).
2 parents 9b1b211 + 23ee964 commit 2a65815

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

nix/hydra/packages.nix

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
# stdenv as the original drv (important to determine targetPlatform).
3131
drv.stdenv.mkDerivation {
3232
name = "${exe}";
33-
phases = [ "buildPhase" ];
33+
buildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.cctools ];
34+
phases = [ "buildPhase" ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ "postFixup" ];
3435
buildPhase = ''
3536
set -e
3637
@@ -46,6 +47,13 @@
4647
sed 's/${placeholder}/${rev}/' ${drv}/bin/${exe} > $out/bin/${exe}
4748
chmod +x $out/bin/${exe}
4849
'';
50+
postFixup = pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
51+
install_name_tool -add_rpath ${pkgs.zlib}/lib $out/bin/${exe}
52+
install_name_tool -add_rpath ${pkgs.lmdb}/lib $out/bin/${exe}
53+
install_name_tool -add_rpath ${pkgs.libcxx}/lib $out/bin/${exe}
54+
install_name_tool -add_rpath ${pkgs.libiconv}/lib $out/bin/${exe}
55+
install_name_tool -add_rpath ${pkgs.libffi}/lib $out/bin/${exe}
56+
'';
4957
};
5058

5159
nativePkgs = hsPkgs;

0 commit comments

Comments
 (0)