alexcrichton / alexcrichton/openssl-src-rs

Vendor build failing in konflux

Offen
#278 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
80
Forks
131
Ø Merge
49 Min.
Gemergte PRs (30 T.)
2

Beschreibung

For extra security, the [Konflux](https://konflux-ci.dev/) CI/CD system allows to run hermetic builds, i.e. pre-fetch all dependencies before hand using the [hermeto](https://hermetoproject.github.io/hermeto/) tool and run the actual build isolated from network.

Build of `openssl-src-rs` in such a context fails with :

```
running cd "/workdir/guest-components/target/release/build/openssl-sys-de482d7d87fe3b98/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="cc" RANLIB="ranlib" "perl" "./Configure" "--prefix=/work
dir/guest-components/target/release/build/openssl-sys-de482d7d87fe3b98/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-shared" "no-module" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=
lib" "no-ssl3" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
Configuring OpenSSL version 3.5.4 for target linux-x86_64
Using os-specific seed configuration
cargo:warning=configuring OpenSSL build: 'perl' reported failure with exit status: 2
cargo:warning=openssl-src: failed to build OpenSSL from source

--- stderr

Failure! Makefile wasn't produced.
Please read INSTALL.md and associated NOTES-* files. You may also have to
look over your available compiler tool chain or change your configuration.

Something went wrong with /workdir/guest-components/target/release/build/openssl-sys-de482d7d87fe3b98/out/openssl-build/build/src/fuzz/build.info: No such file or directory

Error configuring OpenSSL build:
'perl' reported failure with exit status: 2
Command failed: cd "/workdir/guest-components/target/release/build/openssl-sys-de482d7d87fe3b98/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="cc" RANLIB="ranlib" "perl" "./Configure" "--prefix=/workdir/guest-components/target/release/build/openssl-sys-de482d7d87fe3b98/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-shared" "no-module" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-ssl3" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"

```

This is quite similar to what was reported at https://github.com/alexcrichton/openssl-src-rs/pull/102#issuecomment-916416867. Digging a bit more I found these two changes :
- https://github.com/alexcrichton/openssl-src-rs/pull/104/changes/ed8151b86dbe5c6c0afb46c97376c67475d6027b#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R133-R139
- https://github.com/alexcrichton/openssl-src-rs/pull/104/changes/a4299df587eb4685942ecc15ff5c243d3a942287#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759L133-L139

Not sure to fully understand why the first change was reverted but it actually helped in my case. I applied the following patch to `src/lib.rs` in the output of hermeto and the error went away :

```
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -154,6 +154,13 @@ impl Build {
fs::create_dir_all(&inner_dir).map_err(|e| format!("{}: {e}", inner_dir.display()))?;
cp_r(&source_dir(), &inner_dir)?;

+ // OpenSSL 3.0.0 requires an empty build.info file in these directories
+ // to configure itself
+ fs::create_dir_all(inner_dir.join("fuzz")).unwrap();
+ fs::File::create(inner_dir.join("fuzz/build.info")).unwrap();
+ fs::create_dir_all(inner_dir.join("doc")).unwrap();
+ fs::File::create(inner_dir.join("doc/build.info")).unwrap();
+
let perl_program =
env::var("OPENSSL_SRC_PERL").unwrap_or(env::var("PERL").unwrap_or("perl".to_string()));
let mut configure = Command::new(perl_program);
```

I can create a PR if this change is acceptable. WDYT @alexcrichton ?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.