Bug 230470 - lang/rust: Support LibreSSL 2.8
Summary: lang/rust: Support LibreSSL 2.8
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: FreeBSD Rust Team
URL:
Keywords: patch
Depends on: 231411
Blocks:
  Show dependency treegraph
 
Reported: 2018-08-08 18:32 UTC by Charlie Li
Modified: 2018-09-30 22:33 UTC (History)
4 users (show)

See Also:
dumbbell: maintainer-feedback+


Attachments
libressl-2.8 (15.33 KB, patch)
2018-08-08 18:32 UTC, Charlie Li
no flags Details | Diff
1.29.0-libressl2.8 (438.21 KB, patch)
2018-09-17 02:10 UTC, Charlie Li
no flags Details | Diff
1.29.0-libressl2.8.x (438.56 KB, patch)
2018-09-27 03:24 UTC, Charlie Li
vishwin: maintainer-approval? (dumbbell)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Charlie Li freebsd_committer freebsd_triage 2018-08-08 18:32:52 UTC
Created attachment 196014 [details]
libressl-2.8

Version 2.8 of LibreSSL landed in our ports tree as security/libressl-devel. Currently the openssl-sys crate, at version 0.9.28, only supports up to LibreSSL 2.7. Because LibreSSL 2.8 is so new and not exactly marked as production just yet, upstream has not taken any action.

This patch takes a build.rs from an openssl-sys between 0.9.30 and 0.9.31 as a basis, because of better version detection logic, and adds in LibreSSL 2.8 as a valid version. OpenSSL support is not affected. Builds successfully and passes testport, since there doesn't seem to exist any ABI-breaking changes.

Note that this and the existing libgit2-sys patch will still be needed when this port gets updated to 1.28.0; none of the patched crates got updated in the 1.28.0 tarball.
Comment 1 Charlie Li freebsd_committer freebsd_triage 2018-09-17 02:10:51 UTC
Created attachment 197159 [details]
1.29.0-libressl2.8

1.29.0 updated the openssl{,-sys} crates to versions supporting LibreSSL 2.7. This patch pulls in upstream's LibreSSL 2.8 support. Unfortunately openssl-sys got refactored immediately before LibreSSL 2.8 support landed, so this patch is larger than it should. Many files added and a few deleted, so this patch includes openssl-sys's .cargo-checksum.json patched directly instead of during post-patch (no such file or directory errors ensue otherwise).
Comment 2 Piotr Kubaj freebsd_committer freebsd_triage 2018-09-19 15:15:40 UTC
Building with this patch fails with:
--- stderr
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_COMPILER
    CMAKE_CXX_FLAGS


/tmp/usr/ports/lang/rust/work/rustc-1.29.0-src/src/vendor/libssh2-sys/libssh2/src/hostkey.c:526:10: error: use of undeclared identifier 'LIBSSH2_HOSTKEY_HASH_SHA256'
    case LIBSSH2_HOSTKEY_HASH_SHA256:
         ^
1 error generated.
/tmp/usr/ports/lang/rust/work/rustc-1.29.0-src/src/vendor/libssh2-sys/libssh2/src/channel.c:2262:44: error: use of undeclared identifier 'LIBSSH2_ERROR_CHANNEL_WINDOW_FULL'
            return _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_WINDOW_FULL,
                                           ^
1 error generated.
gmake[4]: *** [src/CMakeFiles/libssh2.dir/build.make:141: src/CMakeFiles/libssh2.dir/hostkey.c.o] Error 1
gmake[4]: *** Waiting for unfinished jobs....
gmake[4]: *** [src/CMakeFiles/libssh2.dir/build.make:89: src/CMakeFiles/libssh2.dir/channel.c.o] Error 1
gmake[3]: *** [CMakeFiles/Makefile2:91: src/CMakeFiles/libssh2.dir/all] Error 2
gmake[2]: *** [Makefile:152: all] Error 2
thread 'main' panicked at '
command did not execute successfully, got: exit code: 2

build script failed, must exit now', vendor/cmake/src/lib.rs:643:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/tmp/usr/ports/lang/rust/work/rustc-1.29.0-src/build/x86_64-unknown-freebsd/stage0/bin/cargo" "build" "--target" "x86_64-unknown-freebsd" "-j" "32" "--release" "--frozen" "--manifest-path" "/tmp/usr/ports/lang/rust/work/rustc-1.29.0-src/src/tools/cargo/Cargo.toml" "--features" "" "--message-format" "json"
expected success, got: exit code: 101
Traceback (most recent call last):
  File "/tmp/usr/ports/lang/rust/work/rustc-1.29.0-src/x.py", line 20, in <module>
    bootstrap.main()
  File "/tmp/usr/ports/lang/rust/work/rustc-1.29.0-src/src/bootstrap/bootstrap.py", line 843, in main
    bootstrap(help_triggered)
  File "/tmp/usr/ports/lang/rust/work/rustc-1.29.0-src/src/bootstrap/bootstrap.py", line 834, in bootstrap
    run(args, env=env, verbose=build.verbose)
  File "/tmp/usr/ports/lang/rust/work/rustc-1.29.0-src/src/bootstrap/bootstrap.py", line 148, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /tmp/usr/ports/lang/rust/work/rustc-1.29.0-src/build/bootstrap/debug/bootstrap build --verbose --config ./config.toml --jobs 32
*** Error code 1
Comment 3 Robert Zelaya 2018-09-20 05:02:55 UTC
OS: 12.0-ALPHA6 FreeBSD 12.0-ALPHA6  r338692  amd64

I'm getting the exact same error as Piotr Kubaj. Please update patch. Without rust firefox does not build.
Comment 4 Charlie Li freebsd_committer freebsd_triage 2018-09-20 05:05:17 UTC
Separate problem, being tracked in bug 231411.
Comment 5 Charlie Li freebsd_committer freebsd_triage 2018-09-27 03:24:52 UTC
Created attachment 197541 [details]
1.29.0-libressl2.8.x

With the release of LibreSSL 2.8.1, update patch to support all versions in the LibreSSL 2.8 series. This will be submitted upstream (currently, only detects 2.8.0).
Comment 6 Jean-Sébastien Pédron freebsd_committer freebsd_triage 2018-09-27 10:23:21 UTC
Hi!

I'm finally taking a look at this patch... I prepared the update to Rust 1.29.1 and just applied the patch on top of it. Waiting for Poudriere now :)
Comment 7 Piotr Kubaj freebsd_committer freebsd_triage 2018-09-29 17:38:55 UTC
(In reply to Jean-Sébastien Pédron from comment #6)
Poudriere really takes a long time to compile this (already two days) :)
Comment 8 Jean-Sébastien Pédron freebsd_committer freebsd_triage 2018-09-30 15:48:20 UTC
Sorry it takes time, but the Poudriere build failed and I didn't have time to track the issue down yet.
Comment 9 Mikael Urankar freebsd_committer freebsd_triage 2018-09-30 16:05:50 UTC
(In reply to Piotr Kubaj from comment #7)
You have 3 options to speed up the build:
1) only build the X86 llvm target (we currenly build llvm for all targets)
2) use an external llvm toolchain (one from devel/llvm6 or llvm7
3) use ccache, when the cache is hot llvm only takes 1 min to build for me.

for 1) you have to put these lines in config.toml (in the llvm section):
[llvm]
targets = "X86"
experimental-targets = ""

for 2) you have to add this line to the Makefile:
BUILD_DEPENDS+=llc70:devel/llvm70
and this line in config.toml (in the target section):
[target.%TARGET%]
llvm-config = "/usr/local/llvm70/bin/llvm-config"

This is my build time with this different options:
stock: build time: 06:23:44
opt 1: build time: 05:30:53
opt 2: build time: 03:55:16
opt 3: not available
Comment 10 Charlie Li freebsd_committer freebsd_triage 2018-09-30 20:50:57 UTC
(In reply to mikael.urankar from comment #9)
The PORT_LLVM option was removed for a good reason. Rust not only uses a forked LLVM with a few commits that will probably never see upstream, but they almost always track llvm-devel. There is sentiment against too many ports depending on different LLVM versions.

We can't build just x86, even when aarch64 is broken right now.
Comment 11 commit-hook freebsd_committer freebsd_triage 2018-09-30 22:28:39 UTC
A commit references this bug:

Author: dumbbell
Date: Sun Sep 30 22:28:30 UTC 2018
New revision: 480986
URL: https://svnweb.freebsd.org/changeset/ports/480986

Log:
  lang/rust: Add patches to support LibreSSL 2.8.1

  PR:		230470
  Reported by:	Charlie Li <ml+freebsd@vishwin.info>

Changes:
  head/lang/rust/Makefile
  head/lang/rust/files/patch-src_vendor_openssl-sys_.cargo-checksum.json
  head/lang/rust/files/patch-src_vendor_openssl-sys_build_cfgs.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_build_main.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_aes.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_asn1.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_bio.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_bn.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_cms.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_conf.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_crypto.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_dh.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_dsa.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_dtls1.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_ec.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_err.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_evp.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_hmac.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_lib.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_libressl_mod.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_libressl_v250.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_libressl_v251.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_libressl_v273.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_macros.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_obj__mac.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_object.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_ocsp.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_openssl_mod.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_openssl_v10x.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_openssl_v110.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_openssl_v111.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_ossl__typ.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_pem.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_pkcs12.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_rand.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_rsa.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_safestack.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_sha.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_srtp.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_ssl.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_ssl3.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_stack.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_tls1.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_x509.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_x509__vfy.rs
  head/lang/rust/files/patch-src_vendor_openssl-sys_src_x509v3.rs
  head/lang/rust/files/patch-src_vendor_openssl_build.rs
  head/lang/rust/files/patch-src_vendor_openssl_src_ssl_callbacks.rs
Comment 12 Jean-Sébastien Pédron freebsd_committer freebsd_triage 2018-09-30 22:33:49 UTC
Thank you for the patch! There was something wrong with my working copy, leading to the build failure. I could revert the changes and reapply the patch tonight and Poudriere is happy.