Bug 254295 - emulators/virtualbox-ose will not upgrade from 5.2.44_4 to 6.1.18 due to "compiler error"
Summary: emulators/virtualbox-ose will not upgrade from 5.2.44_4 to 6.1.18 due to "com...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Virtualbox Team (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-15 03:55 UTC by russo
Modified: 2021-04-11 15:19 UTC (History)
4 users (show)

See Also:
madpilot: maintainer-feedback+
madpilot: merge-quarterly+


Attachments
Poudriere build log (82.92 KB, application/gzip)
2021-03-28 18:51 UTC, Bengt Ahlgren
no flags Details
Build fix for using ports provided SSL library (1.00 KB, patch)
2021-03-30 08:02 UTC, Guido Falsi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description russo 2021-03-15 03:55:14 UTC
Uname:
   FreeBSD xxxx.org 11.4-STABLE FreeBSD 11.4-STABLE #0 stable/11-n215696-62607e8680e: Tue Feb 16 19:28:06 MST 2021     xxxxx@xxxxx.org:/usr/obj/usr/src/sys/GENERIC  amd64

My current install shows:
```
# pkg info virtualbox-ose
virtualbox-ose-5.2.44_4
Name           : virtualbox-ose
Version        : 5.2.44_4
Installed on   : Sat Oct 17 11:17:33 2020 MDT
Origin         : emulators/virtualbox-ose
Architecture   : FreeBSD:11:amd64
Prefix         : /usr/local
Categories     : emulators
Licenses       : GPLv2
Maintainer     : vbox@FreeBSD.org
WWW            : https://www.virtualbox.org/
Comment        : General-purpose full virtualizer for x86 hardware
Options        :
        ALSA           : off
        DBUS           : on
        DEBUG          : off
        GUESTADDITIONS : on
        MANUAL         : off
        NLS            : on
        PULSEAUDIO     : off
        PYTHON         : off
        QT5            : on
        R0LOGGING      : off
        UDPTUNNEL      : on
        VDE            : off
        VNC            : on
        VPX            : off
        WEBSERVICE     : on
        X11            : on
[...]
```

Trying to portupgrade virtualbox-ose from previous version (5.2.44_4) to latest (6.1.18), get a "New compiler error":

```
kBuild: Linking VBoxDTrace
ld: error: undefined symbol: OPENSSL_init_ssl
>>> referenced by tcp.c:314 (src/VBox/RDP/client-1.8.4/tcp.c:314)
>>>               /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/tcp.o:(tcp_tls_connect)
>>> referenced by tcp.c:315 (src/VBox/RDP/client-1.8.4/tcp.c:315)
>>>               /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/tcp.o:(tcp_tls_connect)

ld: error: undefined symbol: SSL_CTX_set_options
>>> referenced by tcp.c:345 (src/VBox/RDP/client-1.8.4/tcp.c:345)
>>>               /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/tcp.o:(tcp_tls_connect)

ld: error: undefined symbol: X509_get_X509_PUBKEY
>>> referenced by ssl.c:198 (src/VBox/RDP/client-1.8.4/ssl.c:198)
>>>               /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/ssl.o:(rdssl_cert_to_rkey)

ld: error: undefined symbol: RSA_get0_key
>>> referenced by ssl.c:279 (src/VBox/RDP/client-1.8.4/ssl.c:279)
>>>               /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/ssl.o:(rdssl_rkey_get_exp_mod)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
kmk: *** [/usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/rdesktop-vrdp] Error 1
The failing command:
        @/usr/local/bin/clang++11                     '-Wl,-rpath,/usr/local/lib/virtualbox'  -Wl,-z,noexecstack,-z,relro -Wl,--as-needed -m64   -o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/rdesktop-vrdp /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/tcp.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/asn.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/iso.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/mcs.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/secure.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/licence.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/rdp.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/orders.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/bitmap.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/cache.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/rdp5.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/channels.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/rdpdr.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/serial.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/printer.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/disk.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/parallel.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/printercache.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/mppc.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/pstcache.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/lspci.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/seamless.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/ssl.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/utils.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/rdesktop.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/xwin.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/xkeymap.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/ewmhints.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/xclip.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/cliprdr.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/ctrl.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/rdpsnd.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/rdpsnd_dsp.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/obj/rdesktop-vrdp/rdpsnd_oss.o   -L/usr/lib  -L/usr/local  -L/usr/local/lib   -liconv   -lX11   /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.18/out/freebsd.amd64/release/bin/VBoxRT.so   -lpthread   -lssl   -lcrypto 
kmk: *** Waiting for unfinished jobs....
USBIdDatabaseGenerator: info: Total 378934 bytes - saving 29% (161311 bytes); old version 717755 bytes + relocs (47% save)
kmk: *** Exiting with status 2
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/emulators/virtualbox-ose
*** Error code 1
Stop.
make: stopped in /usr/ports/emulators/virtualbox-ose
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade20210314-30205-xzyoap env UPGRADE_TOOL=portupgrade UPGRADE_PORT=virtualbox-ose-5.2.44_4 UPGRADE_PORT_VER=5.2.44_4 make
** Fix the problem and try again.
** Listing the failed packages (-:ignored / *:skipped / !:failed)
        ! emulators/virtualbox-ose (virtualbox-ose-5.2.44_4)    (new compiler error)

```



I have NOT tried to uninstall virtualbox-ose and install from scratch, which is often the fix for things like this.  I understand that it is possible to install a "legacy" version, and if necessary will simply do that, but for now I'll simply not upgrade and leave it at the existing install.
Comment 1 russo 2021-03-15 03:58:06 UTC
And for what it's worth, I do have openssl installed:

> pkg info | grep openssl
openssl-1.1.1j_1,1             TLSv1.3 capable SSL and crypto library
py37-openssl-20.0.1            Python interface to the OpenSSL library


> pkg info openssl
openssl-1.1.1j_1,1
Name           : openssl
Version        : 1.1.1j_1,1
Installed on   : Sun Feb 21 11:14:44 2021 MST
Origin         : security/openssl
Architecture   : FreeBSD:11:amd64
Prefix         : /usr/local
Categories     : security devel
Licenses       : OpenSSL
Maintainer     : brnrd@FreeBSD.org
WWW            : https://www.openssl.org/
Comment        : TLSv1.3 capable SSL and crypto library
Options        :
        ARIA           : off
        ASM            : off
        ASYNC          : on
        CT             : on
        DES            : on
        EC             : on
        GOST           : on
        IDEA           : off
        MAN3           : on
        MD2            : on
        MD4            : on
        MDC2           : off
        NEXTPROTONEG   : on
        RC2            : on
        RC4            : on
        RC5            : off
        RFC3779        : off
        RMD160         : on
        SCTP           : on
        SHARED         : on
        SM2            : off
        SM3            : off
        SM4            : off
        SSE2           : on
        SSL3           : on
        THREADS        : on
        TLS1           : on
        TLS1_1         : on
        TLS1_2         : on
        WEAK-SSL-CIPHERS: off
        ZLIB           : off
...
Comment 2 Bengt Ahlgren 2021-03-28 18:51:58 UTC
Created attachment 223670 [details]
Poudriere build log

I have the same issue.  A look at the poudriere log shows that the problem is that the linker fails to pick up the openssl library from ports, but instead tries to link with the old openssl in base because -L /usr/lib is before -L /usr/local/lib in the linker arguments.

I'm also on 11.4, where DEFAULT_VERSIONS+= ssl=openssl is needed.
Comment 3 russo 2021-03-28 18:54:24 UTC
Nice.  I should have mentioned that I, too, have DEFAULT_VERSIONS+=ssl=openssl
 in my /etc/make.conf.

If it's just a matter of the -Ls being in an unfortunate order, then perhaps this is an easy fix.
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2021-03-28 19:35:10 UTC
Unluckily nothing about virtualbox build process is "simple" or "easy".

Their makefiles are quite complicated and finding where such options are defined and order is imposed is difficult.

I'm taking a look but it is far from obvious how to fix this.
Comment 5 Guido Falsi freebsd_committer freebsd_triage 2021-03-28 20:00:57 UTC
Interesting, looking at the log file what is failing id the rdesktop client. Not even sure what it is used for in the client (The RDP protocol should not be included in the open source edition).

We do have VNC, maybe it's related to that, you could try compiling with VNC disabled, but I don't think it will help.

I'm looking at a patch, but I need time to test it a little.
Comment 6 Guido Falsi freebsd_committer freebsd_triage 2021-03-30 08:02:25 UTC
Created attachment 223705 [details]
Build fix for using ports provided SSL library

I've attached a simple patch which changes the order of -L compiler options for the relevant part of the build.

Can you test this and report back?

Thanks!
Comment 7 Chad Jacob Milios 2021-04-09 20:33:52 UTC
that patch #223705 as is did not work for me. I still got the same errors of the missing ssl symbols. I confirmed that the patch did indeed influence the order of -L flags in the build's failing command.

then I modified the aforementioned patch, replacing $(VBOX_LIBPATH_X11) in the + line with $(VBOX_LIBPATH_X11)/lib and I successfully built virtualbox-ose-6.1.18 with all the options I like and ssl=openssl
Comment 8 Guido Falsi freebsd_committer freebsd_triage 2021-04-09 20:42:37 UTC
(In reply to Chad Jacob Milios from comment #7)

Thanks for testing and suggesting the correct fix. I'm going to test your suggestion.

Thanks again.
Comment 9 Guido Falsi freebsd_committer freebsd_triage 2021-04-11 13:27:58 UTC
Once I have committed this I plan to merge to quarterly branch.
Comment 10 commit-hook freebsd_committer freebsd_triage 2021-04-11 14:57:43 UTC
A commit in branch main references this bug:

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

commit 423f3dfd755f7c98bf2d28083aac19783cf4e9a6
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2021-04-11 14:55:35 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2021-04-11 14:55:35 +0000

    emulators/virtualbox-ose: Fix build with ports provided SSL library on 11.x

    Due to a compiler/linker command line ordering issue, VirtualBox 6
    fails to compile on 11.x when a ports provided SSL library is
    used.

    Fix the order of -L options passed to the linker where the ssl
    library is used.

    Thanks to  Chad Jacob Milios <milios@ccsys.com> for suggesting the
    correct fix.

    PR:             254295
    Submitted by:   russo@bogodyn.org
    MFH:            2021Q2

 .../patch-src_VBox_RDP_client-1.8.4_Makefile.kmk (new)      | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Comment 11 commit-hook freebsd_committer freebsd_triage 2021-04-11 15:08:46 UTC
A commit in branch 2021Q2 references this bug:

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

commit 5d54155d9f447a031acb89ee5ba038bf8520d368
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2021-04-11 14:55:35 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2021-04-11 15:08:10 +0000

    emulators/virtualbox-ose: Fix build with ports provided SSL library on 11.x

    Due to a compiler/linker command line ordering issue, VirtualBox 6
    fails to compile on 11.x when a ports provided SSL library is
    used.

    Fix the order of -L options passed to the linker where the ssl
    library is used.

    Thanks to  Chad Jacob Milios <milios@ccsys.com> for suggesting the
    correct fix.

    PR:             254295
    Submitted by:   russo@bogodyn.org
    MFH:            2021Q2

    (cherry picked from commit 423f3dfd755f7c98bf2d28083aac19783cf4e9a6)

 .../patch-src_VBox_RDP_client-1.8.4_Makefile.kmk (new)      | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Comment 12 Guido Falsi freebsd_committer freebsd_triage 2021-04-11 15:19:54 UTC
Fix committed and merged to quarterly. Thanks!