[vbox-dev] How to build a static version of vbox

Frank Mehnert frank.mehnert at oracle.com
Thu Sep 15 08:07:30 GMT 2011


QiangHuang,

again: Even if you build VirtualBox as a dynamic version then you don't
need any development tool on the target system! Either you have a dynamic
linker on the target system, then copying the dynamic version of VirtualBox
plus all libraries which VirtualBox is linked aganst to the target system
will work as well. Without a dynamic linker, you will NOT get VirtualBox
to work on that target system.

A separate issue is if you have to compile VirtualBox against different
versions of libraries (i.e. the versions of the dynamic libraries on the
devel system differ from the dynamic libraries of the target system).

Adding

  LDFLAGS := -static

to your LocalConfig.kmk in the VBox source root directory is only the first
step. You would need to configure static versions of every library which
the VBox binaries are linked against (including Qt).

In short: It might work to some degree but we don't support it.

Kind regards,

Frank

On Thursday 15 September 2011 09:30:46 QiangHuang wrote:
> Thanks frank.
> 
> Yes, I understood what you mean.
> 
> However, there was no any dev tools in the target Linux. I intended to
> build a static linked vbox in my full installed Linux, and copy the
> static  version to the target. I noticed that the binaries, for
> VBoxManage was linked to some shared libs, such as
> 
>         libxml2.so.2 => /usr/lib/libxml2.so.2 (0x006dc000)
>         libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00acd000)
>         libm.so.6 => /lib/libm.so.6 (0x00a2a000)
>         libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x04a97000)
>         libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x048bc000)
> 
> and so on. I have configed some of the kmk files in the vbox folder
> with the gcc option '-static', however, it worked nothing.
> 
> Thus, I am confused about how to make the building process with static
> linking.
> 
> 2011/9/15 Frank Mehnert <frank.mehnert at oracle.com>:
> > Hi,
> > 
> > please always keep vbox-dev in cc so others get the chance to answer as
> > well.
> > 
> > Regarding your problem: Again, as long as there is a dynamic linker
> > available in the minimal Linux then there is no need to build a static
> > version of VirtualBox. And it would be quite difficult anyway as
> > VirtualBox uses the dynamic linker internally to load dynamic libs
> > at runtime, not only at startup time.
> > 
> > Kind regards,
> > 
> > Frank
> > 
> > On Thursday 15 September 2011 03:22:46 QiangHuang wrote:
> >> Hi Frank
> >> 
> >> Thanks for your answering.
> >> 
> >> The case here is to build a static linked vbox in a full installed
> >> Linux. And then the built vbox could be moved to the simplified one.
> >> I wonder how to config the make related files in the vbox to make the
> >> building of static linked vbox successful.
> >> 
> >> Thank you very much.
> >> 
> >> Best wishe,
> >> 
> >> 2011/9/14 Frank Mehnert <frank.mehnert at oracle.com>:
> >> > On Wednesday 14 September 2011 14:46:23 QiangHuang wrote:
> >> >> Hello everyone:
> >> >> 
> >> >> I need to put a vbox binary in a simplified Linux. There is no gcc,
> >> >> rpm, and make there. Thus a static linked version of vbox is
> >> >> necessary here.
> >> >> 
> >> >> So the question is how to config the make related files to build such
> >> >> a  static linked vbox.
> >> > 
> >> > The absence of make, gcc and rpm does not induce the requirement of
> >> > static linked binaries. For a dynamically linked VBox, just the
> >> > dynamic linker (ld.so) is required.
> >> > 
> >> > Kind regards,
> >> > 
> >> > Frank
> >> > --
> >> > Dr.-Ing. Frank Mehnert
> >> > Senior Manager Software Development Desktop Virtualization, VirtualBox
> >> > ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt,
> >> > Germany
> >> > 
> >> > Hauptverwaltung: Riesstr. 25, D-80992 München
> >> > Registergericht: Amtsgericht München, HRA 95603
> >> > 
> >> > Komplementärin: ORACLE Deutschland Verwaltung B.V.
> >> > Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
> >> > Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
> >> > Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der
> >> > Ven
> >> > 
> >> > _______________________________________________
> >> > vbox-dev mailing list
> >> > vbox-dev at virtualbox.org
> >> > http://vbox.innotek.de/mailman/listinfo/vbox-dev
> > 
> > --
> > Dr.-Ing. Frank Mehnert
> > Senior Manager Software Development Desktop Virtualization, VirtualBox
> > ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany
> > 
> > Hauptverwaltung: Riesstr. 25, D-80992 München
> > Registergericht: Amtsgericht München, HRA 95603
> > 
> > Komplementärin: ORACLE Deutschland Verwaltung B.V.
> > Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
> > Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
> > Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven

-- 
Dr.-Ing. Frank Mehnert
Senior Manager Software Development Desktop Virtualization, VirtualBox
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20110915/8122af44/attachment.sig>


More information about the vbox-dev mailing list