mrustc: 1.29.0: failure to build against libssl-dev 3.x

Using master at af16084341fddf29582995576a036f5525a68d98. Inside a Ubuntu Mantic container (libssl-dev 3.0.9).

apt update && apt upgrade -y
apt install gcc g++ git make patch libz-dev curl cmake python3 pkg-config libssl-dev -y
git clone https://github.com/thepowersgang/mrustc
cd mrustc
make RUSTCSRC
make -f minicargo.mk
make -C run_rustc
….
Error { kind: ToolExecError, message: "Command \"cc\" \"-O2\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-g\" \"-m64\" \"-Wall\" \"-Wextra\" \"-E\" \"/mrustc/output/cargo-build/build_openssl-sys-0_9_35/expando.c\" with args \"cc\" did not execute successfully (status code exit code: 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
', rustc-1.29.0-src/src/vendor/openssl-sys/build/main.rs:451:15
Process was terminated with signal 6
FAILING COMMAND:  /mrustc/output/cargo-build/build_openssl-sys-0_9_35_run
# cat /mrustc/output/cargo-build/build_openssl-sys-0_9_35.txt_failed.txt
<snipped>
HOST = Some("x86_64-linux-gnu")
TARGET = Some("x86_64-linux-gnu")
HOST = Some("x86_64-linux-gnu")
CFLAGS_x86_64-linux-gnu = None
CFLAGS_x86_64_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("0")
running: "cc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-E" "/mrustc/output/cargo-build/build_openssl-sys-0_9_35/expando.c"
cargo:warning=/mrustc/output/cargo-build/build_openssl-sys-0_9_35/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=/mrustc/output/cargo-build/build_openssl-sys-0_9_35/expando.c:5:23: note: in expansion of macro 'VERSION2'
cargo:warning=    5 | #define VERSION(n, v) VERSION2(n, v)
cargo:warning=      |                       ^~~~~~~~
cargo:warning=/mrustc/output/cargo-build/build_openssl-sys-0_9_35/expando.c:7:1: note: in expansion of macro 'VERSION'
cargo:warning=    7 | VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
cargo:warning=      | ^~~~~~~
exit code: 1

Note that Ubuntu Jammy onwards ships with a 3.x version of libssl dev, and Jammy is currently the version used in the CI here (ubuntu-latest), so it’s not clear to me why the CI build are passing? I can’t see any additional libssl installation/building 1.1 from source etc.

I’ve checked that builds work as expected inside a Ubuntu Focal container, which ships with libssl 1.1.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Solution! Enable the vendored-openssl feature, which seems to be present on cargo since 1.29