Opened 3 years ago

Closed 3 years ago

#63845 closed defect (fixed)

ruby30 fails to build because of openssl 3 even though it is marked portgroup openssl 1.0

Reported by: pmetzger (Perry E. Metzger) Owned by: kimuraw (kimura wataru)
Priority: Normal Milestone:
Component: ports Version:
Keywords: monterey Cc: mascguy (Christopher Nielsen), rtib (Tibor Répási)
Port: ruby30

Description (last modified by pmetzger (Perry E. Metzger))

Although the portfile for ruby30 is marked for portgroup openssl 1.0, for reasons I don't understand, my build on Monterey errors out with loads of errors that refer specifically to openssl3, like

:info:build /opt/local/libexec/openssl3/include/openssl/rsa.h:220:1: note: 'RSA_get0_factors' has been explicitly marked deprecated here

I'm not sure what's going on.

Attachments (1)

main.log (517.1 KB) - added by pmetzger (Perry E. Metzger) 3 years ago.
main.log for the build

Download all attachments as: .zip

Change History (18)

comment:1 Changed 3 years ago by pmetzger (Perry E. Metzger)

Description: modified (diff)

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

Cc: mascguy added

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

I'm seeing plenty of OpenSSL-related deprecation warnings in various ports, but not actual errors.

Which error(s) are you specifically seeing?

comment:4 Changed 3 years ago by pmetzger (Perry E. Metzger)

The error that finally kills the build is:

:info:build ossl_pkey_rsa.c:950:5: error: use of undeclared identifier 'RSA_SSLV23_PADDING'
:info:build     DefRSAConst(SSLV23_PADDING);
:info:build     ^
:info:build ossl_pkey_rsa.c:885:58: note: expanded from macro 'DefRSAConst'
:info:build #define DefRSAConst(x) rb_define_const(cRSA, #x, INT2NUM(RSA_##x))
:info:build                                                          ^
:info:build <scratch space>:60:1: note: expanded from here
:info:build RSA_SSLV23_PADDING
:info:build ^
:info:build 109 warnings and 1 error generated.

comment:5 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: monterey added
Owner: set to kimuraw
Status: newassigned

Please attach the main.log file.

Changed 3 years ago by pmetzger (Perry E. Metzger)

Attachment: main.log added

main.log for the build

comment:6 Changed 3 years ago by pmetzger (Perry E. Metzger)

Attached as requested.

comment:7 Changed 3 years ago by catap (Kirill A. Korinsky)

comment:8 Changed 3 years ago by pmetzger (Perry E. Metzger)

Yes, but given that the portfile specifies the OpenSSL 1.0 portgroup it is mysterious to me that it is trying to use OpenSSL 3 at all.

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

Based on the logs, it appears that the OpenSSL header location isn't being added by the portfile, nor is the library search path being properly set:

CPPFLAGS = -I/opt/local/include -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT

DLDFLAGS = -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -arch x86_64 -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/opt/local/lib -install_name /opt/local/lib/libruby.3.0.dylib -compatibility_version 3.0 -current_version 3.0.2  -fstack-protector-strong -framework Security -framework Foundation  -fstack-protector-strong -framework Security -framework Foundation  -arch x86_64

So the appropriate flags need to be adjusted, to prepend something akin to -I [openssl::include_dir] for the headers, and -L [openssl::lib_dir] for the libs.

There may be a better way, like passing OpenSSL-specific flags for those paths. But that's the general gist.

Last edited 3 years ago by mascguy (Christopher Nielsen) (previous) (diff)

comment:10 in reply to:  8 Changed 3 years ago by jmroot (Joshua Root)

Replying to pmetzger:

Yes, but given that the portfile specifies the OpenSSL 1.0 portgroup it is mysterious to me that it is trying to use OpenSSL 3 at all.

An important detail that may have caused confusion by its omission so far is that ruby30 also sets openssl.branch 1.1.

comment:11 Changed 3 years ago by kimuraw (kimura wataru)

Status: assignedaccepted

it looks pkg-config in ext/openssl/extconf.rb retruns unexpexted results. I'll fix it.

comment:12 Changed 3 years ago by Tatsh (Andrew Udvare)

This also affects ruby27.

comment:13 Changed 3 years ago by pmetzger (Perry E. Metzger)

Presumably it then hits most Rubys.

comment:14 Changed 3 years ago by pmetzger (Perry E. Metzger)

(Or is that Rubies?)

comment:15 Changed 3 years ago by rtib (Tibor Répási)

Cc: rtib added

comment:16 Changed 3 years ago by kimura wataru <kimuraw@…>

In 75cd6c1d0ac37f48a123ef122f6899f3a160e6ee/macports-ports (master):

lang/ruby30 .. ruby24: fix build error at ext/openssl

see #63845

pkg-config in ext/openssl/extconf.rb ignores PKG_CONFIG_PATH.
it leads conflict between openssl-1.1 (from configure args --with-openssl-...)
and openssl-3 (from $prefix/lib/pkgconfig/openssl.pc).

ext/openssl allows compiling without pkgconfig, then commented out pkg_config()
in ext/openssl/extconf.rb.

note: ruby23 or earlier might need same fix.

comment:17 Changed 3 years ago by kimura wataru <kimuraw@…>

Resolution: fixed
Status: acceptedclosed

In 03cd43aa21e6acc47f71dfa1885414e9d3fc1c11/macports-ports (master):

lang/ruby19 .. 23: fix build error or missing openssl.bundle at ext/openssl

closes #63845

keep PKG_CONFIG_PATH in Makefile and use it at running miniruby extconf.rb.

ruby(1.8) does not use pkg-config in ext/openssl when headers and libraries
are found from "--with-openssl-include" and "--with-openssl-lib".

Note: See TracTickets for help on using tickets.