From 30a4389e09c406f4a26d1a56d267d2fbb1b7b844 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Fri, 16 Feb 2024 18:10:29 +0800 Subject: [PATCH] fix build --- default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 7a7afd1bb3..29a246e11f 100644 --- a/default.nix +++ b/default.nix @@ -43,13 +43,14 @@ buildGoApplication rec { subPackages = [ "cmd/cronosd" ]; buildFlags = lib.optionalString coverage "-cover"; CGO_ENABLED = "1"; - CGO_LDFLAGS = + CGO_LDFLAGS = lib.optionalString (rocksdb != null) ( if static then "-lrocksdb -pthread -lstdc++ -ldl -lzstd -lsnappy -llz4 -lbz2 -lz" else if stdenv.hostPlatform.isWindows then "-lrocksdb-shared" - else "-lrocksdb -pthread -lstdc++ -ldl"; + else "-lrocksdb -pthread -lstdc++ -ldl" + ); - postFixup = lib.optionalString stdenv.isDarwin '' - ${stdenv.cc.targetPrefix}install_name_tool -change "@rpath/librocksdb.8.dylib" "${rocksdb}/lib/librocksdb.dylib" $out/bin/cronosd + postFixup = lib.optionalString (stdenv.isDarwin && rocksdb != null) '' + ${stdenv.cc.bintools.targetPrefix}install_name_tool -change "@rpath/librocksdb.8.dylib" "${rocksdb}/lib/librocksdb.dylib" $out/bin/cronosd ''; doCheck = false;