Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Failed to find OpenSSL development headers" on Fedora 40 #2303

Open
tsoernes opened this issue Sep 12, 2024 · 1 comment
Open

"Failed to find OpenSSL development headers" on Fedora 40 #2303

tsoernes opened this issue Sep 12, 2024 · 1 comment

Comments

@tsoernes
Copy link

tsoernes commented Sep 12, 2024

Fedora 40 x86_64

Compilation failed with default (unset) environment variables.

Manually set environment variables:

OPENSSL_DIR = /etc/pki/tls
OPENSSL_LIB_DIR = /usr/lib64
OPENSSL_INCLUDE_DIR = /usr/include/openssl

^ (all these directories are non-empty)

$ openssl version -d
OPENSSLDIR: "/etc/pki/tls"
$ dnf list --installed --cacheonly | grep --ignore-case openssl       
openssl.x86_64                                         1:3.2.2-3.fc40                                   
openssl-devel.x86_64                                   1:3.2.2-3.fc40   

pkgconf-pkg-config-2.1.1-2.fc40.x86_64
perl-IPC-Cmd.noarch 2:1.04-504.fc40
perl-FindBin.noarch 1.53-506.fc40

Compilation log:

cargo build --release --target=x86_64-unknown-linux-musl                                                                                                             10:04:09
warning: `/home/torstein/code/azure-function-rust-poc/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
   Compiling openssl-sys v0.9.103
   Compiling ipnet v2.10.0
   Compiling equivalent v1.0.1
   Compiling hashbrown v0.14.5
   Compiling num-conv v0.1.0
   Compiling infer v0.2.3
   Compiling base64 v0.13.1
   Compiling time-core v0.1.2
   Compiling paste v1.0.15
   Compiling azure_core v0.20.0
   Compiling futures v0.3.30
   Compiling event-listener-strategy v0.5.2
The following warnings were emitted during compilation:

warning: [email protected]: Compiler family detection failed due to error: ToolExecError: Command "musl-gcc" "-E" "/home/torstein/code/azure-function-rust-poc/target/x86_64-unknown-linux-musl/release/build/openssl-sys-1382de6c89070ab0/out/4677944366263544583detect_compiler_family.c" with args musl-gcc failed to start: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }

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

Caused by:
  process didn't exit successfully: `/home/torstein/code/azure-function-rust-poc/target/release/build/openssl-sys-527f7a6fc5f18479/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO"))
  cargo:rustc-check-cfg=cfg(openssl)
  cargo:rustc-check-cfg=cfg(libressl)
  cargo:rustc-check-cfg=cfg(boringssl)
  cargo:rustc-check-cfg=cfg(libressl250)
  cargo:rustc-check-cfg=cfg(libressl251)
  cargo:rustc-check-cfg=cfg(libressl252)
  cargo:rustc-check-cfg=cfg(libressl261)
  cargo:rustc-check-cfg=cfg(libressl270)
  cargo:rustc-check-cfg=cfg(libressl271)
  cargo:rustc-check-cfg=cfg(libressl273)
  cargo:rustc-check-cfg=cfg(libressl280)
  cargo:rustc-check-cfg=cfg(libressl281)
  cargo:rustc-check-cfg=cfg(libressl291)
  cargo:rustc-check-cfg=cfg(libressl310)
  cargo:rustc-check-cfg=cfg(libressl321)
  cargo:rustc-check-cfg=cfg(libressl332)
  cargo:rustc-check-cfg=cfg(libressl340)
  cargo:rustc-check-cfg=cfg(libressl350)
  cargo:rustc-check-cfg=cfg(libressl360)
  cargo:rustc-check-cfg=cfg(libressl361)
  cargo:rustc-check-cfg=cfg(libressl370)
  cargo:rustc-check-cfg=cfg(libressl380)
  cargo:rustc-check-cfg=cfg(libressl381)
  cargo:rustc-check-cfg=cfg(libressl382)
  cargo:rustc-check-cfg=cfg(libressl390)
  cargo:rustc-check-cfg=cfg(libressl400)
  cargo:rustc-check-cfg=cfg(ossl101)
  cargo:rustc-check-cfg=cfg(ossl102)
  cargo:rustc-check-cfg=cfg(ossl102f)
  cargo:rustc-check-cfg=cfg(ossl102h)
  cargo:rustc-check-cfg=cfg(ossl110)
  cargo:rustc-check-cfg=cfg(ossl110f)
  cargo:rustc-check-cfg=cfg(ossl110g)
  cargo:rustc-check-cfg=cfg(ossl110h)
  cargo:rustc-check-cfg=cfg(ossl111)
  cargo:rustc-check-cfg=cfg(ossl111b)
  cargo:rustc-check-cfg=cfg(ossl111c)
  cargo:rustc-check-cfg=cfg(ossl111d)
  cargo:rustc-check-cfg=cfg(ossl300)
  cargo:rustc-check-cfg=cfg(ossl310)
  cargo:rustc-check-cfg=cfg(ossl320)
  cargo:rustc-check-cfg=cfg(ossl330)
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR
  X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR = /usr/lib64
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR
  X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR = /usr/include/openssl
  cargo:rustc-link-search=native=/usr/lib64
  cargo:include=/usr/include/openssl
  cargo:rerun-if-changed=build/expando.c
  OPT_LEVEL = Some(3)
  TARGET = Some(x86_64-unknown-linux-musl)
  OUT_DIR = Some(/home/torstein/code/azure-function-rust-poc/target/x86_64-unknown-linux-musl/release/build/openssl-sys-1382de6c89070ab0/out)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-musl
  CC_x86_64-unknown-linux-musl = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_musl
  CC_x86_64_unknown_linux_musl = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CROSS_COMPILE
  CROSS_COMPILE = None
  RUSTC_LINKER = Some(rust-lld)
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:warning=Compiler family detection failed due to error: ToolExecError: Command "musl-gcc" "-E" "/home/torstein/code/azure-function-rust-poc/target/x86_64-unknown-linux-musl/release/build/openssl-sys-1382de6c89070ab0/out/4677944366263544583detect_compiler_family.c" with args musl-gcc failed to start: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(false)
  CARGO_CFG_TARGET_FEATURE = Some(fxsr,sse,sse2)
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-musl
  CFLAGS_x86_64-unknown-linux-musl = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_musl
  CFLAGS_x86_64_unknown_linux_musl = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None

  --- stderr
  thread 'main' panicked at /home/torstein/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.103/build/main.rs:263:13:

  Header expansion error:
  Error { kind: ToolExecError, message: "Command \"musl-gcc\" \"-O3\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-m64\" \"-I\" \"/usr/include/openssl\" \"-Wall\" \"-Wextra\" \"-E\" \"build/expando.c\" with args musl-gcc failed to start: Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }" }

  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 pkg-config libssl-dev
      # On Arch Linux
      sudo pacman -S pkgconf openssl
      # On Fedora
      sudo dnf install pkgconf perl-FindBin perl-IPC-Cmd openssl-devel
      # On Alpine Linux
      apk add pkgconf openssl-dev

  See rust-openssl documentation for more information:

      https://docs.rs/openssl

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
@ashaffah
Copy link

try this env

OPENSSL_DIR=/usr
OPENSSL_LIB_DIR=/usr/lib
OPENSSL_INCLUDE_DIR=/usr/include

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants