liboqs-rust
liboqs-rust copied to clipboard
vendored oqs, build script error -- fatal error: 'limits.h' file not found
defined as
oqs = { version = "0.11.0", features = ["vendored"] }
system:
- NixOS Xantusia, x86_64
- no system liboqs present
running with a devenv:
{ pkgs, lib, config, inputs, ... }: {
packages = with pkgs; [ git openssl pkg-config cmake ];
env.LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
languages.rust = {
enable = true;
channel = "nightly";
};
}
tail of the error log
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_CXX_COMPILER
CMAKE_CXX_FLAGS
/home/stella/code/pqt/target/debug/build/oqs-sys-64ec9e4c783c31d8/out/include/oqs/common.h:11:10: fatal error: 'limits.h' file not found
thread 'main' panicked at /home/stella/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/oqs-sys-0.11.0+liboqs-0.13.0/build.rs:36:10:
Unable to generate bindings: ClangDiagnostic("/home/stella/code/pqt/target/debug/build/oqs-sys-64ec9e4c783c31d8/out/include/oqs/common.h:11:10: fatal error: 'limits.h' file not found\n")
stack backtrace:
0: __rustc::rust_begin_unwind
at /rustc/1aeb99d248e1b0069110cb03c6f1dcc7b36fd7f3/library/std/src/panicking.rs:697:5
1: core::panicking::panic_fmt
at /rustc/1aeb99d248e1b0069110cb03c6f1dcc7b36fd7f3/library/core/src/panicking.rs:75:14
2: core::result::unwrap_failed
at /rustc/1aeb99d248e1b0069110cb03c6f1dcc7b36fd7f3/library/core/src/result.rs:1704:5
3: core::result::Result<T,E>::expect
4: build_script_build::generate_bindings
5: build_script_build::main::{{closure}}
6: build_script_build::main
7: core::ops::function::FnOnce::call_once
contents of /home/stella/code/pqt/target/debug/build/oqs-sys-64ec9e4c783c31d8/out/include/oqs:
aes_ops.h
common.h
kem.h
kem_bike.h
kem_classic_mceliece.h
kem_frodokem.h
kem_hqc.h
kem_kyber.h
kem_ml_kem.h
kem_ntruprime.h
oqs.h
oqsconfig.h
rand.h
sha2_ops.h
sha3_ops.h
sha3x4_ops.h
sig.h
sig_cross.h
sig_dilithium.h
sig_falcon.h
sig_mayo.h
sig_ml_dsa.h
sig_sphincs.h
sig_stfl.h
sig_uov.h
additionally, would love to use liboqs handled by nix via the devenv, which afaik should work, but doesn't:
$ cargo run
Compiling oqs-sys v0.11.0+liboqs-0.13.0
error: failed to run custom build command for `oqs-sys v0.11.0+liboqs-0.13.0`
Caused by:
process didn't exit successfully: `/home/stella/code/viscera/target/debug/build/oqs-sys-abaa20c9ce1b8271/build-script-build` (exit status: 101)
--- stderr
thread 'main' panicked at /home/stella/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bindgen-0.71.1/lib.rs:604:27:
Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ pkg-config --libs liboqs
-L/nix/store/rc6kjq54wn127v2bnrnzg41iv311xk6s-liboqs-0.11.0/lib -loqs
$ echo $PKG_CONFIG_PATH
/nix/store/rzhjv87j7knvnrbbqycilpwliwlfl76g-liboqs-0.11.0-dev/lib/pkgconfig
$ cat /nix/store/rzhjv87j7knvnrbbqycilpwliwlfl76g-liboqs-0.11.0-dev/lib/pkgconfig/liboqs.pc
prefix=/nix/store/rc6kjq54wn127v2bnrnzg41iv311xk6s-liboqs-0.11.0
libdir=${prefix}/lib
includedir=/nix/store/rzhjv87j7knvnrbbqycilpwliwlfl76g-liboqs-0.11.0-dev/include
Name: liboqs
Description: Library for quantum-safe cryptographic algorithms
Version: 0.11.0
Requires.private: openssl
Cflags: -I${includedir}
Libs: -L${libdir} -loqs
I'm sorry, I don't have enough Rust expertise to help resolve this. Do you have suggestions on how you think this should be fixed?
@jmayclin Could this be related to the vendoring options that you were working with?
I guess it's possible, but at first glance it doesn't look like it 🤔
The first issue
common.h:11:10: fatal error: 'limits.h' file not found\n"
Looks like a pretty vanilla include/path/configuration issue.
The second issue
Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*']
Also looks to be some sort of vanilla include/path/configuration issue.
I tried a bit of searching, but the fact that this thread exists makes me suspect that this is more of a Nix configuration issue?
@0x57e11a Could you try reproducing with =0.10.0? That would be able to rule out any of my vendoring changes.
Or if you find a way to reproduce the error on a more vanilla system I'm happy to dig a bit further 😅
I tried a bit of searching, but the fact that this thread exists makes me suspect that this is more of a Nix configuration issue?
wondering how this would be related, given that cargo is managing dependencies here, instead of fetching via nix
disclaimer: not a C dev, so these may be naive assumptions
@0x57e11a Could you try reproducing with
=0.10.0? That would be able to rule out any of my vendoring changes.
doesn't appear to be those changes, pinning to =0.10.0 produced an identical error (aside from paths ofc)
Or if you find a way to reproduce the error on a more vanilla system I'm happy to dig a bit further 😅
the only device in this dorm room running anything other than NixOS is an android phone lol
might play around with distrobox and see if something can be set up there