Re: [ROOT] root 3.03/09 and Api.h

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Mon Sep 30 2002 - 17:49:13 MEST


Hi Jacek,

"Jacek M. Holeczek" <holeczek@us.edu.pl> wrote concerning
Re: [ROOT] root 3.03/09 and Api.h [Mon, 30 Sep 2002 15:55:59 +0200 (MET DST)]
----------------------------------------------------------------------
> Hi,
> 
> Second, the "maximum line size" problem is completely unrelated to ACLIC.
> It exists on RH7.1 only, but I get it with both, the old root 3.02/07
> (egcs-1.1.2 based) and new 3.03/09 (gcc2953 based).

One way of avoiding clash of shared libraries, is to use the version
numbers in the soname of the libraries.  You can enable that in the
ROOT build by doing 

  ./configure --enable-soversion 

This will set the soname to contain the major and minor number (I
think) e.g., 

   libCint.so has soname libCint.so.3.03  for all 3.03/xx version 
   libCint.so has soname libCint.so.3.02  for all 3.02/xx version 

When you link against these libraries, the soname will be used for the
dependencies, and hence, when ld.so loads the needed libraries it will
load the correct version number.  An example: 

Say you have the program `foo' and you build against ROOT 3.02/07 and
ROOT 3.03/09: 

   > root-config --version 
   3.02/07 
   > g++ foo.cc -o foo-3.02 `root-config --libs --cflags` 
   > ldd foo-3.02 
	libCore.so.3.02 => .../libCore.so.3.02
	libCint.so.3.02 => .../libCint.so.3.02
	...

   > root-config --version 
   3.03/09
   > g++ foo.cc -o foo-3.03 `root-config --libs --cflags` 
   > ldd foo-3.03 
	libCore.so.3.03 => .../libCore.so.3.03
	libCint.so.3.03 => .../libCint.so.3.03
	...

So when `foo-3.02' is executed, the 3.02 libraries are loaded into
memory (and may stay there), while when `foo-3.03' is executed the
3.03 libraries are loaded into memory.  And, because they have
different sonames they can coexist in memory, and each program will
get the right symbols from the right libraries. 

The same thing goes if you use different compilers: 

   > g++ foo.cc -V 2.96 -o foo-2.96 
   > ldd foo-2.96
	...
	libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3
	...


   > g++ foo.cc -V 3.0.4 -o foo-3.0.4 
   > ldd foo-3.0.4
	...
	libstdc++.so.3 => /usr/lib/libstdc++.so.3
	...


so that should not cause you any trouble. 

I _strongly_ recommend that one _always_ uses version numbers in the
sonames when ever possible (some OSs don't support sonames at all).
Fons, Rene: couldn't `--enable-soversion' be on per default for all
architectures that support it?  

Another thing that may also help you is to use the option
`--enable-rpath' which presets the runtime load-path on all ROOT
executables.  In that way, ld.so will always look for the libraries in
the right path.   However, that requires that you build ROOT with
fixed paths thought. 

Try the `--enable-soversion' option and see if that doesn't solve most
of your problems. 

Please refer to the README/INSTALL file for more details on all of
this. 

Yours, 

 ____ |  Christian Holm Christensen 
  |_| |	 -------------------------------------------------------------
    | |	 Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
     _|	          DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
    _|	          Denmark                    Office: (+45) 353  25 305
 ____|	 Email:   cholm@nbi.dk               Web:    www.nbi.dk/~cholm
 | |



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:12 MET