VirtualBox 4.3.6 + FreeBSD 10 + clang, [SUCCESS]

Bernhard Fröhlich decke at
Sat Jan 11 21:09:46 UTC 2014

Am 11.01.2014 03:49 schrieb "Craig Rodrigues" <rodrigc at>:
> Hi,
> I had problems with the virtualbox-ose-4.22 port
> under FreeBSD 10.0-RC5, where VirtualBox would occasionally
> crash.
> It looks like the mix of QT C++ libraries compiled with clang,
> vs. the virtualbox-ose port compiled with g++46 was not a good mix

I still think that this is a problem that needs to be fixed in Qt or even
better in our ports tree. The decision to compile parts of the portstree
with the base compiler and other parts with various compilers from ports is
what causes all this issues. Hacking virtualbox cures the symptoms but does
not fix the cause.

> After reading this post:
> I obtained Jung-uk Kim's port Makefiles for VirtualBox and
> I managed to compile a build of VirtualBox 4.3.6 on my system which is not
> crashing.
> This is what I did:
> (1)   Delete the virtualbox-ose port from my system:
> pkg delete virtualbox-ose
> pkg delete virtualbox-ose-kmod
> (2)   Delete the gsoap port from my system
> pkg delete gsoap
> (3)  Make sure that a valid FreeBSD src tree exists under /usr/src,
>       the build will fail.
> (4)  Check out jkim's tree from redports:
> mkdir -p /tmp/xy
> cd /tmp/xy
> svn co
> (5)   Build and install gsoap from jkim's port (you need to do this
because the version of gsoap in the ports tree will result in failed
> cd /tmp/xy/jkim/devel/gsoap
> make
> make install

Really? From what I was told the current gsoap should work fine with the
patch that he included for the new gsoap in his tree.

> (6)  Build and install virtualbox-ose and virtualbox-ose-kmod ports.
> cd /tmp/xy/jkim/emulators/virtualbox-ose
> make
> make install
> cd /tmp/xy/jkim/emulators/virtualbox-ose-kmod
> make
> make install

That is the wrong order. You need to install kmod first or virtualbox will
pull in kmod from the portstree in /usr/ports.

> After doing this, I got a build of VirtualBox that:
>     -> built against clang, does not depend on g++ libraries
>     -> no need to unset QT_PLUGIN_PATH
>     -> works and doesn't crash :)
> Thank you for doing this Jung-uk, it was quite a lot of work
> to port VirtualBox to clang!

I still think this is the wrong approach and I won't maintain all those
clang patches in the official port. The problem that I see is that we are
diverging from upstream vbox too much and end up maintaining a very special
usecase and a few dozen patches on our own. We would be the only one to
build with clang so with every release we need to update our patches and
add more to keep it building with clang. This will need someone that want's
to do it for the next few years.

Since the beginning of vbox on FreeBSD we tried to stay close to upstream
sources and push patches to upstream first. This has worked good for us and
has created a good relationship to them.

So we have 3 options:

- I step down and wish you all the best. There are a few smart people
working on vbox now so it should not be an issue for the project.

- Someone clones the vbox ports and maintains the clang version in the

- We try to push as many patches upstream and nag them until they accept
them. This might also interest some Mac OS X people.

I will talk to the vbox developers to find out what they think of clang and
if someone is working on updating the recompiler from qemu which would make
a full clang build possible.

More information about the freebsd-ports mailing list