core icon indicating copy to clipboard operation
core copied to clipboard

Build deltachat-rpc-server for macOS with Nix

Open link2xt opened this issue 1 year ago • 10 comments

Current status on 2025-10-20 can be seen from what is enabled in CI https://github.com/chatmail/core/blob/2f34a740c7538900dfa04d1c05bcc3775fcfdd6c/.github/workflows/nix.yml#L96-L102

Native build works, cross-compilation from aarch64 to x86-64 works and cross-compilation to aarch64 (nix build .#deltachat-rpc-server-aarch64-darwin) still fails because of upstream issue https://github.com/NixOS/nixpkgs/issues/413910

According to https://github.com/actions/runner-images/ current macos-latest runner is an arm64 runner, so we should be able to use macos-latest to do cross-build of x86-64 and native build of aarch64 binaries in Nix. I would prefer to do explicit cross-builds even from aarch64 to aarch64 like we do for Linux, but since they are not working native build is the best we can do at the moment.

link2xt avatar Oct 23 '24 03:10 link2xt

How did you create the current flake.nix? Because it seems like there is a lot of repetition in there

Septias avatar Oct 23 '24 12:10 Septias

        mkCrossRustPackage = arch: packageName:
          let
            rustTarget = arch2targets."${arch}".rustTarget;
            crossTarget = arch2targets."${arch}".crossTarget;
            pkgsCross = import nixpkgs {
              system = system;
              crossSystem.config = crossTarget;
            };
          in
          let
            toolchain = fenixPkgs.combine [
              fenixPkgs.stable.rustc
              fenixPkgs.stable.cargo
              fenixPkgs.targets.${rustTarget}.stable.rust-std
            ];
            naersk-lib = pkgs.callPackage naersk {
              cargo = toolchain;
              rustc = toolchain;
            };
          in
          naersk-lib.buildPackage {
            pname = packageName;
            cargoBuildOptions = x: x ++ [ "--package" packageName ];
            version = manifest.version;
            strictDeps = true;
            src = rustSrc;
            nativeBuildInputs = [
              pkgs.perl # Needed to build vendored OpenSSL.
            ];
            auditable = false; # Avoid cargo-auditable failures.
            doCheck = false; # Disable test as it requires network access.

            CARGO_BUILD_TARGET = rustTarget;
            #TARGET_CC = "${pkgsCross.stdenv.cc}/bin/${pkgsCross.stdenv.cc.targetPrefix}cc";
            CARGO_BUILD_RUSTFLAGS = [
              "-C"
              #"linker=${TARGET_CC}"
            ];

            #CC = "${pkgsCross.stdenv.cc}/bin/${pkgsCross.stdenv.cc.targetPrefix}cc";
            #LD = "${pkgsCross.stdenv.cc}/bin/${pkgsCross.stdenv.cc.targetPrefix}cc";
          };
          ```

I had to comment out some definitions here because otherwise, I would get infinite recursion.
This has to be looked in also when someone tries this.

Septias avatar Oct 23 '24 13:10 Septias

I had to comment out some definitions here because otherwise, I would get infinite recursion.

This is what the PR linked above is fixing.

link2xt avatar Oct 23 '24 13:10 link2xt

How did you create the current flake.nix? Because it seems like there is a lot of repetition in there

Wrote it over time. It's not autogenerated or something.

link2xt avatar Oct 23 '24 13:10 link2xt

The macos changes hit unstable. I tried to build in locally, but there are still some problems.

Septias avatar Nov 03 '24 12:11 Septias

On git commit e117efa74495867b07400924dc42dade9cb84381

% git diff
% git diff
diff --git a/flake.nix b/flake.nix
index bd532030..8858deac 100644
--- a/flake.nix
+++ b/flake.nix
@@ -358,6 +358,8 @@
         formatter = pkgs.nixpkgs-fmt;

         packages =
+          mkRustPackages "aarch64-darwin" //
+          mkRustPackages "x86_64-darwin" //
           mkRustPackages "aarch64-linux" //
           mkRustPackages "i686-linux" //
           mkRustPackages "x86_64-linux" //
% uname -m
arm64

nix build .#deltachat-rpc-server-aarch64-darwin now succeeds instead of complaining about infinite recursion, which is an improvement.

Running nix build .#deltachat-rpc-server-x86_64-darwin fails:

% nix build .#deltachat-rpc-server-x86_64-darwin
warning: Git tree '/Users/bb/src/deltachat-core-rust' is dirty
warning: download buffer is full; consider increasing the 'download-buffer-size' setting
error: builder for '/nix/store/wgf1mlnv5r08y5yld6l733r0mid6qn2h-deltachat-1.149.0.drv' failed with exit code 101;
       last 25 log lines:
       >    Compiling deltachat-rpc-server v1.149.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/deltachat-rpc-server)
       > error: could not compile `deltachat-rpc-server` (bin "deltachat-rpc-server") due to 2 previous errors
       > error: linking with `/nix/store/hv72hg695hkhypnym5adl8yk4ll4cqj5-x86_64-darwin-clang-wrapper-16.0.6/bin/x86_64-darwin-cc` failed: exit status: 1
       >   |
       >   = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET -u XROS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/nix/store/p5vpy0py6n6ph8w39vx985vyy5w6czfb-rust-mixed/lib/rustlib/aarch64-apple-darwin/bin:/nix/store/p5vpy0py6n6ph8w39vx985vyy5w6czfb-rust-mixed/lib/rustlib/aarch64-apple-darwin/bin:/nix/store/p5vpy0py6n6ph8w39vx985vyy5w6czfb-rust-mixed/lib/rustlib/aarch64-apple-darwin/bin:/nix/store/p5vpy0py6n6ph8w39vx985vyy5w6czfb-rust-mixed/bin:/nix/store/mx6zrpgk9ncxmdkriivad29g6ms54lp4-jq-1.7.1-bin/bin:/nix/store/d792yd4f7pp13r5ifgc3rrzr7hh0a9g4-rsync-3.3.0/bin:/nix/store/7isk914abas0yr2cxgpsmyz2ihn8mf2n-perl-5.40.0/bin:/nix/store/gvgay2fp27k7rr03lf3m572gcd9f7gdy-pkg-config-wrapper-0.29.2/bin:/nix/store/700a0ayy1s1h7zg9dqiqy0xvmhfr26l6-clang-wrapper-16.0.6/bin:/nix/store/r0w268903vjlq1vrnajb3lvll4hs5z8g-clang-16.0.6/bin:/nix/store/4axvrmlyszz77x66am0damj6pz4jh683-coreutils-9.5/bin:/nix/store/vnkvxq7wqxg180awsv2rmira5pvc875p-cctools-binutils-darwin-wrapper-1010.6/bin:/nix/store/wli7d4k9sh4c6fwarw3afc5g5axwbjm8-cctools-binutils-darwin-1010.6/bin:/nix/store/p2m1yki058ajw7rfcs1gmvhz3mlpjv9b-xcbuild-0.1.1-unstable-2019-11-20-xcrun/bin:/nix/store/4axvrmlyszz77x66am0damj6pz4jh683-coreutils-9.5/bin:/nix/store/pk36s5bggzr8nwb9pisp4yy3r5nk8099-findutils-4.10.0/bin:/nix/store/jaax21mi17ijk3dxx5mn7ralw9sgv4xv-diffutils-3.10/bin:/nix/store/r0sjy6i8dmm0snm63hc5i4a7nijw1pw5-gnused-4.9/bin:/nix/store/fay4393fknlsn89l6ifzk4m3pfwbxk0a-gnugrep-3.11/bin:/nix/store/pd5r50d0yjbk5542kii9mj1rvs4fp3rv-gawk-5.3.1/bin:/nix/store/kmil8v4r168frg56f9aync1j4j8lvcr3-gnutar-1.35/bin:/nix/store/203vr06z8isiffinykb2v1asij8pka54-gzip-1.13/bin:/nix/store/bsbh4173ym99hv0nad74ygz869pvnkby-bzip2-1.0.8-bin/bin:/nix/store/jr9m0plz39q5nml33h1n2nyv6qrn8vrw-gnumake-4.4.1/bin:/nix/store/rj7zvmif800bgg3sbznq6g5g438jx104-bash-5.2p37/bin:/nix/store/rcn2sqb32a6qzbw0faq7221g7qavkmzl-patch-2.7.6/bin:/nix/store/5x504frx7wbq19app1xrz52f9mvqbhb9-xz-5.6.3-bin/bin:/nix/store/p6hbsaynscr2afvg6v1n2nw3w7g75vgd-file-5.45/bin" VSLANG="1033" ZERO_AR_DATE="1" "/nix/store/hv72hg695hkhypnym5adl8yk4ll4cqj5-x86_64-darwin-clang-wrapper-16.0.6/bin/x86_64-darwin-cc" "-arch" "x86_64" "-m64" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/symbols.o" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/deps/deltachat_rpc_server-85363998c8c68daa.deltachat_rpc_server.c9a140768b9fc1a7-cgu.0.rcgu.o" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libblake3-15957817c913a6bb.rlib" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libring-aa0b701bda42d6c5.rlib" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libiroh_blake3-5a9f11ccd94d5d87.rlib" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/liblibsqlite3_sys-67bfd41a5279daf4.rlib" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libopenssl_sys-40171c1fe6393b5d.rlib" "/nix/store/2b2p3y1gydh391i8awsiyi2damxbvip5-rust-std-stable-2024-10-17/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-304a1afb7a72a7c7.rlib" "-framework" "SystemConfiguration" "-framework" "Security" "-framework" "CoreFoundation" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/libsqlite3-sys-aa3f5d980f34f4e8/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/openssl-sys-9296b4bd796f63f3/out/openssl-build/install/lib" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/iroh-blake3-2a37025eed10bc29/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/iroh-blake3-2a37025eed10bc29/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/ring-5c1edee0e8878691/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/blake3-f6ed210bb455bd1c/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/blake3-f6ed210bb455bd1c/out" "-o" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/deps/deltachat_rpc_server-85363998c8c68daa" "-Wl,-dead_strip" "-nodefaultlibs"
       >   = note: ld: warning: directory not found for option '-L/nix/store/c6xnsl6bgadwdfc9lzrk91d0vm7aj9gj-clang-16.0.6-lib/x86_64-darwin/lib'
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libring-aa0b701bda42d6c5.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/deps/deltachat_rpc_server-85363998c8c68daa.deltachat_rpc_server.c9a140768b9fc1a7-cgu.0.rcgu.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/symbols.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64ld: warning: ld: warning: ignoring file /nix/store/2b2p3y1gydh391i8awsiyi2damxbvip5-rust-std-stable-2024-10-17/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-304a1afb7a72a7c7.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/liblibsqlite3_sys-67bfd41a5279daf4.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >
       >           ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libiroh_blake3-5a9f11ccd94d5d87.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libblake3-15957817c913a6bb.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libopenssl_sys-40171c1fe6393b5d.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: dylib (/nix/store/dvmq3xa54hfik85259wyf281m076s14h-libiconv-107/lib/libiconv.dylib) was built for newer macOS version (11.0) than being linked (10.12)
       >           ld: warning: dylib (/nix/store/dvmq3xa54hfik85259wyf281m076s14h-libiconv-107/lib/libcharset.1.dylib) was built for newer macOS version (11.0) than being linked (10.12)
       >           ld: entry point (_main) undefined. for architecture arm64
       >           clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
       >
       >
       >
       > error: aborting due to 1 previous error
       >
       >
       > [naersk] cargo returned with exit code 101, exiting
       For full logs, run 'nix log /nix/store/wgf1mlnv5r08y5yld6l733r0mid6qn2h-deltachat-1.149.0.drv'.

Full log:

% nix log /nix/store/wgf1mlnv5r08y5yld6l733r0mid6qn2h-deltachat-1.149.0.drv
warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/wgf1mlnv5r08y5yld6l733r0mid6qn2h-deltachat-1.149.0.drv^*'
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/hpy7s2wzzlqypbax8xi3js82js9lymm5-source
source root is source
Running phase: patchPhase
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/hpy7s2wzzlqypbax8xi3js82js9lymm5-source
source root is source
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
[naersk] cargo_version (read): 1.82.0 (8f40fc59f 2024-08-21)
[naersk] cargo_message_format (set): json-diagnostic-rendered-ansi
[naersk] cargo_release: --release
[naersk] cargo_options:
[naersk] cargo_build_options: $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format --package deltachat-rpc-server
[naersk] cargo_test_options: $cargo_release -j "$NIX_BUILD_CORES"
[naersk] RUST_TEST_THREADS: 8
[naersk] cargo_bins_jq_filter: select(.reason == "compiler-artifact" and .executable != null and .profile.test == false)
[naersk] cargo_build_output_json (created): /private/tmp/nix-build-deltachat-1.149.0.drv-0/tmp.sz79V95GON
[naersk] RUSTFLAGS:
[naersk] CARGO_BUILD_RUSTFLAGS: -C linker=/nix/store/hv72hg695hkhypnym5adl8yk4ll4cqj5-x86_64-darwin-clang-wrapper-16.0.6/bin/x86_64-darwin-cc
[naersk] CARGO_BUILD_RUSTFLAGS (updated): -C linker=/nix/store/hv72hg695hkhypnym5adl8yk4ll4cqj5-x86_64-darwin-clang-wrapper-16.0.6/bin/x86_64-darwin-cc --remap-path-prefix /nix/store/lnc2idmynv20h1zbgxrzjinyhy>
[naersk] pre-installing dep /nix/store/dnly9j2nygcl9zmjlna2r57ndvww5iyx-deltachat-deps-1.149.0
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
cargo build $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format --package deltachat-rpc-server
   Compiling deltachat-contact-tools v0.0.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/deltachat-contact-tools)
   Compiling deltachat_derive v2.0.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/deltachat_derive)
   Compiling format-flowed v1.0.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/format-flowed)
   Compiling ratelimit v1.0.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/deltachat-ratelimit)
   Compiling deltachat-time v1.0.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/deltachat-time)
   Compiling deltachat v1.149.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source)
   Compiling deltachat-jsonrpc v1.149.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/deltachat-jsonrpc)
   Compiling deltachat-rpc-server v1.149.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/deltachat-rpc-server)
error: could not compile `deltachat-rpc-server` (bin "deltachat-rpc-server") due to 2 previous errors
error: linking with `/nix/store/hv72hg695hkhypnym5adl8yk4ll4cqj5-x86_64-darwin-clang-wrapper-16.0.6/bin/x86_64-darwin-cc` failed: exit status: 1
  |
  = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET -u XROS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/nix/store/p5vpy0py6n6ph8w39vx985vyy5w6czfb-rust-mixed/lib/rustlib/aarch64-apple-darwin/bin:/nix>
  = note: ld: warning: directory not found for option '-L/nix/store/c6xnsl6bgadwdfc9lzrk91d0vm7aj9gj-clang-16.0.6-lib/x86_64-darwin/lib'
          ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libring-aa0b701bda42d6c5.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
          ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/deps/deltachat_rpc_server-85363998c8c68daa.deltachat_rpc_server.c9a140768b9fc1a7-cg>
          ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/symbols.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64ld: warning: ld: war>
          ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/liblibsqlite3_sys-67bfd41a5279daf4.rlib, building for macOS-arm64 but attempting to link with file built for macO>

          ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libiroh_blake3-5a9f11ccd94d5d87.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
          ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libblake3-15957817c913a6bb.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
          ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustcrtWAyC/libopenssl_sys-40171c1fe6393b5d.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x>
          ld: warning: dylib (/nix/store/dvmq3xa54hfik85259wyf281m076s14h-libiconv-107/lib/libiconv.dylib) was built for newer macOS version (11.0) than being linked (10.12)
          ld: warning: dylib (/nix/store/dvmq3xa54hfik85259wyf281m076s14h-libiconv-107/lib/libcharset.1.dylib) was built for newer macOS version (11.0) than being linked (10.12)
          ld: entry point (_main) undefined. for architecture arm64
          clang-16: error: linker command failed with exit code 1 (use -v to see invocation)



error: aborting due to 1 previous error


[naersk] cargo returned with exit code 101, exiting

The command being run is /nix/store/hv72hg695hkhypnym5adl8yk4ll4cqj5-x86_64-darwin-clang-wrapper-16.0.6/bin/x86_64-darwin-cc -arch x86_64 -m64 ... but it fails saying "building for macOS-arm64 but attempting to link with file built for macOS-x86_64".

link2xt avatar Nov 16 '24 09:11 link2xt

Tried to compile on GitHub Actions:

...
building '/nix/store/97g442r55nxy8hy3c48j47a1gn81n16f-stdenv-darwin.drv'...
building '/nix/store/9cig52gmhg0h6yxlxp9ckshwm6h240l4-compiler-rt-libc-x86_64-darwin-16.0.6.drv'...
building '/nix/store/chd1lijgrrpg6zp78mj2ccc0gc2ic0s8-x86_64-darwin-clang-wrapper-16.0.6.drv'...
building '/nix/store/ihd2xpqlyxmbk8ck3my1xiyxd34b5jps-deltachat-deps-1.149.0.drv'...
building '/nix/store/j8xqxzlw1wswxiwbqqvmjghryimnz0dd-deltachat-1.149.0.drv'...
error: builder for '/nix/store/j8xqxzlw1wswxiwbqqvmjghryimnz0dd-deltachat-1.149.0.drv' failed with exit code 101;
       last 25 log lines:
       >    Compiling deltachat-rpc-server v1.149.0 (/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/deltachat-rpc-server)
       > error: could not compile `deltachat-rpc-server` (bin "deltachat-rpc-server") due to 2 previous errors
       > error: linking with `/nix/store/hv72hg695hkhypnym5adl8yk4ll4cqj5-x86_64-darwin-clang-wrapper-16.0.6/bin/x86_64-darwin-cc` failed: exit status: 1
       >   |
       >   = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET -u XROS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/nix/store/p5vpy0py6n6ph8w39vx985vyy5w6czfb-rust-mixed/lib/rustlib/aarch64-apple-darwin/bin:/nix/store/p5vpy0py6n6ph8w39vx985vyy5w6czfb-rust-mixed/lib/rustlib/aarch64-apple-darwin/bin:/nix/store/p5vpy0py6n6ph8w39vx985vyy5w6czfb-rust-mixed/lib/rustlib/aarch64-apple-darwin/bin:/nix/store/p5vpy0py6n6ph8w39vx985vyy5w6czfb-rust-mixed/bin:/nix/store/mx6zrpgk9ncxmdkriivad29g6ms54lp4-jq-1.7.1-bin/bin:/nix/store/d792yd4f7pp13r5ifgc3rrzr7hh0a9g4-rsync-3.3.0/bin:/nix/store/7isk914abas0yr2cxgpsmyz2ihn8mf2n-perl-5.40.0/bin:/nix/store/gvgay2fp27k7rr03lf3m572gcd9f7gdy-pkg-config-wrapper-0.29.2/bin:/nix/store/700a0ayy1s1h7zg9dqiqy0xvmhfr26l6-clang-wrapper-16.0.6/bin:/nix/store/r0w268903vjlq1vrnajb3lvll4hs5z8g-clang-16.0.6/bin:/nix/store/4axvrmlyszz77x66am0damj6pz4jh683-coreutils-9.5/bin:/nix/store/vnkvxq7wqxg180awsv2rmira5pvc875p-cctools-binutils-darwin-wrapper-1010.6/bin:/nix/store/wli7d4k9sh4c6fwarw3afc5g5axwbjm8-cctools-binutils-darwin-1010.6/bin:/nix/store/p2m1yki058ajw7rfcs1gmvhz3mlpjv9b-xcbuild-0.1.1-unstable-2019-11-20-xcrun/bin:/nix/store/4axvrmlyszz77x66am0damj6pz4jh683-coreutils-9.5/bin:/nix/store/pk36s5bggzr8nwb9pisp4yy3r5nk8099-findutils-4.10.0/bin:/nix/store/jaax21mi17ijk3dxx5mn7ralw9sgv4xv-diffutils-3.10/bin:/nix/store/r0sjy6i8dmm0snm63hc5i4a7nijw1pw5-gnused-4.9/bin:/nix/store/fay4393fknlsn89l6ifzk4m3pfwbxk0a-gnugrep-3.11/bin:/nix/store/pd5r50d0yjbk5542kii9mj1rvs4fp3rv-gawk-5.3.1/bin:/nix/store/kmil8v4r168frg56f9aync1j4j8lvcr3-gnutar-1.35/bin:/nix/store/203vr06z8isiffinykb2v1asij8pka54-gzip-1.13/bin:/nix/store/bsbh4173ym99hv0nad74ygz869pvnkby-bzip2-1.0.8-bin/bin:/nix/store/jr9m0plz39q5nml33h1n2nyv6qrn8vrw-gnumake-4.4.1/bin:/nix/store/rj7zvmif800bgg3sbznq6g5g438jx104-bash-5.2p37/bin:/nix/store/rcn2sqb32a6qzbw0faq7221g7qavkmzl-patch-2.7.6/bin:/nix/store/5x504frx7wbq19app1xrz52f9mvqbhb9-xz-5.6.3-bin/bin:/nix/store/p6hbsaynscr2afvg6v1n2nw3w7g75vgd-file-5.45/bin" VSLANG="1033" ZERO_AR_DATE="1" "/nix/store/hv72hg695hkhypnym5adl8yk4ll4cqj5-x86_64-darwin-clang-wrapper-16.0.6/bin/x86_64-darwin-cc" "-arch" "x86_64" "-m64" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/symbols.o" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/deps/deltachat_rpc_server-85363998c8c68daa.deltachat_rpc_server.c9a140768b9fc1a7-cgu.0.rcgu.o" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/libblake3-15957817c913a6bb.rlib" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/libring-aa0b701bda42d6c5.rlib" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/libiroh_blake3-5a9f11ccd94d5d87.rlib" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/liblibsqlite3_sys-67bfd41a5279daf4.rlib" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/libopenssl_sys-40171c1fe6393b5d.rlib" "/nix/store/2b2p3y1gydh391i8awsiyi2damxbvip5-rust-std-stable-2024-10-17/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-304a1afb7a72a7c7.rlib" "-framework" "SystemConfiguration" "-framework" "Security" "-framework" "CoreFoundation" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/libsqlite3-sys-aa3f5d980f34f4e8/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/openssl-sys-9296b4bd796f63f3/out/openssl-build/install/lib" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/iroh-blake3-2a37025eed10bc29/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/iroh-blake3-2a37025eed10bc29/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/ring-5c1edee0e8878691/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/blake3-f6ed210bb455bd1c/out" "-L" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/build/blake3-f6ed210bb455bd1c/out" "-o" "/private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/deps/deltachat_rpc_server-85363998c8c68daa" "-Wl,-dead_strip" "-nodefaultlibs"
       >   = note: ld: warning: directory not found for option '-L/nix/store/c6xnsl6bgadwdfc9lzrk91d0vm7aj9gj-clang-16.0.6-lib/x86_64-darwin/lib'
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/symbols.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/libblake3-15957817c913a6bb.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/source/target/x86_64-apple-darwin/release/deps/deltachat_rpc_server-85363998c8c68daa.deltachat_rpc_server.c9a140768b9fc1a7-cgu.0.rcgu.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/libring-aa0b701bda42d6c5.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/libiroh_blake3-5a9f11ccd94d5d87.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/liblibsqlite3_sys-67bfd41a5279daf4.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: ignoring file /private/tmp/nix-build-deltachat-1.149.0.drv-0/rustclaTGns/libopenssl_sys-40171c1fe6393b5d.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: ignoring file /nix/store/2b2p3y1gydh391i8awsiyi2damxbvip5-rust-std-stable-2024-10-17/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-304a1afb7a72a7c7.rlib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
       >           ld: warning: dylib (/nix/store/dvmq3xa54hfik85259wyf281m076s14h-libiconv-107/lib/libiconv.dylib) was built for newer macOS version (11.0) than being linked (10.12)
       >           ld: warning: dylib (/nix/store/dvmq3xa54hfik85259wyf281m076s14h-libiconv-107/lib/libcharset.1.dylib) was built for newer macOS version (11.0) than being linked (10.12)
       >           ld: entry point (_main) undefined. for architecture arm64
       >           clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
       >           
       >
       >
       > error: aborting due to 1 previous error
       >
       >
       > [naersk] cargo returned with exit code 101, exiting
       For full logs, run 'nix log /nix/store/j8xqxzlw1wswxiwbqqvmjghryimnz0dd-deltachat-1.149.0.drv'.

Runner image is macos-14-arm64

link2xt avatar Nov 16 '24 19:11 link2xt

Draft PR is at https://github.com/deltachat/deltachat-core-rust/pull/5326

link2xt avatar Dec 03 '24 00:12 link2xt

@link2xt the corresponding PR are closed - what is the state of this issue?

r10s avatar Oct 13 '25 21:10 r10s

I opened two stacked PRs:

  1. https://github.com/chatmail/core/pull/7311 (cleanup)
  2. https://github.com/chatmail/core/pull/7307 (fix cross-compilation to x86-64 macOS)

nix build .#deltachat-rpc-server-aarch64-darwin still fails because of upstream issue https://github.com/NixOS/nixpkgs/issues/413910

link2xt avatar Oct 13 '25 22:10 link2xt