Page 1 of 5

Build Virtualbox from source

Posted: 24. Nov 2012, 21:04
by noteirak
My goal is to build Virtualbox from the source to see if https://www.virtualbox.org/ticket/11232 is still happening doing my build from the source of 4.2.4 or in the SVN directly.

My main goal is to have the XPCOM & WebServices Java binding.

When trying to build, I get these errors :

Code: Select all

kBuild: Compiling VBoxJXpcom - /root/VirtualBox-4.2.4/src/libs/xpcom18a4/java/src/nsJavaWrapper.cpp
In file included from /root/VirtualBox-4.2.4/src/libs/xpcom18a4/java/src/nsJavaWrapper.cpp:37:0:
/root/VirtualBox-4.2.4/src/libs/xpcom18a4/java/src/nsJavaInterfaces.h:40:17: fatal error: jni.h: No such file or directory
In file included from /root/VirtualBox-4.2.4/src/libs/xpcom18a4/java/src/nsAppFileLocProviderProxy.cpp:38:0:
/root/VirtualBox-4.2.4/src/libs/xpcom18a4/java/src/nsAppFileLocProviderProxy.h:42:17: fatal error: jni.h: No such file or directory
compilation terminated.
compilation terminated.
kmk: *** [/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/src/nsJavaWrapper.o] Error 1
The failing command:
@g++ -c -O2 -g -pipe -ansi -Wall -Wno-unused -Wno-non-virtual-dtor -Wno-invalid-offsetof -Wno-sign-compare -Wno-unused -Wno-ctor-dtor-privacy -fvisibility-inlines-hidden -fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN -DRT_USE_VISIBILITY_DEFAULT -fdiagnostics-show-option -Wno-delete-non-virtual-dtor -fPIC -Wno-write-strings -O -pthread -m64 -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/java/src -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/glue -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/build -I/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/vboxjxpcom-gen/jdest -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/build -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/ds -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/io -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/base -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/components -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/threads -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/proxy/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/reflect/xptcall/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/client/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/shared/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/extensions/lock/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include/nsprpub -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include/string -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include/xpcom -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include/ipcd -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/java -I/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/dtrace -I/root/VirtualBox-4.2.4/include -I/root/VirtualBox-4.2.4/out/linux.amd64/release -DVBOX -DVBOX_WITH_DEBUGGER -DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DRT_OS_LINUX -D_FILE_OFFSET_BITS=64 -DRT_ARCH_AMD64 -D__AMD64__ -DMOZILLA_CLIENT=1 -DNDEBUG=1 -D_IMPL_NS_COM -DXPCOM_DLL_BASE=\"VBoxXPCOM\" -DMOZ_DLL_SUFFIX=\".so\" -DIN_RING3 -DVBOX_USE_IPRT_IN_XPCOM -DVBOX_WITH_XPCOM_NAMESPACE_CLEANUP -DMOZ_PRESERVE_PIC -DEXPORT_XPTI_API -DEXPORT_XPT_API -DVBOX_WITH_XPCOM -DOSTYPE=\"Linux2.6\" -DOSARCH=\"Linux\" -DXP_UNIX=1 -D_GNU_SOURCE -DHAVE_VISIBILITY_ATTRIBUTE=1 -DHAVE_VA_LIST_AS_ARRAY -DHAVE_VA_COPY -DVA_COPY\(a\,b\)=__builtin_va_copy\(a\,b\) -Wp,-MD,/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/src/nsJavaWrapper.o.dep -Wp,-MT,/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/src/nsJavaWrapper.o -Wp,-MP -o /root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/src/nsJavaWrapper.o /root/VirtualBox-4.2.4/src/libs/xpcom18a4/java/src/nsJavaWrapper.cpp
kmk: *** Waiting for unfinished jobs....
kmk: *** [/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/src/nsAppFileLocProviderProxy.o] Error 1
The failing command:
@g++ -c -O2 -g -pipe -ansi -Wall -Wno-unused -Wno-non-virtual-dtor -Wno-invalid-offsetof -Wno-sign-compare -Wno-unused -Wno-ctor-dtor-privacy -fvisibility-inlines-hidden -fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN -DRT_USE_VISIBILITY_DEFAULT -fdiagnostics-show-option -Wno-delete-non-virtual-dtor -fPIC -Wno-write-strings -O -pthread -m64 -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/java/src -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/glue -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/build -I/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/vboxjxpcom-gen/jdest -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/build -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/ds -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/io -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/base -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/components -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/threads -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/proxy/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/xpcom/reflect/xptcall/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/client/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/shared/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/extensions/lock/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include/nsprpub -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include/string -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include/xpcom -I/root/VirtualBox-4.2.4/out/linux.amd64/release/bin/sdk/bindings/xpcom/include/ipcd -I/root/VirtualBox-4.2.4/src/libs/xpcom18a4/java -I/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/dtrace -I/root/VirtualBox-4.2.4/include -I/root/VirtualBox-4.2.4/out/linux.amd64/release -DVBOX -DVBOX_WITH_DEBUGGER -DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DRT_OS_LINUX -D_FILE_OFFSET_BITS=64 -DRT_ARCH_AMD64 -D__AMD64__ -DMOZILLA_CLIENT=1 -DNDEBUG=1 -D_IMPL_NS_COM -DXPCOM_DLL_BASE=\"VBoxXPCOM\" -DMOZ_DLL_SUFFIX=\".so\" -DIN_RING3 -DVBOX_USE_IPRT_IN_XPCOM -DVBOX_WITH_XPCOM_NAMESPACE_CLEANUP -DMOZ_PRESERVE_PIC -DEXPORT_XPTI_API -DEXPORT_XPT_API -DVBOX_WITH_XPCOM -DOSTYPE=\"Linux2.6\" -DOSARCH=\"Linux\" -DXP_UNIX=1 -D_GNU_SOURCE -DHAVE_VISIBILITY_ATTRIBUTE=1 -DHAVE_VA_LIST_AS_ARRAY -DHAVE_VA_COPY -DVA_COPY\(a\,b\)=__builtin_va_copy\(a\,b\) -Wp,-MD,/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/src/nsAppFileLocProviderProxy.o.dep -Wp,-MT,/root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/src/nsAppFileLocProviderProxy.o -Wp,-MP -o /root/VirtualBox-4.2.4/out/linux.amd64/release/obj/VBoxJXpcom/src/nsAppFileLocProviderProxy.o /root/VirtualBox-4.2.4/src/libs/xpcom18a4/java/src/nsAppFileLocProviderProxy.cpp
kmk: *** Exiting with status 2
root@debian:~/VirtualBox-4.2.4# 
JDK is installed:

Code: Select all

root@debian:~/VirtualBox-4.2.4# java -version
java version "1.7.0_03"
OpenJDK Runtime Environment (IcedTea7 2.1.3) (7u3-2.1.3-1)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode) 
JNI is located here :

Code: Select all

root@debian:~/VirtualBox-4.2.4# find / -name jni.h
/usr/lib/jvm/java-7-openjdk-amd64/include/jni.h
What config am I missing? Thank you

Re: Build Virtualbox from source

Posted: 24. Nov 2012, 21:19
by Perryg
You can get some idea of the real depends by looking here. viewforum.php?f=31

If you only want to build the developer version then you do not need to pack since this creates the complete ready for distribution version.

PS there are two new depends that are not listed anywhere and you can see them here. viewtopic.php?f=31&t=52330

Remember that the LocalConfig.kmk is your friend, and if you do not want to build certain features you include some in the ./configure line and some in the LocalCOnfig.kmk

Last tip. VirtualBox is hard coded to see java as real sun/oracle jave. You need to place the path to your version in the LocalConfig.kmk

Re: Build Virtualbox from source

Posted: 24. Nov 2012, 21:34
by noteirak
Perryg wrote:You can get some idea of the real depends by looking here. viewforum.php?f=31
I did, but there was no precise information on how to deal with the Java bindings AFAIK. Might have looked wrong too
Perryg wrote:If you only want to build the developer version then you do not need to pack since this creates the complete ready for distribution version.
I do need a complete ready distribution version - if my problem is solved using the build, I will install it on my servers.
Perryg wrote:PS there are two new depends that are not listed anywhere and you can see them here. viewtopic.php?f=31&t=52330
libdevmapper-dev I have already installed, seen your post already
openwatcom is not listed for me :

Code: Select all

root@debian:~/VirtualBox-4.2.4# apt-cache search watcom
root@debian:~/VirtualBox-4.2.4#

Code: Select all

root@debian:~/VirtualBox-4.2.4# apt-cache search openwatcom
root@debian:~/VirtualBox-4.2.4#
my sources.lst :

Code: Select all

root@debian:~/VirtualBox-4.2.4# cat /etc/apt/sources.list
deb http://mirror.ovh.net/debian/ testing main
deb-src http://mirror.ovh.net/debian/ testing main

deb http://security.debian.org/ testing/updates main
deb-src http://security.debian.org/ testing/updates main
Perryg wrote:Remember that the LocalConfig.kmk is your friend, and if you do not want to build certain features you include some in the ./configure line and some in the LocalCOnfig.kmk
Might be a crazy thing to say, but I actually do want everything to be build.
Perryg wrote:Last tip. VirtualBox is hard coded to see java as real sun/oracle jave. You need to place the path to your version in the LocalConfig.kmk
Thank you for the tip, that wasn't documented anywhere. I will give it a try and post back my results.

Re: Build Virtualbox from source

Posted: 24. Nov 2012, 21:47
by noteirak
noteirak wrote:
Perryg wrote:Last tip. VirtualBox is hard coded to see java as real sun/oracle jave. You need to place the path to your version in the LocalConfig.kmk
Thank you for the tip, that wasn't documented anywhere. I will give it a try and post back my results.
No LocalConfig.kmk, which I assume needs to be created with only the options to overwride from the Config.kmk or AutoConfig.kmk

I've tried to review these two, Config.kmk is more than 5k lines long.... Tried to read the few hundreads but nothing for Java. Any tip on which variable to actually set?

Re: Build Virtualbox from source

Posted: 24. Nov 2012, 22:30
by noteirak
LocalConfig.kmk is in the folder debian
the variable is VBOX_JAVA_HOME

Re: Build Virtualbox from source

Posted: 24. Nov 2012, 23:15
by Perryg
Yes you create the LocalConfig.kmk in the top level of you build. Here is a partial example of one on my build boxes so you can get an idea.

Code: Select all

VBOX_JAVA_HOME := /usr/lib/jvm/java-6-openjdk-amd64
VBOX_WITH_WARNINGS_AS_ERRORS := 
VBOX_WITH_DOCS_TRANSLATIONS := 
VBOX_WITH_DOCS_SDKREF := 1
VBOX_WITH_WEBSERVICES := 1
VBOX_WITH_WEBSERVICES_SSL := 
VBOX_WITH_TESTCASES := 
VBOX_WITH_TESTSUITE := 
VBOX_WITH_UDPTUNNEL := 
VBOX_WITH_VDE := 
VBOX_WITH_EXTPACK_VNC := 1
Blank space turns it off (disables) and 1 turns it on (enable)

Re: Build Virtualbox from source

Posted: 24. Nov 2012, 23:21
by Perryg
Here in a little bit I am going to move this topic to the VirtualBox OSE section since this really has to do with building VirtualBox. (OSE)

Re: Build Virtualbox from source

Posted: 24. Nov 2012, 23:27
by noteirak
Thank you - I must say that this definitly requires more doc... It is simply impossible to do this on your own the first time unless you get support, even reading all the docs.
Currently building with your options...

I've tried to do kmk docs -> got some LaTeX error, so I am gonna ask you directly : Is there a switch or options to make it so only the java bindings are created and not the whole build?

Re: Build Virtualbox from source

Posted: 24. Nov 2012, 23:51
by Perryg
The DOC issue is probably because you don't have texlive-full (debian) installed. You can install just the texlive but will be missing the bara font that needs to be installed to build.

As for just the java bindings I am not sure what you are getting at. That probably is not what you want to do.

If you do not want to build the DOCs you can add the following to the LocalConfig.kmk:

Code: Select all

VBOX_WITH_DOCS := 
On one more thing. During the build if you encounter errors and need to start over after you have added or changed the build parameters. you probably will want to delete the out folder. I have seen corruption at time when starting over.

Re: Build Virtualbox from source

Posted: 25. Nov 2012, 00:00
by noteirak
Perryg wrote:The DOC issue is probably because you don't have texlive-full (debian) installed. You can install just the texlive but will be missing the bara font that needs to be installed to build.
texlive-full wasn't installed indeed, I am doing it now. I had a build error at the SDKRef PDF part, I guess it is linked.
Gonna rebuild and post the outcome.
Perryg wrote:As for just the java bindings I am not sure what you are getting at. That probably is not what you want to do.
I need vboxjxpcom.jar & vboxjws.jar buit from the source of 4.2.4 and from the SVN to see if the bug #11232 is reproductibe there aswell.
Klaus told me he didn't have this bug building his version, and told me to try doing the same - so here I am.
Perryg wrote:If you do not want to build the DOCs you can add the following to the LocalConfig.kmk:

Code: Select all

VBOX_WITH_DOCS := 
Thank you
Perryg wrote:On one more thing. During the build if you encounter errors and need to start over after you have added or changed the build parameters. you probably will want to delete the out folder. I have seen corruption at time when starting over.
Already doing it, it was in one post your replyed to some time ago :)

Re: Build Virtualbox from source

Posted: 25. Nov 2012, 00:14
by Perryg
Very well. Keep me posted. I will say that on rare occasions we find a build issue in SVN but it is rare, and if you keep a backup build install you can revert to a working copy. I don't use anything else but builds from SVN on my main PC and have not for as long as I remember. That way I get the patches as soon as they are created and don't need to wait for the maintenance releases.

Moving this to OSE now.

Re: Build Virtualbox from source

Posted: 25. Nov 2012, 00:25
by noteirak
texlive-full solved the compil issues, I managed to get a full build this time.

No luck with source from 4.2.4 & JDK 1.6.0_37 amd64 for the bindings tho. I am now trying from the SVN directly, will post again once it has build.

Re: Build Virtualbox from source

Posted: 25. Nov 2012, 00:31
by Perryg
One more thing. If you don't install openwatcom you will be using a pre-built older VBoxVideo IIRC.
http://www.openwatcom.org/index.php/Ins ... m_on_Linux
Show how to install and set the env. The download is available from there as well.

Re: Build Virtualbox from source

Posted: 25. Nov 2012, 00:36
by noteirak
Thank you, I'm going to look into it as well as soon as the build is done, and keep you updated here.

FYI, I am also preparing a HOWTO step-by-step for this here, which I will replicate on the forum and keep updated, so thank you for your guidance so far, it will be useful for everyone :)

Re: Build Virtualbox from source

Posted: 25. Nov 2012, 01:01
by Perryg