Bug 258182 - devel/gsoap: fail to link with emulators/virtualbox-ose when libressl used
Summary: devel/gsoap: fail to link with emulators/virtualbox-ose when libressl used
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: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-31 11:10 UTC by Ivan Rozhuk
Modified: 2021-09-29 17:23 UTC (History)
6 users (show)

See Also:
felix: maintainer-feedback? (bofh)


Attachments
remove old libressl changes (8.85 KB, patch)
2021-09-01 16:04 UTC, Felix Palmen
felix: maintainer-approval?
Details | Diff
add ssl path to CFLAGS and LDFLAGS (1019 bytes, patch)
2021-09-01 16:07 UTC, Felix Palmen
no flags Details | Diff
add ssl path to CFLAGS and LDFLAGS (2.8.117) (1015 bytes, patch)
2021-09-29 12:51 UTC, Felix Palmen
felix: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2021-08-31 11:10:20 UTC
I try to build latest pots, emulators/virtualbox-ose fail to link:
kBuild: Installing VBoxAPIWrap => /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/lib/VBoxAPIWrap.a
kBuild: Linking VBoxC
kBuild: Linking VBoxSVC
kBuild: Installing VBoxC => /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/bin/components/VBoxC.so
kBuild: Installing VBoxSVC => /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/bin/VBoxSVC
kBuild: Installing vboxsoap => /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/lib/vboxsoap.a
kBuild: Linking vboxwebsrv
kBuild: Linking webtest
ld: error: undefined symbol: SSL_is_init_finished
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a

ld: error: undefined symbol: OPENSSL_sk_pop_free
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a

ld: error: undefined symbol: OPENSSL_sk_num
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a

ld: error: undefined symbol: OPENSSL_sk_value
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a

ld: error: undefined symbol: SSL_CTX_set_options
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(ssl_auth_init(soap*)) in archive /usr/local/lib/libgsoapssl++.a
c++: error: linker command failed with exit code 1 (use -v to see invocation)
kmk: *** [/tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/webtest/webtest] Error 1
The failing command:
	@c++                     '-Wl,-rpath,/usr/local/lib/virtualbox'  -Wl,-z,noexecstack,-z,relro -Wl,--as-needed -m64   -o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/webtest/webtest /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/webtest/webtest.o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/webtest/gen/webservice/soapClient.o   -L/usr/local/lib   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/lib/vboxsoap.a   -lgsoapssl++   -lz   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/bin/VBoxRT.so   -lpthread   -lssl   -lcrypto 
kmk: *** Waiting for unfinished jobs....
ld: error: undefined symbol: SSL_is_init_finished
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a

ld: error: undefined symbol: OPENSSL_sk_pop_free
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a

ld: error: undefined symbol: OPENSSL_sk_num
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a

ld: error: undefined symbol: OPENSSL_sk_value
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(tcp_connect(soap*, char const*, char const*, int)) in archive /usr/local/lib/libgsoapssl++.a

ld: error: undefined symbol: SSL_CTX_set_options
>>> referenced by stdsoap2_ssl_cpp.cpp
>>>               libgsoapssl___a-stdsoap2_ssl_cpp.o:(ssl_auth_init(soap*)) in archive /usr/local/lib/libgsoapssl++.a
c++: error: linker command failed with exit code 1 (use -v to see invocation)
kmk: *** [/tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/vboxwebsrv] Error 1
The failing command:
	@c++                     '-Wl,-rpath,/usr/local/lib/virtualbox'  -Wl,-z,noexecstack,-z,relro -Wl,--as-needed -m64   -o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/vboxwebsrv /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/vboxweb.o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/gen/webservice/methodmaps.o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/gen/webservice/soapServer.o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/gen/webservice/vboxweb-wsdl.o   -L/usr/local/lib   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/lib/vboxsoap.a   -lgsoapssl++   -lz   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/bin/VBoxRT.so   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/bin/VBoxRT.so   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/lib/VBoxCOM.a   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/bin/VBoxXPCOM.so   -lssl   -lcrypto 
kmk: *** Exiting with status 2
*** Error code 2
Comment 1 Ivan Rozhuk 2021-08-31 12:09:57 UTC
Then gsoap rebuilded with GNUTLS and reinstalled got error:

ld: error: undefined symbol: soap_ssl_accept
>>> referenced by vboxweb.cpp:627 (src/VBox/Main/webservice/vboxweb.cpp:627)
>>>               /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/vboxweb.o:(SoapThread::process())

ld: error: undefined symbol: soap_ssl_init
>>> referenced by vboxweb.cpp:1268 (src/VBox/Main/webservice/vboxweb.cpp:1268)
>>>               /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/vboxweb.o:(main)

ld: error: undefined symbol: soap_ssl_server_context
>>> referenced by vboxweb.cpp:892 (src/VBox/Main/webservice/vboxweb.cpp:892)
>>>               /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/vboxweb.o:(doQueuesLoop())
c++: error: linker command failed with exit code 1 (use -v to see invocation)
kmk: *** [/tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/vboxwebsrv] Error 1
The failing command:
	@c++                     '-Wl,-rpath,/usr/local/lib/virtualbox'  -Wl,-z,noexecstack,-z,relro -Wl,--as-needed -m64   -o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/vboxwebsrv /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/vboxweb.o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/gen/webservice/methodmaps.o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/gen/webservice/soapServer.o /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/obj/vboxwebsrv/gen/webservice/vboxweb-wsdl.o   -L/usr/local/lib   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/lib/vboxsoap.a   -lgsoapssl++   -lz   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/bin/VBoxRT.so   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/bin/VBoxRT.so   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/lib/VBoxCOM.a   /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.26/out/freebsd.amd64/release/bin/VBoxXPCOM.so   -lssl   -lcrypto 
kmk: *** Waiting for unfinished jobs....
Comment 2 Felix Palmen 2021-09-01 16:04:11 UTC
Created attachment 227592 [details]
remove old libressl changes
Comment 3 Felix Palmen 2021-09-01 16:07:00 UTC
Created attachment 227593 [details]
add ssl path to CFLAGS and LDFLAGS

It seems the culprit is that it was always building against the base OpenSSL.

I am not sure why this happened and whether my fix is correct, but I'm attaching two patches that solve the problem for me.

The first is optional, it just removes old libressl-related changes that I think are not needed any more.

The second one explicitly adds -I${OPENSSLINC} to CFLAGS and -L${OPENSSLLIB} to LDFLAGS to ensure the correct SSL flavor is used (and bumps port revision).

Both patches can be applied with `git am`.
Comment 4 Ivan Rozhuk 2021-09-06 18:19:15 UTC
Apply both patches, deinstall gsoap and vbox build without errors.
Comment 5 Felix Palmen 2021-09-29 12:51:37 UTC
Created attachment 228246 [details]
add ssl path to CFLAGS and LDFLAGS (2.8.117)

The problem persists in 2.8.117, had to rebase the relevant patch to this new version.

Note I assume that a similar problem would arise for users of OpenSSL from ports.

Please review my changes, maybe suggest a better approach?
Comment 6 Muhammad Moinur Rahman freebsd_committer 2021-09-29 13:29:09 UTC
Sorry am not sure why this doesn't showup in My Bugs and I updated without seeing this. Will update again soonish.
Comment 7 commit-hook freebsd_committer 2021-09-29 17:21:13 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ab1c2c47aba883c63f6763fbee1d9a1bf86ed2a0

commit ab1c2c47aba883c63f6763fbee1d9a1bf86ed2a0
Author:     Felix Palmen <felix@palmen-it.de>
AuthorDate: 2021-09-29 17:17:24 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2021-09-29 17:18:58 +0000

    devel/gsoap: Add SSL path to CFLAGS and LDFLAGS

    - Remove old libressl-related changes

    PR: 258182
    Reported by: rozhuk.im@gmail.com

 devel/gsoap/Makefile                               |  4 +-
 ...ualStudio2005_wsdl2h_wsdl2h_stdsoap2.cpp (gone) | 20 ---------
 .../gsoap/files/patch-gsoap_plugin_mecevp.c (gone) | 20 ---------
 .../gsoap/files/patch-gsoap_plugin_smdevp.c (gone) | 47 ----------------------
 ...s_calc__vs2005_calc__vs2005_stdsoap2.cpp (gone) | 20 ---------
 devel/gsoap/files/patch-gsoap_stdsoap2.c           | 18 ---------
 devel/gsoap/files/patch-gsoap_stdsoap2.cpp         | 18 ---------
 7 files changed, 3 insertions(+), 144 deletions(-)