Running cargo test on Ubuntu gives openssl header compilation errors.
inigoiparragirre opened this issue · 2 comments
Hi,
I'm having problems compiling with cargo test. From errors I tried to check libssl-dev installation. I reinstalled with apt-get install libssl-dev. But no luck.
cargo build is working fine.
❯ cargo test
Downloaded sha2 v0.9.2
Downloaded serde_qs v0.7.2
Downloaded serde v1.0.119
Downloaded spinning_top v0.2.2
Downloaded tracing v0.1.22
Downloaded wasm-bindgen-backend v0.2.69
Downloaded thiserror v1.0.23
Downloaded wasm-bindgen v0.2.69
Downloaded wasm-bindgen-shared v0.2.69
Downloaded wasm-bindgen-macro-support v0.2.69
Downloaded assert-json-diff v2.0.1
Downloaded actix-rt v2.2.0
Downloaded wasm-bindgen-macro v0.2.69
Downloaded aho-corasick v0.7.15
Downloaded async-io v1.3.1
Downloaded const_fn v0.4.5
Downloaded async-lock v2.3.0
Downloaded cc v1.0.66
Downloaded curl v0.4.34
Downloaded data-encoding v2.3.1
Downloaded flume v0.9.2
Downloaded futures-core v0.3.12
Downloaded futures v0.3.12
Downloaded futures-channel v0.3.12
Downloaded futures-task v0.3.12
Downloaded futures-macro v0.3.12
Downloaded futures-sink v0.3.12
Downloaded http-body v0.4.0
Downloaded futures-executor v0.3.12
Downloaded futures-util v0.3.12
Downloaded h2 v0.3.0
Downloaded http-client v6.5.3
Downloaded hyper v0.14.2
Downloaded ipnet v2.3.0
Downloaded js-sys v0.3.46
Downloaded isahc v0.9.14
Downloaded tracing-futures v0.2.4
Downloaded futures-io v0.3.12
Downloaded indexmap v1.6.1
Downloaded form_urlencoded v1.0.0
Downloaded async-attributes v1.1.1
Downloaded fastrand v1.4.0
Downloaded getrandom v0.2.1
Downloaded lock_api v0.4.2
Downloaded log v0.4.13
Downloaded memchr v2.3.4
Downloaded mime_guess v2.0.3
Downloaded mio v0.7.7
Downloaded nb-connect v1.0.2
Downloaded native-tls v0.2.7
Downloaded once_cell v1.5.2
Downloaded openssl v0.10.32
Downloaded parking_lot_core v0.8.2
Downloaded pin-project v1.0.4
Downloaded pin-project v0.4.27
Downloaded pin-project-internal v1.0.4
Downloaded quote v1.0.8
Downloaded regex v1.4.3
Downloaded sluice v0.5.4
Downloaded surf v2.3.2
Downloaded thread_local v1.1.0
Downloaded thiserror-impl v1.0.23
Downloaded syn v1.0.58
Downloaded tokio-macros v1.1.0
Downloaded tinyvec v1.1.0
Downloaded unicode-normalization v0.1.16
Downloaded tracing-core v0.1.17
Downloaded time-macros-impl v0.1.1
Downloaded time v0.2.24
Downloaded bumpalo v3.4.0
Downloaded url v2.2.0
Downloaded actix-macros v0.2.0
Downloaded async-std v1.9.0
Downloaded cookie v0.14.3
Downloaded async-trait v0.1.42
Downloaded isahc v1.3.1
Downloaded openssl-sys v0.9.60
Downloaded pin-project-internal v0.4.27
Downloaded serde_derive v1.0.119
Downloaded serde_json v1.0.61
Downloaded unicode-xid v0.2.1
Downloaded tokio-stream v0.1.2
Downloaded tracing-attributes v0.1.11
Downloaded tower-service v0.3.0
Downloaded pin-project-lite v0.2.4
Downloaded standback v0.2.14
Downloaded tokio-util v0.6.1
Downloaded libc v0.2.82
Downloaded crossbeam-utils v0.8.1
Downloaded regex-syntax v0.6.22
Downloaded web-sys v0.3.46
Downloaded tokio v1.5.0
Downloaded encoding_rs v0.8.26
Downloaded http-types v2.11.1
Downloaded curl-sys v0.4.39+curl-7.74.0
Downloaded libnghttp2-sys v0.1.5+1.42.0
Downloaded 96 crates (16.3 MB) in 2.32s (largest was libnghttp2-sys
at 4.5 MB)
Compiling proc-macro2 v1.0.24
Compiling unicode-xid v0.2.1
Compiling syn v1.0.58
Compiling libc v0.2.82
Compiling version_check v0.9.2
Compiling cfg-if v1.0.0
Compiling autocfg v1.0.1
Compiling log v0.4.13
Compiling cfg-if v0.1.10
Compiling memchr v2.3.4
Compiling cc v1.0.66
Compiling pin-project-lite v0.2.4
Compiling futures-core v0.3.12
Compiling lazy_static v1.4.0
Compiling once_cell v1.5.2
Compiling pkg-config v0.3.19
Compiling typenum v1.12.0
Compiling futures-io v0.3.12
Compiling serde_derive v1.0.119
Compiling scopeguard v1.1.0
Compiling itoa v0.4.7
Compiling bytes v1.0.1
Compiling proc-macro-hack v0.5.19
Compiling serde v1.0.119
Compiling futures-sink v0.3.12
Compiling slab v0.4.2
Compiling pin-project-internal v0.4.27
Compiling ryu v1.0.5
Compiling smallvec v1.6.1
Compiling fastrand v1.4.0
Compiling fnv v1.0.7
Compiling subtle v2.4.0
Compiling percent-encoding v2.1.0
Compiling pin-utils v0.1.0
Compiling matches v0.1.8
Compiling waker-fn v1.1.0
Compiling parking v2.0.0
Compiling cache-padded v1.1.1
Compiling opaque-debug v0.3.0
Compiling tinyvec_macros v0.1.0
Compiling event-listener v2.5.1
Compiling proc-macro-nested v0.1.7
Compiling serde_json v1.0.61
Compiling getrandom v0.1.16
Compiling wasm-bindgen-shared v0.2.69
Compiling openssl-probe v0.1.2
Compiling cpuid-bool v0.2.0
Compiling vec-arena v1.0.0
Compiling const_fn v0.4.5
Compiling async-task v4.0.3
Compiling atomic-waker v1.0.0
Compiling bumpalo v3.4.0
Compiling ppv-lite86 v0.2.10
Compiling bitflags v1.2.1
Compiling openssl v0.10.32
Compiling httparse v1.3.4
Compiling foreign-types-shared v0.1.1
Compiling cpuid-bool v0.1.2
Compiling hashbrown v0.9.1
Compiling curl v0.4.34
Compiling anyhow v1.0.38
Compiling http-types v2.11.1
Compiling encoding_rs v0.8.26
Compiling base64 v0.13.0
Compiling wasm-bindgen v0.2.69
Compiling base64 v0.12.3
Compiling native-tls v0.2.7
Compiling data-encoding v2.3.1
Compiling try-lock v0.2.3
Compiling isahc v0.9.14
Compiling infer v0.2.3
Compiling httpdate v0.3.2
Compiling mime v0.3.16
Compiling tower-service v0.3.0
Compiling bytes v0.5.6
Compiling getrandom v0.2.1
Compiling isahc v1.3.1
Compiling regex-syntax v0.6.22
Compiling deadpool-runtime v0.1.2
Compiling futures-timer v3.0.2
Compiling ipnet v2.3.0
Compiling instant v0.1.9
Compiling tracing-core v0.1.17
Compiling thread_local v1.1.0
Compiling futures-task v0.3.12
Compiling lock_api v0.4.2
Compiling generic-array v0.14.4
Compiling standback v0.2.14
Compiling time v0.2.24
Compiling unicase v2.6.0
Compiling cookie v0.14.3
Compiling tokio v1.5.0
Compiling crossbeam-utils v0.8.1
Compiling indexmap v1.6.1
Compiling futures-channel v0.3.12
Compiling http v0.2.3
Compiling unicode-bidi v0.3.4
Compiling form_urlencoded v1.0.0
Compiling tinyvec v1.1.0
Compiling concurrent-queue v1.2.2
Compiling async-mutex v1.4.0
Compiling async-lock v2.3.0
Compiling foreign-types v0.3.2
Compiling openssl-sys v0.9.60
Compiling libnghttp2-sys v0.1.5+1.42.0
Compiling libz-sys v1.1.2
Compiling curl-sys v0.4.39+curl-7.74.0
Compiling spinning_top v0.2.2
Compiling sluice v0.5.4
Compiling async-channel v1.6.1
Compiling flume v0.9.2
Compiling futures-lite v1.11.3
Compiling aho-corasick v0.7.15
Compiling kv-log-macro v1.0.7
Compiling want v0.3.0
Compiling unicode-normalization v0.1.16
Compiling parking_lot_core v0.8.2
Compiling signal-hook-registry v1.3.0
Compiling mio v0.7.7
Compiling socket2 v0.3.19
Compiling polling v2.0.2
Compiling num_cpus v1.13.0
Compiling nb-connect v1.0.2
Compiling quote v1.0.8
The following warnings were emitted during compilation:
warning: build/expando.c:4:24: error: pasting "RUST_VERSION_OPENSSL_" and "(" does not give a valid preprocessing token
warning: 4 | #define VERSION2(n, v) RUST_VERSION_##n##_##v
warning: | ^~~~~~~~~~~~~
warning: build/expando.c:5:23: note: in expansion of macro ‘VERSION2’
warning: 5 | #define VERSION(n, v) VERSION2(n, v)
warning: | ^~~~~~~~
warning: build/expando.c:10:1: note: in expansion of macro ‘VERSION’
warning: 10 | VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
warning: | ^~~~~~~
error: failed to run custom build command for openssl-sys v0.9.60
Caused by:
process didn't exit successfully: /home/inigo/RustProjects/opensource/wiremock-rs/target/debug/build/openssl-sys-029e31c76943313d/build-script-main
(exit status: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=OPENSSL_STATIC
cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=SYSROOT
cargo:rerun-if-env-changed=OPENSSL_STATIC
cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=crypto
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=OPENSSL_STATIC
cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/usr/include" "-Wall" "-Wextra" "-E" "build/expando.c"
cargo:warning=build/expando.c:4:24: error: pasting "RUST_VERSION_OPENSSL_" and "(" does not give a valid preprocessing token
cargo:warning= 4 | #define VERSION2(n, v) RUST_VERSION_##n##_##v
cargo:warning= | ^~~~~~~~~~~~~
cargo:warning=build/expando.c:5:23: note: in expansion of macro ‘VERSION2’
cargo:warning= 5 | #define VERSION(n, v) VERSION2(n, v)
cargo:warning= | ^~~~~~~~
cargo:warning=build/expando.c:10:1: note: in expansion of macro ‘VERSION’
cargo:warning= 10 | VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
cargo:warning= | ^~~~~~~
exit status: 1
--- stderr
thread 'main' panicked at '
Header expansion error:
Error { kind: ToolExecError, message: "Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/usr/include" "-Wall" "-Wextra" "-E" "build/expando.c" with args "cc" did not execute successfully (status code exit status: 1)." }
Failed to find OpenSSL development headers.
You can try fixing this setting the OPENSSL_DIR
environment variable
pointing to your OpenSSL installation or installing OpenSSL headers package
specific to your distribution:
# On Ubuntu
sudo apt-get install libssl-dev
# On Arch Linux
sudo pacman -S openssl
# On Fedora
sudo dnf install openssl-devel
See rust-openssl README for more information:
You need to install openssl
on your system - this is not a wiremock
issue, it comes from openssl-sys
, one of the crates in the dependency tree.
I needed to restart the OS, now it's working. Thanks.