sfackler / rust-openssl

OpenSSL bindings for Rust
1.41k stars 753 forks source link

How to specify the source version to compile? rolled back openssl v3.3.2 to v3.3.1 #2300

Closed metercai closed 2 months ago

metercai commented 2 months ago

The routine compilation in GitHub action encountered a failure due to the OpenSSL upgrade of 3.3.2.

Then, we submitted a bug report: https://github.com/openssl/openssl/issues/25368

And then, The official only applied patches and did not release a new version: https://github.com/openssl/openssl/pull/25367

But, it's no way to patch in CI script because it is automatically compiled.

So, how to specify the source version to compile in Cargo.toml for openssl crate? Going back from v3.3.2 to v3.3.1 will be ok.

Cargo.toml : openssl = { version = "0.10", features = ["vendored"] }

the complie logs : 2024-09-03T18:18:49.7286681Z running cd "/home/runner/work/simpleai_base/simpleai_base/target/x86_64-unknown-linux-gnu/release/build/openssl-sys-a8783d2b6f7231a7/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="sccache cc" RANLIB="ranlib" "perl" "./Configure" "--prefix=/home/runner/work/simpleai_base/simpleai_base/target/x86_64-unknown-linux-gnu/release/build/openssl-sys-a8783d2b6f7231a7/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" 2024-09-03T18:18:49.7292338Z Configuring OpenSSL version 3.3.2 for target linux-x86_64 2024-09-03T18:18:49.7293269Z Using os-specific seed configuration 2024-09-03T18:18:49.7293900Z Created configdata.pm 2024-09-03T18:18:49.7294541Z Running configdata.pm 2024-09-03T18:18:49.7295379Z Created Makefile.in 2024-09-03T18:18:49.7295866Z Created Makefile 2024-09-03T18:18:49.7296522Z Created include/openssl/configuration.h 2024-09-03T18:18:49.7296992Z 2024-09-03T18:18:49.7297302Z ** 2024-09-03T18:18:49.7298037Z 2024-09-03T18:18:49.7299033Z OpenSSL has been successfully configured 2024-09-03T18:18:49.7300160Z 2024-09-03T18:18:49.7301084Z If you encounter a problem while building, please open an 2024-09-03T18:18:49.7302239Z issue on GitHub https://github.com/openssl/openssl/issues 2024-09-03T18:18:49.7303319Z and include the output from the following command: 2024-09-03T18:18:49.7304223Z 2024-09-03T18:18:49.7305216Z perl configdata.pm --dump 2024-09-03T18:18:49.7306150Z 2024-09-03T18:18:49.7428039Z (If you are new to OpenSSL, you might want to consult the 2024-09-03T18:18:49.7429479Z 'Troubleshooting' section in the INSTALL.md file first) 2024-09-03T18:18:49.7430448Z 2024-09-03T18:18:49.7431265Z ** 2024-09-03T18:18:49.7433496Z running cd "/home/runner/work/simpleai_base/simpleai_base/target/x86_64-unknown-linux-gnu/release/build/openssl-sys-a8783d2b6f7231a7/out/openssl-build/build/src" && "make" "depend" 2024-09-03T18:18:49.7437097Z running cd "/home/runner/work/simpleai_base/simpleai_base/target/x86_64-unknown-linux-gnu/release/build/openssl-sys-a8783d2b6f7231a7/out/openssl-build/build/src" && MAKEFLAGS="-j --jobserver-fds=8,9 --jobserver-auth=8,9" "make" "build_libs" 2024-09-03T18:18:49.7440973Z /usr/bin/perl util/mkinstallvars.pl PREFIX=. BINDIR=apps APPLINKDIR=ms LIBDIR= INCLUDEDIR=include "INCLUDEDIR=./include" ENGINESDIR=engines MODULESDIR=providers "VERSION=3.3.2" "LDLIBS=-ldl -pthread " > builddata.pm 2024-09-03T18:18:49.7442854Z 2024-09-03T18:18:49.7443099Z --- stderr 2024-09-03T18:18:49.7443716Z "pairs" is not exported by the List::Util module 2024-09-03T18:18:49.7444910Z Can't continue after import errors at util/mkinstallvars.pl line 14. 2024-09-03T18:18:49.7446122Z BEGIN failed--compilation aborted at util/mkinstallvars.pl line 14. 2024-09-03T18:18:49.7447042Z make: *** [builddata.pm] Error 255 2024-09-03T18:18:49.7448664Z thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.3.2+3.3.2/src/lib.rs:633:9:

sfackler commented 2 months ago

You can use cargo update --precise to adjust the version of openssl-src in your Cargo.lock.

metercai commented 2 months ago

You can use cargo update --precise to adjust the version of openssl-src in your Cargo.lock.

thanks. but, in the action script, only the project source and run before build script can be adjusted, and everything else is automated. adjusting Cargo.lock needs to be done after cargo build. it seems unlikely?

sfackler commented 2 months ago

I don't know the details of your build process. If you want to use the vendored OpenSSL build, the only way to adjust the OpenSSL version is to adjust the version of the openssl-src crate the build uses.

LorenzoLeonardo commented 2 months ago

you can peg that version in your cargo.toml like this

wiremock = "=0.5.15"

ospfranco commented 2 months ago

I've tried both adding a specific version into my cargo.toml and with --precise:

~/Developer/opacity-core (oscar/android-ci*) » cargo update openssl-src --precise 111.28.2+1.1.1w                         101 ↵ osp@ospm3
    Updating crates.io index
error: failed to select a version for the requirement `openssl-src = "^300.2.0"`
candidate versions found which didn't match: 111.28.2+1.1.1w
location searched: crates.io index
required by package `openssl-sys v0.9.103`
    ... which satisfies dependency `ffi = "^0.9.103"` (locked to 0.9.103) of package `openssl v0.10.66`
    ... which satisfies dependency `openssl = "^0.10"` (locked to 0.10.66) of package `opacity_core v3.10.0 (/Users/osp/Developer/opacity-core)`

None of them work. My problem is that the latest versions of OpenSSL do not work on Android, so I need to revert to a working version. Is there any other way to compile against an older version?

I have a workaround described here, where I manually patch and compile an openssl version, but it is tedious to setup, specially on CI.

sfackler commented 2 months ago

OpenSSL 1.1.1 has been EOL for over a year.

ospfranco commented 2 months ago

I know but... it's still the only official Ndk port on Android with no announced plans to update it.

Is there anyyyy way to make this work?