hyperledger-archives / indy-sdk

indy-sdk
https://wiki.hyperledger.org/display/indy
Apache License 2.0
666 stars 737 forks source link

Failed to open OpenSSL headers on Ubuntu #2584

Closed SamuelWolf0 closed 6 months ago

SamuelWolf0 commented 1 year ago

When running cargo build --release the following error occurs:

error: failed to run custom build command for openssl-sys v0.9.59

Caused by: process didn't exit successfully: /home/ubuntu/indy-sdk/libindy/target/release/build/openssl-sys-2a4d609e2ccefdc1/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 = /usr/include/openssl/ 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 = /usr/include/ cargo:rustc-link-search=native=/usr/include/openssl/ cargo:include=/usr/include/ OPT_LEVEL = Some("3") 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("false") CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2") running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/usr/include/" "-Wall" "-Wextra" "-E" "build/expando.c" cargo:warning=build/expando.c:4:24: error: pasting "RUST_VERSIONOPENSSL" and "(" does not give a valid preprocessing token cargo:warning= 4 | #define VERSION2(n, v) RUSTVERSION##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\" \"-O3\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-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:

  https://github.com/sfackler/rust-openssl#linux

', /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.59/build/main.rs:141:13 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

All required dependencies are installed correctly. To which path do you have to set the OPENSSL_DIR variables?

chrizteroo commented 1 year ago

Try running: cargo add openssl-sys then, cargo update cargo build --release

SamuelWolf0 commented 1 year ago

That fixes the error. But executing cargo build --release now just stops at building the libindy library and won´t finish that task

chrizteroo commented 1 year ago

Yes I noticed and I have opened new issues for it, see link below. https://github.com/hyperledger/indy-sdk/issues/2588

chrizteroo commented 1 year ago

@SamuelWolf0 I have solved the library won't finish the task you highlighted above. I was using AWS ubuntu on free tier 8GB. I was getting the same stoppage, I now increased the memory storage to 20GB and it is now loading but am getting different error. Will keep troubleshooting to see if I can fix

mmatteo23 commented 1 year ago

Hi guys! I don't know if this message could help but I had the same error with openssl and I was able to solve the problem with @chrizteroo message (this one).

This is my current setup:

Maybe @SamuelWolf0 you can try to update your versions.