Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Oct 2015 01:11:46 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 201132] emulators/virtualbox-ose-additions does not link on FreeBSD10.2 r284791M
Message-ID:  <bug-201132-13-AMNahtwGYn@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-201132-13@https.bugs.freebsd.org/bugzilla/>
References:  <bug-201132-13@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201132

--- Comment #3 from John Hein <z7dr6ut7gs@snkmail.com> ---
Well, I tested that assertion (in comment 1) by just manually calling the
failed cc line that kmk spewed out with c++.

Since that's not really useful for building the port, I dipped my toe into the
inscrutable pool of kBuild and found a couple ways to work around the issue. 
Why someone decided the world needed yet another build system to decipher is
beyond me (despite having read some of the rationale), not to mention why the
virtualbox people chose it.  But I digress... on to the hacking...


(1) hack src/VBox/Additions/x11/VBoxClient/Makefile.kmk to force the linker
command to be c++:

--- src/VBox/Additions/x11/VBoxClient/Makefile.kmk.orig 2015-07-10
14:27:59.000000000 +0000
+++ src/VBox/Additions/x11/VBoxClient/Makefile.kmk      2015-10-15
17:04:01.248043000 +0000
@@ -22,6 +22,7 @@
 # VBoxClient - clipboard and seamless.
 #
 PROGRAMS += VBoxClient
+TOOL_GCC3_LD=c++


This doesn't feel right.  It doesn't work if the kbuild machinery doesn't
pick tools/GCC3.kmk (why / how kBuild selects tools/GCC3.kmk is one of the
inscrutable kBuild mysteries - I had to do a lot of guesswork - the kBuild/kmk
docs are not very helpful).  It doesn't look like the virtualbox kBuild/kmk
infrastructure supports this level of granular configurability very well.



(2) add -lc++ with the change that pulled in -lcxxrt.

--- src/VBox/Additions/x11/VBoxClient/Makefile.kmk.orig 2015-07-10
14:27:59.000000000 +0000
+++ src/VBox/Additions/x11/VBoxClient/Makefile.kmk      2015-10-15
17:07:28.320295000 +0000
@@ -50,7 +50,8 @@
 #      Xtst
 # These are static replacements for gcc-specific parts of libstdc++
 VBoxClient_LIBS += \
-       supc++ \
+       cxxrt \
+       c++ \
        gcc_eh


Just let the link use cc and and -lc++.  This is pretty much all that linking
with c++ (vs. cc) does anyway.  This modification can be directly applied to
emulators/virtualbox-ose/files/extrapatch-src-VBox-Additions-x11-VBoxClient-Makefile.kmk.


Between (1) & (2), both work for building this version of the port on 10.2.

If I were upstream, I'd figure out a way in the kmk infrastructure to support
(1) (or replace kmk with something else).  Linking a c++ program with the c++
compiler (vs. cc) is just more "correct".

For FreeBSD ports, I'd pick (2) at this time.  It's an easy change to an
existing patch, and it is required specifically _because_ of that patch (which
is currently only pulled in if the selected compiler is clang).


Incidentally, I think this doesn't happen with 9.x, for instance, because it
links with libsupc++ rather than libcxxrt.  This does not require pulling in
libstdc++, so linking with c++ is not necessary.  I don't remember exactly when
FreeBSD switched to clang++/libc++/libcxxrt from the gnu equivalents by
default, but maybe that was between 10.1 and 10.2 and that's why it builds on
10.1 - I don't have a 10.1 to test that theory, but I thought 10.1 didn't have
gcc by default, so that wouldn't explain why it builds on 10.1.  Maybe your
10.1 system was built with gcc for the base compiler turned on or make.conf had
a setting to prefer gcc?  I'm completely guessing now, so I'll stop.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-201132-13-AMNahtwGYn>