Given a statically-compiled curl-sys
, and a pre-existing C lib (w/ bindgen), how can I point build.rs
or cargo
to headers like curl.h
in order to avoid:
compilation terminated.
make: *** [cram/cram_io.o] Error 1
hfile_s3.c:94:26: fatal error: openssl/hmac.h: No such file or directory
#include <openssl/hmac.h>
^
compilation terminated.
hfile_s3_write.c:86:23: fatal error: curl/curl.h: No such file or directory
#include <curl/curl.h>
^
compilation terminated.
make: *** [hfile_s3.o] Error 1
make: *** [hfile_s3_write.o] Error 1
hfile_libcurl.c:47:23: fatal error: curl/curl.h: No such file or directory
#include <curl/curl.h>
Since I know they are under targets, I would like to use them instead of the preinstalled system's ones:
# find . -iname curl.h
./target/rls/debug/build/curl-sys-cc4be84bbe4142b1/out/include/curl/curl.h
./target/debug/build/curl-sys-7b180d94c0b58a3e/out/include/curl/curl.h
./target/x86_64-unknown-linux-musl/debug/build/curl-sys-3ab30d23ec0cf282/out/include/curl/curl.h
How can I pass something like the following reliably across builds?:
-I/target/rls/debug/build/curl-sys-cc4be84bbe4142b1/out/include/curl/{curl.h}
I tried with target-dependent .cargo/config
's rustcflags unsuccessfully, since it only accepts link-time flags. For more context, I'm trying to build that with cargo build --target x86_64-unknown-linux-musl
, if somebody wants to reproduce what I'm mentioning above in one line and explore the backtrace in more detail, please run this oneliner:
git clone --recursive https://github.com/brainstorm/rust-htslib && cd rust-htslib && cargo install cross && cross build --target x86_64-unknown-linux-musl
The GNU toolchain (host and target pointing to x86_64-unknown-linux-gnu
, not MUSL), works fine:
$ git clone --recursive https://github.com/brainstorm/rust-htslib && cd rust-htslib && cargo install cross && cross build --target x86_64-unknown-linux-gnu
(...)
Compiling rust-htslib v0.30.1-alpha.0 (/project)
Finished dev [unoptimized + debuginfo] target(s) in 28.59s
... which, puzzles me quite a bit, since I'm using rustembedded's
Docker containers for reproducibility of the builds: both GNU and MUSL should have the same flags & compile outcomes? :_/