Pijul

Compiling on linux fails, seemingly on nettle

Hi! I tried installing Pijul with cargo. I have Linux Mint 18.3, kernel linux 4.15.0.51-generic x86_64. It failed with
/usr/include/nettle/nettle-types.h:36:10: fatal error: 'stddef.h' file not found

I have nettle and libnettle installed on this system, although I am not sure that is relevant, as it seems cargo was compiling its own version. This problem may be very specific to my setup, as I cannot find similar troubles with others, but I would be most grateful if anyone has a suggestion what I could do.

the full output of cargo is a lot, but the important bits are:

hoi@t430 ~ $ cargo install pijul --force
    Updating crates.io index
  Installing pijul v0.12.0
  Downloaded syn v0.15.36

// omitting many lines

   Compiling nettle-sys v1.0.3
   Compiling cookie_store v0.7.0
   Compiling reqwest v0.9.18
   Compiling thrussh-config v0.1.2
error: failed to run custom build command for `nettle-sys v1.0.3`
process didn't exit successfully: `/tmp/cargo-install82ULDJ/release/build/nettle-sys-273a68d22c52bdc0/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=NETTLE_STATIC
cargo:rerun-if-env-changed=NETTLE_PREGENERATED_BINDINGS
cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu
cargo:rustc-link-lib=nettle
cargo:rustc-link-lib=hogweed
cargo:rustc-link-lib=dylib=nettle
cargo:rustc-link-lib=dylib=hogweed
cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu
cargo:rustc-link-lib=dylib=gmp

--- stderr
/usr/include/nettle/nettle-types.h:36:10: fatal error: 'stddef.h' file not found
/usr/include/nettle/nettle-types.h:36:10: fatal error: 'stddef.h' file not found, err: true
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to compile `pijul v0.12.0`, intermediate artifacts can be found at `/tmp/cargo-install82ULDJ`

Caused by:
  build failed

Pretty sure I had this same problem, even with a nettle-dev package installed. I worked around it by installing pijul through Nix.

Running locate stddef.h shows several copies, some in the nix store, some not. If I look at the dependencies installed by Nix, I see gcc-7.4.0-lib. It turns out that I have libgcc-6-dev and libgcc-8-dev installed, but not libgcc-7-dev. Sounds like libnettle has a dependence on gcc-7, but hasn’t declared it.

thanks for your suggestion! I tried installing gcc-7, not easy on Linux Mint, that did seemingly not help. So then I went your route and installed it in Nix. A pity that I am not able to build Pijul with Cargo… and that I don’t really know why.
but on the plus side: I now have Pijul! :slight_smile:

Another way to solve this could have been to install clang. I don’t really know, since Nix solves all these problems so easily.

Ah, that’s probably it. I don’t have clang installed either, but the expression for pijul in nixpkgs lists it. I should have looked there to begin with.