Notwithstanding the API changes in libressl 2.7, the current rust release does not support libressl > 2.6. However, upstream has released patches for supporting libressl 2.7.
Hi! The patch to add LibreSSL 2.7.0 support doesn't apply cleanly to the copy of rust-openssl in Rust 1.24.1. Apparently, the code was significantly modified since the last import of rust-openssl. I won't have time this week to work on this, but next week should be ok.
Apparently the openssl-sys crate is still v0.9.24 in the new rust 1.25.0. The diff between said tag and git master applies cleanly, and should build in theory. I took a brief look at the rest of the changes covered in that diff, and we may want to additionally test compatibility with security/openssl-devel 1.1.
Created attachment 192365 [details] libressl 2.7 Here's a patch to try. Apply this after bdrewery@'s initial patch to update rust to 1.25.0 from bug 227130. I updated openssl-sys to upstream 0.9.28 but leaving Cargo.toml untouched at 0.9.24 so as to not trigger complaints over inconsistent Cargo.lock files and unnecessary network access that will fail anyway. I also patched the bundled libgit2-sys C portion with the help of brnrd@'s upstream patch to libgit2, although libgit2 upstream moved some files around thus needing to match filenames between new and old locations. I originally wanted to just update the two affected crates to the latest upstream but our integrated .cargo-checksum updater complains about deleted files, though not newly-created files because they weren't in .cargo-checksum to begin with. This passes testport on my amd64 machine.
Build ok.
(In reply to Charlie Li from comment #3) After applying - --- stderr thread 'main' panicked at ' This crate is only compatible with OpenSSL 1.0.1, 1.0.2, and 1.1.0, or LibreSSL 2.5 and 2.6.0, but a different version of OpenSSL was found. The build is now aborting due to this version mismatch. ', vendor/openssl-sys/build.rs:486:9 note: Run with `RUST_BACKTRACE=1` for a backtrace. warning: build failed, waiting for other jobs to finish... error: build failed fo p. command did not execute successfully: "/usr/obj/usr/ports/lang/rust/work/rustc-1.25.0-src/build/x86_64-unknown-freebsd/stage0/bin/cargo" "build" "--target" "x86_64-unknown-freebsd" "--release" "--frozen" "--manifest-path" "/usr/obj/usr/ports/lang/rust/work/rustc-1.25.0-src/src/tools/cargo/Cargo.toml" expected success, got: exit code: 101
(In reply to jakub_lach from comment #5) Are you sure you actually applied the patch by running patch(1) before building? There should be additional files within lang/rust/files, specifically those that modify the vendor/openssl-sys crate, among others.
(In reply to Charlie Li from comment #6) It looked like it have applied cleanly, $ ls -a . distinfo Makefile pkg-descr .. files Makefile.orig yet indeed, I'm missing those new files under files/, thanks!
Created attachment 193508 [details] rust1.26-libressl2.7.patch Patch adapted for rust-1.26.0 (currently in ports head). Rust-1.26 vendors openssl-sys-0.9.27, bumped to 0.9.28 without patching Cargo.toml as earlier patch. Files in libgit2-sys that needed patching have moved, but patch is basically the same.
Comment on attachment 192365 [details] libressl 2.7 I have this exactly in my tree and was about to post myself, but you beat me to it.
Hi! Thank you for providing a patch! How can I test it in Poudriere? I.e. any options beside `DEFAULT_VERSIONS+=ssl=libressl`?
(In reply to Jean-Sébastien Pédron from comment #10) Only option needed to set in make.conf.
These patches are still needed for the current version in the ports tree, 1.26.2.
Hi! Something else didn't build for me when I tried to build Rust with LibreSSL in Poudriere, but I don't remember what it was... Anyway, Rust 1.27.0 was released and it looks like it includes support for LibreSSL 2.7.x and OpenSSL 1.1.x. I'm preparing the update right now. It may take some time because there is a regression with Rust on FreeBSD/aarch64 (the compiler crashes, see bug 228892). Sorry for all the time it takes to integrate a patch...
(In reply to Jean-Sébastien Pédron from comment #13) > Something else didn't build for me when I tried to build Rust with LibreSSL in Poudriere, but I don't remember what it was... That is probably the libgit2-sys crate. The patch for that is still needed, as the crate didn't get updated from the last rust releases and thus still does not have a newer libgit2 that includes libressl 2.7 fixes. The openssl-sys crate is updated to 0.9.28, which is the first version with libressl 2.7 support. Patches for that crate can now be tossed. I'm currently building 1.27.1 with just the libgit2-sys patches; will upload the updated patch after poudriere-bulk -t succeeds.
Created attachment 195318 [details] rust-1.27.1-libressl2.7.patch This patch only patches the libgit2-sys crate in addition to the libc crate. openssl-sys crate patches removed because no longer needed.
It was another port before which failed to build, not Rust itself. Anyway, I will trust what you tested and commit the patch. It took already way too much time, I'm sorry.
A commit references this bug: Author: dumbbell Date: Sat Jul 21 15:04:14 UTC 2018 New revision: 475069 URL: https://svnweb.freebsd.org/changeset/ports/475069 Log: lang/rust: Add patches to fix the build with LibreSSL 2.7 PR: 226955 Submitted by: Charlie Li <ml+freebsd@vishwin.info> Changes: head/lang/rust/files/patch-src_vendor_libgit2-sys_libgit2_src_streams_openssl.c head/lang/rust/files/patch-src_vendor_libgit2-sys_libgit2_src_streams_openssl.h
I committed the patches. However, I kept the Makefile unmodified because we would probably have to restore it in the future for the next versions of LibreSSL or OpenSSL. Thank you for the patches and your patience!
Not applying the Makefile patch continues to fail the build because the libgit2-sys crate checksums are not regenerated. Someone posting in ports@ has already piped up about this. Please apply the full patch as posted, but retain (or not) the openssl-sys part as you wish should a new LibreSSL or OpenSSL breaks things again.
A commit references this bug: Author: dumbbell Date: Mon Jul 23 07:32:23 UTC 2018 New revision: 475150 URL: https://svnweb.freebsd.org/changeset/ports/475150 Log: lang/rust: Udpate checksums in libgit2-sys/.cargo-checksum.json It was part of the initial patch from Charlie Li to support LibreSSL 2.7. However, I misread it and though he was only removing bits which were not needed anymore (updating checksums for openssl and openssl-sys). Now, we update all three: libgit2-sys, openssl and openssl-sys. PR: 226955 Submitted by: Charlie Li <ml+freebsd@vishwin.info> Reported by: Charlie Li <ml+freebsd@vishwin.info> Changes: head/lang/rust/Makefile