Re: How to compile static binary

From: Fons Rademakers <Fons.Rademakers_at_cern.ch>
Date: Tue, 25 Oct 2011 12:10:39 +0200


Hi,

  first you've to make a static ROOT library file. Do (assuming you build ROOT first):

make static

after having build ROOT. Then when linking your application link against $ROOTSYS/lib/libRoot.a.

Cheers, Fons.

On 25/10/2011 12:03, Hermann Fuchs wrote:
> Hello
>
> Currently I am compiling root programms using the following command
> g++ myProg.cpp `root-config --cflags --glibs` -lMathMore -o a.out
>
> I would now make a static file e.g. compile all required libraries into
> the binary. I don't mind that the file may become quite big.
>
> However using the static flag
> g++ myProg.cpp `root-config --cflags --glibs` -lMathMore -static -o
> a.out
> doesn't seem to work. See below:
> /usr/bin/ld: cannot find -lGui
> /usr/bin/ld: cannot find -lGpad
> /usr/bin/ld: cannot find -lHist
> /usr/bin/ld: cannot find -lGraf
> /usr/bin/ld: cannot find -lGraf3d
> /usr/bin/ld: cannot find -lTree
> /usr/bin/ld: cannot find -lRint
> /usr/bin/ld: cannot find -lPostscript
> /usr/bin/ld: cannot find -lMatrix
> /usr/bin/ld: cannot find -lPhysics
> /usr/bin/ld: cannot find -lMathCore
> /usr/bin/ld: cannot find -lRIO
> /usr/bin/ld: cannot find -lNet
> /usr/bin/ld: cannot find -lThread
> /usr/bin/ld: cannot find -lCore
> /usr/bin/ld: cannot find -lCint
> /usr/bin/ld: cannot find -lMathMore
> collect2: ld returned 1 exit status
>
> What do I have to do to generate a static binary?
>
> Cheers,
> Hermann

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers_at_cern.ch              Phone: +41 22 7679248
WWW:    http://fons.rademakers.org           Fax:   +41 22 7669640


Received on Tue Oct 25 2011 - 12:10:44 CEST

This archive was generated by hypermail 2.2.0 : Wed Oct 26 2011 - 23:50:02 CEST