I am trying to revive some code that was used for a cdf analysis. The code consists of a macro called testing.C which loads a fortran library that I compiled and also compiles a macro called TopFort.cc The fortran routine is called from TopFort.cc. TopFort passes the address of five arrays to the fortran routine, where the information in 4 of the arrays is used to make a calculation and the fifth to store the results.
The machine I’d like to run my analysis on is using atlas software as opposed to the cdf software package, however, I seg fault when trying to access information from the arrays. I will now describe how the code was compiled on both machines to try and sniff out where my problem is.
The cdf version of the code was compiled using g77, here are the specs
[shamil01@tuhept]~ > g77 -v
Reading specs from /home/cdfsoft/products/gcc/v3_4_3/Linux+2.6/bin/…/lib/gcc/i686-pc-linux-gnu/3.4.3/specs
Configured with: …/…/gcc-3.4.3/configure --prefix=/tmp/build-gcc-v3_4_3 --disable-shared --with-gnu-ld --with-ld=/tmp/build-gcc-v3_4_3/bin/ld --with-gnu-as --disable-libgcj --with-as=/tmp/build-gcc-v3_4_3/bin/as --enable-threads=posix --enable-languages=c,c++,f77,objc
Thread model: posix
gcc version 3.4.3
and the code was compiled as such:
g77 -Wall -I. -fPIC -c ellipse_pdflib.F
g++ -Wl,-soname,libTopFortran.so -shared -o libTopFortran.so ellipse_pdflib.o -L
$CERN_DIR/lib -lpdflib -lkernlib -lmathlib -lpacklib -lg2c
and it uses root version: Version 4.00/08 1 December 2004
This program runs just fine…now for the seg fault…The machine I’m running atlas software on does not have g77, but rather gfortran. Here are the specs:
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: …/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)
And the code is compiled as such:
gfortran -c -m32 -I. -fPIC ellipse_pdflib.for
gfortran -m32 -Wall,-soname,libTopFortran.so -shared -o libTopFortran.so ellipse_pdflib.o -L
/cluster/ATLAS/osg/app/atlas_app/atlas_rel/16.0.3/sw/lcg/external/cernlib/2006a/i686-slc5-gcc43-opt/lib -lpdflib804 -lkernlib -lmathlib -lpacklib
using root version:
Version 5.26/00e 13 October 2010
The seg fault appears as and I’ve narrowed it down by my own debugging to a statement that accesses an element from one of the arrays passed to the fortran routine (called dilep):
*** Break *** segmentation violation
Attaching to program: /proc/26988/exe, process 26988
[Thread debugging using libthread_db enabled]
0xffffe410 in __kernel_vsyscall ()
#1 0x00593713 in _waitpid_nocancel () from /lib/libc.so.6
#2 0x0053807b in do_system () from /lib/libc.so.6
#3 0x0066aead in system () from /lib/libpthread.so.0
#4 0xf7aa41dd in TUnixSystem::Exec(char const*) ()
from /cluster/ATLAS/osg/app/atlas_app/atlas_rel/15.6.14/sw/lcg/app/releases/R
OOT/5.22.00j/i686-slc5-gcc43-opt/root/lib/libCore.so
#5 0xf7aa96eb in TUnixSystem::StackTrace() ()
from /cluster/ATLAS/osg/app/atlas_app/atlas_rel/15.6.14/sw/lcg/app/releases/R
OOT/5.22.00j/i686-slc5-gcc43-opt/root/lib/libCore.so
#6 0xf7aaa48d in TUnixSystem::DispatchSignals(ESignals) ()
from /cluster/ATLAS/osg/app/atlas_app/atlas_rel/15.6.14/sw/lcg/app/releases/R
OOT/5.22.00j/i686-slc5-gcc43-opt/root/lib/libCore.so
#7 0xf7aaa58d in SigHandler(ESignals) ()
from /cluster/ATLAS/osg/app/atlas_app/atlas_rel/15.6.14/sw/lcg/app/releases/R
OOT/5.22.00j/i686-slc5-gcc43-opt/root/lib/libCore.so
#8 0xf7aa0e42 in sighandler(int) ()
from /cluster/ATLAS/osg/app/atlas_app/atlas_rel/15.6.14/sw/lcg/app/releases/R
OOT/5.22.00j/i686-slc5-gcc43-opt/root/lib/libCore.so
#9
#10 0xf5ce7cc5 in dilep ()
from /cluster/tufts/physicshe/shamil01/TopRootWork/KrzFolder/FailingCode/./li
bTopFortran.so
#11 0x20202020 in ?? ()
One thing that I’ve observed is that the shared library for TopFort.cc created on the atlas machine is much smaller than on the cdf machine…here are the sizes:
atlas: 30146 (Size)
cdf: 2481021 (Size)
Other than this, I have no idea what is wrong. I’ll attach the code that is used incase it is helpful.
TopFort.cc.C (1.03 KB)
ellipse_pdflib.F.C (38.5 KB)
testing.C (1.52 KB)