Re: [ROOT] MacOS 10.3 linking problem root/pythia or aliroot

From: Constantin Loizides (loizides@ikf.uni-frankfurt.de)
Date: Wed Jan 07 2004 - 14:48:50 MET


Hi Remi,

thanks a lot, by looking into the .info
file of root-cern3 fink pkg, I have learned
how to compile pythia, in order to
avoid the clashing of common symbols:

Attached is the file I am using
to compile (extracted from the root
fink package)
as someone else
might also run into the problem when
simply following the porting tips from
fink.sourceforge.net.

Now root and external pythia libs work
nicely.

Thanks!
Constantin




Remi Mommsen wrote:

> Hi Constantin,
> 
> I'm using root 3.10/02 from fink (root3-cernlib) om Mac OS X 10.3.2:
> 
>  > root
>   *******************************************
>   *                                         *
>   *        W E L C O M E  to  R O O T       *
>   *                                         *
>   *   Version   3.10/02  17 December 2003   *
>   *                                         *
>   *  You are welcome to visit our Web site  *
>   *          http://root.cern.ch            *
>   *                                         *
>   *******************************************
> 
> FreeType Engine v2.1.3 used to render TrueType fonts.
> Compiled for macosx with thread support.
> 
> CINT/ROOT C/C++ Interpreter version 5.15.115, Dec 9 2003
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> ...using style 'Plain'
> 
> root [0] gSystem->Load("libPythia6.so");
> root [1] gSystem->Load("libEG.so");
> root [2] gSystem->Load("libEGPythia6.so");
> root [3]
> 
> HTH,
>     Remi
> 
> On Jan 6, 2004, at 1:17 AM, Constantin Loizides wrote:
> 
>> Hi Remi,
>>
>>> You could try to compile the fortran stuff with -single_module.
>>
>>
>> thats what I did. I followed the porting instructions on
>> fink.sourceforge.net.
>>
>>
>>> BTW: are you aware that you can install root3 with cernlib support 
>>> from fink (http://fink.sourceforge.net)?
>>
>> Yes, I know, but do you think that it would work then?
>> I mean, its not a problem of compiling it, its a problem
>> of linking. If you have root from fink, could you please
>> try it? Just do the sequence
>>
>>  gSystem->Load("libPythia6.so");
>>  gSystem->Load("libEG.so");
>>  gSystem->Load("libEGPythia6.so");
>>
>> Thanks,
>> best regards,
>> Constantin
>>
>>> HTH,
>>>     Remi
>>> On Jan 5, 2004, at 10:38 AM, Constantin Loizides wrote:
>>>
>>>> Hi, sorry to bother again,
>>>> but this time I really think its
>>>> a problem:
>>>>
>>>> When trying to use pythia with Root and external
>>>> compile libpythia6 or with Aliroot I run
>>>> into the "multiple definitions of symbols"
>>>> problem (see down), known for the dyld on mac.
>>>> The definition of HEPEVT in pythia6x.f and
>>>> libEG.so (Hepevt.h) simply clash and
>>>> the linker does not simply take
>>>> the first defintion and disregards the
>>>> second (as e.g. ld on linux does).
>>>>
>>>> I tried to solve it by explicitely
>>>> makeing hepevt external in Hepevt.h
>>>> but then loading libEG.so fails
>>>> with very strange missing symbols
>>>> which are in libPythia6.so (which
>>>> is loaded first).
>>>>
>>>> Any ideas? I have been browsing
>>>> the web, it seems that one has
>>>> to work around it by suitably
>>>> using "external" but maybe someone
>>>> knows of a superior approach?
>>>> Maybe not using flat namespaces?
>>>>
>>>> Regards, Constantin
>>>>
>>>>
>>>> ALIROOT head (with config option to use pythia)
>>>> ---------------
>>>> root [0] gAlice->Init("ConfigPPR.C");
>>>>      ****************************************************************
>>>>      *                                                              *
>>>>      *    You are running AliRoot version NewIO
>>>>      *    The cvs tag for the current program is $Name:  $
>>>>      *                                                              *
>>>>      ****************************************************************
>>>> Seed for random number generation= 12345
>>>> dlopen error: dlcompat: dyld: aliroot multiple definitions of symbol 
>>>> _hepevt_
>>>> /prog/root/ali-head/lib/libEG.dylib(TGenerator.o) definition of 
>>>> _hepevt_
>>>> /prog/aliroot/ali-head/lib/tgt_Darwin/libpythia6.dylib(single 
>>>> module) definition of _hepevt_
>>>>
>>>>
>>>> ROOT 10.02 and pythia6.221
>>>> ---------------
>>>> gSystem->Load("$PYTHIA6LIB/libPythia6.so"); // Pythia6 library
>>>> root [1]    gSystem->Load("libEG.so");
>>>> root [2]    gSystem->Load("libEGPythia6.so");
>>>> dlopen error: dlcompat: dyld: /prog/root/ali-head/bin/root.exe 
>>>> multiple definitions of symbol _hepevt_
>>>> /prog/root/ali-head/lib/libEG.so definition of _hepevt_
>>>> /prog/pythia6/libPythia6221.dylib(single module) definition of _hepevt_
>>>>
>>>> Load Error: Failed to load Dynamic link library 
>>>> /prog/root/ali-head/lib/libEGPythia6.so
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> Failure is not an option.
>>> It comes bundled with your Microsoft product.       (Ferenc Mantfeld)
>>> *********************************************************************
>>> Remigius K. Mommsen                 e-mail: mommsen@slac.stanford.edu
>>> University of California, Irvine       URL:    http://cern.ch/mommsen
>>> c/o SLAC                             voice:        ++1 (650) 926-3595
>>> 2575 Sand Hill Road #35                fax:        ++1 (650) 926-3882
>>> Menlo Park, CA 94025, US              home:        ++1 (650) 233-9041
>>> *********************************************************************
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> "Sometimes I think the surest sign that intelligent life exists else-
> where in the universe is that none of it has tried to contact us."
>                                               Calvin (Bill Watterson)
> 
> *********************************************************************
> Remigius K. Mommsen                 e-mail: mommsen@slac.stanford.edu
> University of California, Irvine       URL:    http://cern.ch/mommsen
> c/o SLAC                             voice:        ++1 (650) 926-3595
> 2575 Sand Hill Road #35                fax:        ++1 (650) 926-3882
> Menlo Park, CA 94025, US              home:        ++1 (650) 233-9041
> *********************************************************************
> 
> 


#!/bin/sh

CC=g77
OPT="-O -g"
FOPT="$OPT"
CLIBDEFS="-DCERNLIB_LINUX -DCERNLIB_BLDLIB -DCERNLIB_CZ"
FFLAGS="$CLIBFOPT $CLIBDEFS $FOPT "
SOFLAGS="-bundle "
DYFLAGS="-O -dynamiclib -single_module"

file=pythia
if test -z "$1"; then
 versions="6161 6205 6210 6218 6221"
else
 versions=$1
fi

for i in $versions; do 

 echo $file$i.f

 $CC $FFLAGS -c $file$i.f
 $CC $FFlAGS -c -fno-second-underscore tpythia6_called_from_cc.F
 $CC $FFLAGS -c -fno-second-underscore pythia6_common_block_address.F
 echo 'void MAIN__() {}' >main.c
 $CC $FFLAGS -c main.c
 $CC $FFLAGS -c pythia6_address.c
 $CC $DYFLAGS -o libPythia$i.dylib \
 main.o pythia6_address.o tpythia6_called_from_cc.o \
 pythia6_common_block_address.o $file$i.o
 ld $EXEFLAGS $SOFLAGS -o libPythia$i.so \
 main.o pythia6_address.o tpythia6_called_from_cc.o \
 pythia6_common_block_address.o $file$i.o -L/sw/lib -ldl \
 -lfrtbegin -lg2c -lgcc -lSystem -lbundle1.o
 mkdir -p lib
 chmod 644 libPythia$i.so
 chmod 644 libPythia$i.dylib
 mv libPythia$i.so lib
 mv libPythia$i.dylib lib
 ln -fs libPythia$i.so lib/libPythia6.so 
done



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET