rust-openssl / rust-openssl/rust-openssl
Failure to find appropriate headers on Ubuntu 24.04 despite having `libssl-dev` installed
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 841
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 4
Description
I'm currently seeing an error:
cargo:warning=In file included from /usr/include/openssl/opensslv.h:109,
cargo:warning= from build/expando.c:1:
cargo:warning=/usr/include/openssl/macros.h:14:10: fatal error: openssl/opensslconf.h: No such file or directory
cargo:warning= 14 | #include <openssl/opensslconf.h>
cargo:warning= | ^~~~~~~~~~~~~~~~~~~~~~~
cargo:warning=compilation terminated.
--- stderr
thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.101/build/main.rs:186:13:
Header expansion error:
Error { kind: ToolExecError, message: "Command \"cc\" \"-O0\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-gdwarf-4\" \"-fno-omit-frame-pointer\" \"-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
...
Full log available in this gist.
However I have pkg-config and libssl-dev installed and up to date:
root@6b49c5e222e1:/workspaces/sshenanigans# apt-get install pkg-config libssl-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
pkg-config is already the newest version (1.8.1-2).
libssl-dev is already the newest version (3.0.13-0ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
root@6b49c5e222e1:/workspaces/sshenanigans#
Inspecting /usr/include, I can see that /usr/include/openssl/ has 133 header files, all the usual suspects, and /usr/include/aarch64-linux-gnu/openssl/ contains two header files: configuration.h and opensslconf.h.
For reproducibility, I'm attempting to cargo build a rust project that depends on openssl-sys from within this Docker container:
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y curl libssl-dev pkg-config
# See https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file#in-a-container.
RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --init none --no-confirm
ENV PATH="${PATH}:/nix/var/nix/profiles/default/bin"
RUN nix profile install nixpkgs#cargo nixpkgs#gcc
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the cargo build in the provided Ubuntu 24.04 Dockerfile and inspect the openssl-sys build output, including build/main.rs and the reported OpenSSL header paths. Compare the compiler include paths with the architecture-specific headers under /usr/include/aarch64-linux-gnu/openssl/. Done means the documented container setup can build the Rust project without the missing-header error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, rust, ubuntu
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100