Bug 204402 - emulators/virtualbox-ose: build failed on CURRENT
Summary: emulators/virtualbox-ose: build failed on CURRENT
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Virtualbox Team (Nobody)
Depends on:
Reported: 2015-11-09 16:28 UTC by Oleksandr Kryvulia
Modified: 2021-03-14 17:26 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (vbox)

build log (4.13 KB, text/plain)
2015-11-09 16:28 UTC, Oleksandr Kryvulia
no flags Details
patch to unbreak build on -CURRENT WITH_OPENSSL_PORT (1.70 KB, patch)
2015-12-07 17:24 UTC, Don Lewis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oleksandr Kryvulia 2015-11-09 16:28:45 UTC
Created attachment 162927 [details]
build log

On recent CURRENT r290497 virtualbox build failed with error:

kmk: *** Waiting for unfinished jobs....
/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.32/out/freebsd.amd64/release/bin/VBoxRT.so: undefined reference to `MD2_Final'
/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.32/out/freebsd.amd64/release/bin/VBoxRT.so: undefined reference to `MD2_Update'
/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.32/out/freebsd.amd64/release/bin/VBoxRT.so: undefined reference to `MD2_Init'

Full log attached
Comment 1 Jung-uk Kim freebsd_committer 2015-11-09 18:27:07 UTC
It looks like you're building with non-default SSL.  FYI, OpenSSL in the base does not support MD2.  AFAICT, OpenSSL in the ports tree enables MD2 by default.
Comment 2 Jung-uk Kim freebsd_committer 2015-11-09 18:30:06 UTC
(In reply to Jung-uk Kim from comment #1)
It looks like you're building with non-default SSL.
Comment 3 Oleksandr Kryvulia 2015-11-10 14:23:06 UTC
Yes. It compiles with openssl headers from ports, but links with openssl from base:

===>   virtualbox-ose-4.3.32 depends on file: /usr/local/lib/libcrypto.so.8 - found
Checking for ssl: found version OpenSSL 1.0.2d 9 Jul 2015, OK.
# ldd /usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.32/out/freebsd.amd64/release/bin/VBoxRT.so|grep crypto
        libcrypto.so.8 => /lib/libcrypto.so.8 (0x802200000)

With WITH_OPENSSL_PORT defined it gives me the same result. With WITH_OPENSSL_BASE defined it gives me dependency error (Please deinstall the port or undefine WITH_OPENSSL_BASE).

BTW, it successfully builds after rebuilding port's openssl without MD2, which is enabled by default.
Comment 4 Don Lewis freebsd_committer 2015-12-07 17:24:34 UTC
Created attachment 163945 [details]
patch to unbreak build on -CURRENT WITH_OPENSSL_PORT

This is a somewhat crude patch to unbreak the virtualbox-ose build on FreeBSD 11.0-CURRENT with WITH_OPENSSL_PORT in /etc/make.conf.

Adding -L${OPENSSLDIR}/lib to LIBCRYPTO in configure does not work because strip_l removes it.  If the call to strip_l is removed, then the build fails with:
 kmk: *** No rule to make target `-L/usr/local/lib', needed by `/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.34/out/freebsd.amd64/release/obj/VBoxRT/VBoxRT.so'.  Stop.

Instead, set VBoxRT_LDFLAGS.freebsd to;
  -L${OPENSSLDIR}/lib -Wl,-rpath,${OPENSSLDIR}/lib
so that these flags are used when linking VBoxRT.so and it gets linked to the openssl libraries from the port.
Comment 5 Don Lewis freebsd_committer 2015-12-07 17:25:26 UTC
I ran into this because I have WITH_OPENSSL_PORT=yes in /etc/make.conf.
Comment 6 Tony Narlock 2016-01-19 02:01:38 UTC
(In reply to Don Lewis from comment #5)

Thank you Don,

I can confirm the patch fixes compilation on CURRENT while compiling to work around problems encountered in bug #205643.

❯ freebsd-version -ku; uname -apKU       
FreeBSD z600 11.0-CURRENT FreeBSD 11.0-CURRENT #46: Sun Jan 17 18:00:49 CST 2016     root@z600:/usr/obj/usr/src/sys/MYKERNEL  amd64 amd64 1100094 1100093
Comment 7 Walter Schwarzenfeld freebsd_triage 2018-01-12 11:43:08 UTC
VBox has version 5.2.4. I think it is overcome by events.
Comment 8 Don Lewis freebsd_committer 2018-01-13 00:21:47 UTC
I think this problem is still present.  The port was changed to always use base openssl, and if base is built without openssl, I believe the port build will break, even if openssl from ports is installed.
Comment 9 Walter Schwarzenfeld freebsd_triage 2018-01-13 00:34:57 UTC
Sorry, it is clear. Seems I have not read right.
Did you keep open this PR?
Comment 10 Don Lewis freebsd_committer 2018-01-13 01:20:56 UTC
Yes.  The port Makefile contains:

.if ${SSL_DEFAULT} != base
CONFIGURE_ARGS+=        --with-openssl-dir="${OPENSSLBASE}"

If base is built with either of these options WITHOUT_OPENSSL or WITHOUT_CRYPT (implies WITHOUT_OPENSSL) in /etc/src.conf, then the port will not build even though the user may have install OpenSSL from ports.
Comment 11 Oleksandr Kryvulia 2021-03-14 17:26:57 UTC
Out of date, closed.