//tvix/cli doesn't build on MacOS

#240
Opened by flokli at 2023-01-09T11·59+00

I gave it a try to nix-build default.nix -A tvix.cli on a MacOS machine, and ran into the following build error:

building '/nix/store/835mcxixvd8xgp5qgh7rdf2lncrglb46-rust_addr2line-0.17.0.drv'...
unpacking sources
unpacking source archive /nix/store/s3chmi9p3ibzm842d39cri92l2xkszqr-addr2line-0.17.0.tar.gz
source root is addr2line-0.17.0
patching sources
updateAutotoolsGnuConfigScriptsPhase
configuring
Running cd .
building
Building src/lib.rs (addr2line)
Running rustc --crate-name addr2line src/lib.rs --out-dir target/lib -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=1 --remap-path-prefix=/private/tmp/nix-build-rust_addr2line-0.17.0.drv-0=/ --extern gimli=/nix/store/0akb93xlxb9vcw6s2k5r68glhvz42lpj-rust_gimli-0.26.2-lib/lib/libgimli-aaf85f1a40.rlib --edition 2015 -C metadata=12385d915b -C extra-filename=-12385d915b --crate-type lib --color always
error[E0786]: found invalid metadata files for crate `gimli`
  --> src/lib.rs:36:1
   |
36 | pub extern crate gimli;
   | ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: no `.rmeta` section in '/nix/store/0akb93xlxb9vcw6s2k5r68glhvz42lpj-rust_gimli-0.26.2-lib/lib/libgimli-aaf85f1a40.rlib'

error: aborting due to previous error

For more information about this error, try `rustc --explain E0786`.
error: builder for '/nix/store/835mcxixvd8xgp5qgh7rdf2lncrglb46-rust_addr2line-0.17.0.drv' failed with exit code 1;
       last 10 log lines:
       >   --> src/lib.rs:36:1
       >    |
       > 36 | pub extern crate gimli;
       >    | ^^^^^^^^^^^^^^^^^^^^^^^
       >    |
       >    = note: no `.rmeta` section in '/nix/store/0akb93xlxb9vcw6s2k5r68glhvz42lpj-rust_gimli-0.26.2-lib/lib/libgimli-aaf85f1a40.rlib'
       >
       > error: aborting due to previous error
       >
       > For more information about this error, try `rustc --explain E0786`.
       For full logs, run 'nix log /nix/store/835mcxixvd8xgp5qgh7rdf2lncrglb46-rust_addr2line-0.17.0.drv'.
error: 1 dependencies of derivation '/nix/store/jk291gvnj3da1kjcvlyh81g8dipxr449-rust_tvix-cli-0.1.0-test.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3qpv2qwsw7j3n73y3vhdpq3h888ssv0q-rust_tvix-cli-0.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/srsmnpyiybr2nzp4sd9gbrjdvikxs3ha-rust_tvix-cli-0.1.0-linked.drv' failed to build

This is only one of the build failures, there is more "no .rmeta section" errors in other crates too.

  1. Looks to be an issue with nix. I am able to build it using cargo build.

    aaqaishtyaq at 2023-01-10T17·20+00

  2. You mean, an issue with crate2nix?

    flokli at 2023-01-12T10·45+00

  3. Yup.

    aaqaishtyaq at 2023-01-22T09·20+00

  4. There is a fix for this as well as other MacOS issues in https://cl.tvl.fyi/c/depot/+/9291 So it should work now.

    griff at 2023-09-12T21·46+00

  5. This seems to unfortunately have regressed again, as the vhost crate doesn't build on Darwin:

    Building src/lib.rs (vhost)
    Running rustc --crate-name vhost src/lib.rs --out-dir target/lib -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=1 --remap-path-prefix=/private/tmp/nix-build-rust_vhost-0.6.1.drv-0=/ --extern bitflags=/nix/store/rhk67m26izrvzkvwk6s79mds3f7s5827-rust_bitflags-1.3.2-lib/lib/libbitflags-ce87e8745b.rlib --extern libc=/nix/store/asw5bmgsy7ircdshx4avz317kyk0ilb7-rust_libc-0.2.148-lib/lib/liblibc-d08a1e8c49.rlib --extern vm_memory=/nix/store/zfs1dbrlnvvms0wal180jbi69kjp1qp9-rust_vm-memory-0.10.0-lib/lib/libvm_memory-08eef994ba.rlib --extern vmm_sys_util=/nix/store/hyilhxrw86k1pxkc3pijpwrwd3dip0g1-rust_vmm-sys-util-0.11.1-lib/lib/libvmm_sys_util-c1cc700587.rlib --cfg feature="default" --cfg feature="vhost-user" --cfg feature="vhost-user-slave" --edition 2018 -C metadata=98e64b6625 -C extra-filename=-98e64b6625 --crate-type lib --color always
    error[E0432]: unresolved import `vmm_sys_util::eventfd`
      --> src/backend.rs:16:19
       |
    16 | use vmm_sys_util::eventfd::EventFd;
       |                   ^^^^^^^ could not find `eventfd` in `vmm_sys_util`
    
    error[E0432]: unresolved import `vmm_sys_util::sock_ctrl_msg`
      --> src/vhost_user/connection.rs:18:19
       |
    18 | use vmm_sys_util::sock_ctrl_msg::ScmSocket;
       |                   ^^^^^^^^^^^^^ could not find `sock_ctrl_msg` in `vmm_sys_util`
    
    error[E0599]: no method named `send_with_fds` found for struct `UnixStream` in the current scope
       --> src/vhost_user/connection.rs:142:19
        |
    142 |         self.sock.send_with_fds(iovs, rfds).map_err(Into::into)
        |                   ^^^^^^^^^^^^^ method not found in `UnixStream`
    
    error[E0599]: no method named `recv_with_fds` found for struct `UnixStream` in the current scope
       --> src/vhost_user/connection.rs:317:45
        |
    317 |         let (bytes, _) = unsafe { self.sock.recv_with_fds(&mut iovs, &mut [])? };
        |                                             ^^^^^^^^^^^^^ method not found in `UnixStream`
    
    error[E0599]: no method named `recv_with_fds` found for struct `UnixStream` in the current scope
       --> src/vhost_user/connection.rs:349:38
        |
    349 |         let (bytes, fds) = self.sock.recv_with_fds(iovs, &mut fd_array)?;
        |                                      ^^^^^^^^^^^^^ method not found in `UnixStream`
    
    error: aborting due to 5 previous errors
    
    Some errors have detailed explanations: E0432, E0599.
    For more information about an error, try `rustc --explain E0432`.
    error: builder for '/nix/store/q2w4rgzzqq5dvmii7b19vym8dxghqnxf-rust_vhost-0.6.1.drv' failed with exit code 1;
           last 10 log lines:
           > error[E0599]: no method named `recv_with_fds` found for struct `UnixStream` in the current scope
           >    --> src/vhost_user/connection.rs:349:38
           >     |
           > 349 |         let (bytes, fds) = self.sock.recv_with_fds(iovs, &mut fd_array)?;
           >     |                                      ^^^^^^^^^^^^^ method not found in `UnixStream`
           >
           > error: aborting due to 5 previous errors
           >
           > Some errors have detailed explanations: E0432, E0599.
           > For more information about an error, try `rustc --explain E0432`.
           For full logs, run 'nix log /nix/store/q2w4rgzzqq5dvmii7b19vym8dxghqnxf-rust_vhost-0.6.1.drv'.
    error: 1 dependencies of derivation '/nix/store/7r0kb1g6kdr5334jzmyl8jzcp6b4br9b-rust_fuse-backend-rs-0.10.5.drv' failed to build
    error: 1 dependencies of derivation '/nix/store/rp28k160y7d8z97zzj2vbk5ishhls8dv-rust_vhost-user-backend-0.8.0.drv' failed to build
    error: 3 dependencies of derivation '/nix/store/p9kc4rj3q32bgnd5jairdqc7lq2kkdkq-rust_tvix-store-0.1.0.drv' failed to build
    error: 4 dependencies of derivation '/nix/store/96pj8pbhjws9r7d5ac2cxf2fw358rmh8-rust_tvix-cli-0.1.0-test.drv' failed to build
    error: 4 dependencies of derivation '/nix/store/l20x8qpby9jfgzsl0z0jgmm9qjby1ym6-rust_tvix-cli-0.1.0.drv' failed to build
    error: 2 dependencies of derivation '/nix/store/bffzyfdmxly71v5wlglhsa0qlxzxb0iq-run-tests-rust_tvix-cli-0.1.0.drv' failed to build
    error: 2 dependencies of derivation '/nix/store/1rknn4acvx6ckv98m3r4dfn3vrpkflkr-rust_tvix-cli-0.1.0-linked.drv' failed to build
    

    flokli at 2023-09-25T19·25+00

  6. One short-term fix would probably to just unconditionally patch out all fuse-related stuff on non-Linux, so we can at least get tvix-cli back up.

    flokli at 2023-09-25T19·26+00

  7. cl/9473 + cl/9474 disable these features for MacOS for now, and as we don't pull in the fuse/virtiofs parts from tvix-cli, this does build again 🎉

    flokli at 2023-09-26T08·10+00

  8. Merged, let's close this.

    flokli at 2023-09-26T10·19+00

  9. flokli closed this issue at 2023-09-26T10·19+00