Opened 2 years ago

Last modified 18 months ago

#65468 assigned defect

rust: openssl3 migration: builds failing for 10.8 and earlier; embedded cargo binary linked to openss11

Reported by: mascguy (Christopher Nielsen) Owned by: neverpanic (Clemens Lang)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port: rust

Description (last modified by mascguy (Christopher Nielsen))

During the initial bootstrap phase of the build, the embedded binary for cargo fails, due to being linked to openssl11:

Building rustbuild
running: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_rust/rust/work/cargo-1.60.0-x86_64-apple-darwin/cargo/bin/cargo build --manifest-path /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_rust/rust/work/rustc-1.61.0-src/src/bootstrap/Cargo.toml --verbose --verbose --offline
dyld: Library not loaded: /opt/local/libexec/openssl11/lib/libssl.1.1.dylib
  Referenced from: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_rust/rust/work/cargo-1.60.0-x86_64-apple-darwin/cargo/bin/cargo
  Reason: image not found

https://ports.macports.org/port/rust/details/

Change History (13)

comment:1 Changed 2 years ago by mascguy (Christopher Nielsen)

Description: modified (diff)

comment:2 Changed 2 years ago by mascguy (Christopher Nielsen)

Description: modified (diff)

comment:3 Changed 2 years ago by mascguy (Christopher Nielsen)

Description: modified (diff)
Summary: rust: builds failing for 10.8 and earlier; related to openssl3 migrationrust: openssl3 migration: builds failing for 10.8 and earlier; embedded cargo binary linked to openss11

comment:4 Changed 2 years ago by neverpanic (Clemens Lang)

Ugh, legacy systems…

I'm guessing this could be solved by actually having an additional openssl11 dependency on systems <= 10.8?

comment:5 Changed 2 years ago by jmroot (Joshua Root)

Ideally I guess you'd rebuild the bootstrap binaries against openssl 3. Probably would work to add openssl11 to depends_build on those systems in the meantime, yeah (as well as license_noconflict openssl11 since it's only used by the bootstrap binary).

comment:6 in reply to:  5 Changed 2 years ago by mascguy (Christopher Nielsen)

Replying to jmroot:

Ideally I guess you'd rebuild the bootstrap binaries against openssl 3. Probably would work to add openssl11 to depends_build on those systems in the meantime, yeah (as well as license_noconflict openssl11 since it's only used by the bootstrap binary).

This was my initial thought as well, but didn't feel comfortable committing without more discussion. So this approach definitely works for me!

I'll fix shortly, and leave this ticket open to track the longer-term fix.

Version 0, edited 2 years ago by mascguy (Christopher Nielsen) (next)

comment:7 Changed 2 years ago by Christopher Nielsen <mascguy@…>

In 2aaf82d1de9217ce1b436de1ecaa7091f4e7866c/macports-ports (master):

rust: add build dep openssl11, for macOS 10.8 and earlier
See: #65468

comment:8 Changed 2 years ago by neverpanic (Clemens Lang)

I'm guessing that bootstrap binary would have to be compiled on 10.8 or lower? I don't have a machine this old anymore, so I can't do that, unfortunately.

It may be as simple also also changing openssl.branch in the rust-bootstrap Portfile, but building that requires jemalloc +universal, which doesn't seem to compile on my 12.4 arm64. If I build it -universal, that seems to work fine, though.

The resulting binary seems to be correctly linked against openssl 3:

$ tar xzOf work/destroot/opt/local/libexec/rust-bootstrap/cargo-1.60.0+0-aarch64-macports-darwin.tar.gz cargo-1.60.0-aarch64-apple-darwin/cargo/bin/cargo >/tmp/cargo
$ otool -L /tmp/cargo
/tmp/cargo:
	/opt/local/lib/libgit2.1.3.dylib (compatibility version 1.3.0, current version 1.3.0)
	/opt/local/libexec/openssl3/lib/libssl.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/opt/local/libexec/openssl3/lib/libcrypto.3.dylib (compatibility version 3.0.0, current version 3.0.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
	/opt/local/lib/libcurl.4.dylib (compatibility version 13.0.0, current version 13.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1858.112.0)
	/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
	/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)

comment:9 in reply to:  8 Changed 2 years ago by mascguy (Christopher Nielsen)

Replying to neverpanic:

I'm guessing that bootstrap binary would have to be compiled on 10.8 or lower? I don't have a machine this old anymore, so I can't do that, unfortunately.

It may be as simple also also changing openssl.branch in the rust-bootstrap Portfile, but building that requires jemalloc +universal, which doesn't seem to compile on my 12.4 arm64. If I build it -universal, that seems to work fine, though.

I have VMs covering every macOS release from 10.6 through Monterey, so I can test that change on 10.6 through 10.8.

More to follow, once that's done.

Marcus, if you're available to respond... any thoughts/concerns?

comment:10 Changed 2 years ago by mascguy (Christopher Nielsen)

Me thinks this is a bit more complicated, due to the way all of the bootstrapping works.

Let's wait for Marcus' thoughts/guidance.

comment:11 Changed 2 years ago by mascguy (Christopher Nielsen)

It looks like cargo also needs the additional build dep for openssl11, for 10.6 through 10.8. (Same issue with the embedded binary.)

dyld: Library not loaded: /opt/local/libexec/openssl11/lib/libssl.1.1.dylib
  Referenced from: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_cargo/cargo/work/cargo-1.60.0-x86_64-apple-darwin/cargo/bin/cargo
  Reason: image not found

https://ports.macports.org/port/cargo/details/

I'll apply the same fix there, to stop the bleeding.

comment:12 Changed 2 years ago by Christopher Nielsen <mascguy@…>

In cc7d0e7e3cae7b51a8b5cb4ea56438cea8d9c1b1/macports-ports (master):

cargo: add build dep openssl11, for macOS 10.8 and earlier
See: #65468

comment:13 Changed 18 months ago by mascguy (Christopher Nielsen)

Marcus, we made these fixes back 10 months ago, while you were away.

Are they still needed? Or is there a preferred approach? Your thoughts?

Note: See TracTickets for help on using tickets.