Static link


I tried to make a standalone root application following this thread: … tatic+link

So far I succeded to make the files “libRoot.a” as well as “roota”. Now its not so clear to me (from the example) what exactly has to be done in addition. My source code which uses the ROOT classes just consists of one class. So my questions are:

Do I have to make a dictionary of my class? What is the correct linker statement for my case? How can I reduce the two files mentioned above with regard to the class content to exactly what is needed for my application (roota and libRoot.a together have more than 140MB…). Can somebody provide a step by step howto?

Thanks a lot,

P.S.: Iam using ROOT version 5.15

Making a static module with the full ROOT libraries does not make much sense. Bot the library and the executacle will be far too big.
In the example below, I show a small script to generate libRoot.a with only the very basic libs. You can add your own set there.
The second script shows how to build the roota executable.
On my Linux machine libRoot.a is 27 MBytes and roota 16 MBytes.

Start from ROOT CVS before running these scripts. In case you try to use
a missing class in your static module, roota will try to dynamically link
the shared lib where the class resides.


procedure to build libRoot.a on Linux with gcc

ar rv lib/libRoot.a \ base/src/*.o \ cont/src/*.o \ meta/src/*.o \ metautils/src/*.o \ rint/src/*.o \ cint/src/*.o \ clib/src/*.o \ unix/src/*.o \ math/src/*.o \ io/src/*.o \ zip/src/*.o

procedure to build roota on Linux with gcc

g++ -g -o bin/roota main/src/rmain.o \ io/src/*.o zip/src/*.o math/src/*.o \ cint/main/G__setup.o lib/libRoot.a lib/libpcre.a -lm -ldl -rdynamic