emulators/virtualbox-ose vs non-base gcc

Andriy Gapon avg at freebsd.org
Tue Jul 6 10:38:21 UTC 2010


on 06/07/2010 11:00 Bernhard Froehlich said the following:
> Thanks for the patch. We are aware of it and I already have it on my todo
> so it will just take some time.

Thank you for the update.
BTW, there is another issue with building VirtualBox using gcc44.

$ VirtualBox
VirtualBox: supR3HardenedMainGetTrustedMain:
dlopen("/usr/local/lib/virtualbox/VirtualBox.so",) failed:
/usr/local/lib/virtualbox/VBoxREM.so: Undefined symbol "atan2l"
zsh: exit 1     VirtualBox

The problem is that base libstdc++ defines atan2l wrapper, but gcc44's libstdc++
doesn't do that, which I believe to be correct, because atan2l is defined in libm:

$ objdump -T /usr/local/lib/virtualbox/VBoxREM.so | fgrep atan2l
0000000000000000      DF *UND*  0000000000000000  GLIBCXX_3.4 atan2l
$ objdump -T /usr/lib/libstdc++.so | fgrep atan2l
00000000000519d0 g    DF .text  0000000000000048  GLIBCXX_3.4 atan2l
$ objdump -T /usr/lib/libm.so | fgrep atan2l
0000000000012230 g    DF .text  000000000000035a  FBSD_1.1    atan2l
$ objdump -T /usr/local/lib/gcc44/libstdc++.so | fgrep atan2l
$

Dependency on atan2l at GLIBCXX_3.4 is recorded because at link time linker uses
/usr/lib/libstdc++.so.  In turn, this happens because /usr/lib is explicitly
specified in link search path (-L) and thus has higher precedence than built-in
path (which includes /usr/local/lib/gcc44 for gcc44).
I think that there is no reason to [explicitly] have /usr/lib (and also
/usr/X11R6/lib) in virtualbox's library search path.

Thus I propose the following patch:
--- Config.kmk.orig	2010-06-25 17:23:52.000000000 +0300
+++ Config.kmk	2010-07-06 13:19:42.295639150 +0300
@@ -2794,8 +2795,6 @@
 	/usr/X11R6/include \
 	/usr/local/include
 TEMPLATE_VBOXR3EXE_LIBPATH            += \
-	/usr/lib \
-	/usr/X11R6/lib \
 	/usr/local/lib
  else ifeq ($(KBUILD_TARGET),solaris)
 TEMPLATE_VBOXR3EXE_TOOL                = GXX3PLAIN
@@ -3236,8 +3235,6 @@
 	/usr/X11R6/include \
 	/usr/local/include
 TEMPLATE_VBOXMAINEXE_LIBPATH            += \
-	/usr/lib \
-	/usr/X11R6/lib \
 	/usr/local/lib
 else ifeq ($(KBUILD_TARGET),solaris)
 TEMPLATE_VBOXMAINEXE_TOOL                = GXX3PLAIN
@@ -3564,8 +3561,6 @@
 	/usr/X11R6/include \
 	/usr/local/include
     TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
-	/usr/lib \
-	/usr/X11R6/lib \
 	/usr/local/lib
    endif
    ifeq ($(KBUILD_TARGET),solaris)
@@ -3747,8 +3742,6 @@
 	/usr/X11R6/include \
 	/usr/local/include
 TEMPLATE_VBOXBLDPROG_LIBPATH            += \
-	/usr/lib \
-	/usr/X11R6/lib \
 	/usr/local/lib
  else ifeq ($(KBUILD_HOST),solaris)
 TEMPLATE_VBOXBLDPROG_TOOL                = GXX3PLAIN


The patch is tested and works.
Perhaps, there is a better way to achieve the same effect for FreeBSD.

-- 
Andriy Gapon


More information about the freebsd-emulation mailing list