oxalica / nocargo

[alpha] Build Rust crates with Nix Build System.
MIT License
138 stars 9 forks source link

feat: support darwin #8

Open PhotonQuantum opened 2 years ago

PhotonQuantum commented 2 years ago

I tried to test this on my MBP with m1 chip. nix build . works.

I tried to build .#cache but failed.

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/y941nzsc6gnvxm5j9b1f82914lvjfzab-crate-cpufeatures-0.2.4.tar.gz
source root is cpufeatures-0.2.4
setting SOURCE_DATE_EPOCH to timestamp 1153704088 of file cpufeatures-0.2.4/tests/x86.rs
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Building lib: RUSTC 'src/lib.rs' '--out-dir=/nix/store/0gv5l8sd6zxq5j2gajaggzlvl6gwsfml-rust_cpufeatures-0.2.4/lib' '--crate-name=cpufeatures' '--crate-type=lib' '--emit=metadata,link' '-Cembed-bitcode=no' '-Cextra-filename=-d0377ca44dd1550e' '--color=always' '-Copt-level=3' '-Cdebuginfo=0' '-Cdebug-assertions=no' '-Coverflow-checks=no' '-Clto=no' '-Cpanic=unwind' '-Ccodegen-units=16' '--cap-lints=allow' '-Cmetadata=d0377ca44dd1550e' '--edition=2018' '-Ldependency=/nix/store/fawhjckz2y94w3brj9qxpsc43ivmbxqc-rust_cpufeatures-0.2.4-dev/rust-support/deps-closure'
error[E0433]: failed to resolve: use of undeclared crate or module `libc`
   --> src/aarch64.rs:133:14
    |
133 |     let rc = libc::sysctlbyname(
    |              ^^^^ use of undeclared crate or module `libc`

error[E0433]: failed to resolve: use of undeclared crate or module `libc`
   --> src/aarch64.rs:135:38
    |
135 |         &mut value as *mut _ as *mut libc::c_void,
    |                                      ^^^^ use of undeclared crate or module `libc`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0433`.

I don't think it's related to my modification but still needs some investigation.

oxalica commented 2 years ago

It failed on CI. Seems to be missing dependencies.

oxalica commented 2 years ago

:thinking: Just a remind. Is this still ongoing?

PhotonQuantum commented 2 years ago

I'm a bit busy these days so I might finish this later.