Compiling on linux fails, seemingly on nettle

Hi! I tried installing Pijul with cargo. I have Linux Mint 18.3, kernel linux 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 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

--- 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/
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.

Thanks for the tip. I also had to install clang. I’m happy that I can start playing with Pijul!

1 Like

I think nettle isn’t needed for v1.0.0 anymore.

1 Like

That is true. We’ll reintroduce PGP-signing in the future, but it will be done externally and will be more generic than just PGP.

@krixano Well, some other package complained about a missing stddef.h, and installing clang fixed it.

@pmeunier Thanks for your great work. With Pijul cherry picking is a first class operation. I’m planning to move a simple project of mine to nest to experiment with pijul.