Page 1 of 1

Building VirtualBox 4.0.12 on OSX Lion

Posted: 14. Sep 2011, 08:45
by arend
Building VirtualBox 4.0.12 on OSX Lion

Just a quick write-up of how I built 4.0.12 on OSX Lion:

1. Basically follow the build instructions http://www.virtualbox.org/wiki/Mac%20OS ... structions

Note: I installed macports following the instructions before I upgraded to Lion and had no issues with macports after the upgrade

2. You need to patch configure as Lion has kernel version 11.0.0 that is not recognized by 4.0.12 (it is recognized by 4.1.2)

Code: Select all

***************
*** 2059,2064 ****
--- 2059,2071 ----
    test_header "Darwin version"
    darwin_ver=`uname -r`
    case "$darwin_ver" in
+     11\.*)
+       darwin_ver="10.7" # Lion
+       sdk=/Developer/SDKs/MacOSX10.6.sdk
+       CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
+       # We disable the java stuff until Apple make the java stuff downloadable.
+       WITH_JAVA=0
+       ;;
      10\.*)
        darwin_ver="10.6"
        if [ "$BUILD_MACHINE" = "x86" ]; then
I also had to add a references to libz.a and libssl.a for LIBCRYPTO for the openssl test to work

Code: Select all

*** 2260,2266 ****
      --with-openssl-dir=*)
        OPENSSLDIR=`echo $option | cut -d'=' -f2`
        INCCRYPTO="-I${OPENSSLDIR}/include"
!       LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a"
        ;;
      --with-gsoap-dir=*)
        GSOAP=`echo $option | cut -d'=' -f2`
--- 2267,2273 ----
      --with-openssl-dir=*)
        OPENSSLDIR=`echo $option | cut -d'=' -f2`
        INCCRYPTO="-I${OPENSSLDIR}/include"
!       LIBCRYPTO="${OPENSSLDIR}/lib/libcrypto.a ${OPENSSLDIR}/lib/libssl.a ${OPENSSLDIR}/lib/libz.a"
        ;;
      --with-gsoap-dir=*)
        GSOAP=`echo $option | cut -d'=' -f2`
3. Then run configure

./configure --disable-python --disable-java --disable-docs --target-arch=amd64

Note: I had problems with the --with-openssl-dir=<...> flag. I used --with-openssl-dir=/opt/local and it resulted in an unresolved symbol as a wrong header file got pulled in due to this option (http://forums.virtualbox.org/viewtopic.php?f=10&t=44542 http://comments.gmane.org/gmane.comp.em ... devel/4553)

4. . ./env.sh [I did not need a LocalConfig.kmk]

5. kmk

6. As I built the 'hardened' version the easiest way to deal with file location and permission issues is to package everything up. Unfortunately the packaging requires an old version of PackageManager that shipped with xcode 2.4.1 (found that out from Chris from the Oracle development team). This package manager does not run on Lion as it does not find some libraries it needs.

So I copied the entire build tree into the same directory location that it had on my Lion system onto my 32-bit Snow Leopard system and ran

7. . ./env.sh

8. kmk packing j=1

which ran through and built the package