How to compile static binary

From: Hermann Fuchs <hermann.fuchs_at_meduniwien.ac.at>
Date: Tue, 25 Oct 2011 12:03:38 +0200


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

-- 
-------------
DI Hermann Fuchs
Div. Medical Radiation Physics
Department of Radiotherapy
Med. Univ. Vienna / AKH Vienna
Währinger Gürtel 18-20
A-1090 Wien

Tel.  + 43 / 1 / 40 400 7271
Mail. hermann.fuchs_at_meduniwien.ac.at
Received on Tue Oct 25 2011 - 12:03:17 CEST

This archive was generated by hypermail 2.2.0 : Tue Oct 25 2011 - 17:50:01 CEST