Charles' December 2009 CMS Log 

   November 2009   
December 2009
SuMoTuWeThFrSa
  12345
6789101112
13141516171819
20212223242526
2728293031  
   January 2010   

Tuesday, December 8

Debugging cmsShow.exe in gdb  

cmsShow.exe is crashing when I run it. What is weird is that the code seems to be jumping to a random subroutine: It should go from the constructor of PluginFactory to a function in its base class (.h, .cc).

cms/FWCore/PluginManager/interface/PluginFactory.h

78   private:
79      PluginFactory() {
80        finishedConstruction();
81      }
Instead it is jumps to a templated function in ValueMap.h (steps #4 and #3):
cplager@Hagrid> gdb ./cmsShow.exe
GNU gdb 6.8.0.20080328-cvs (cygwin-special)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run
Starting program: /mount/cplagerdoc/cplager/build/cmsShow34g/cmsShow.exe
[New thread 2772.0xea8]
[New thread 2772.0xeb0]

Program received signal SIGSEGV, Segmentation fault.
0x063ca46a in edm::helper::Filler<edm::ValueMap<double> >::add (this=0x22cab4, map=@0x7998d8)
    at cms/DataFormats/Common/interface/ValueMap.h:39
39              std::pair<ProductID, offset> id = *j;
Current language:  auto; currently c++
(gdb) where
#0  0x063ca46a in edm::helper::Filler<edm::ValueMap<double> >::add (this=0x22cab4, map=@0x7998d8)
    at cms/DataFormats/Common/interface/ValueMap.h:39
#1  0x063ca828 in Filler (this=0x22cab4, map=@0x7998d8) at cms/DataFormats/Common/interface/ValueMap.h:31
#2  0x0646f8fa in edm::ValueMap<double>::add (this=0x7998d8, o=@0x6ece56)
    at cms/DataFormats/Common/interface/ValueMap.h:227
#3  0x0646fae0 in edm::ValueMap<double>::operator+= (this=0x7998d8, o=@0x6ece56)
    at cms/DataFormats/Common/interface/ValueMap.h:145
#4  0x0060d913 in PluginFactory (this=0x7998d8) at cms/FWCore/PluginManager/interface/PluginFactory.h:80
#5  0x004ae5fb in edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::get ()
    at src/Fireworks/Core/src/FWRPZDataProxyBuilderBaseFactory.cc:20
#6  0x0060cabb in PMaker (this=0x7a06d8, iName=@0x22cbac)
    at cms/FWCore/PluginManager/interface/PluginFactory.h:48
#7  0x00531bba in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535)
    at src/Fireworks/Vertices/plugins/FWVertexRPZProxyBuilder.cc:97
#8  0x00531ddc in global constructors keyed to _ZN23FWVertexRPZProxyBuilderC2Ev ()
    at src/Fireworks/Vertices/plugins/FWVertexRPZProxyBuilder.cc:97
#9  0x61004ea9 in __main () from /usr/bin/cygwin1.dll
#10 0x0059b35b in main ()
To try and watch this more closely, we set a break point and then stepped through the execution of the program (same gdb session):
(gdb) break 'edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::get ()'
Breakpoint 1 at 0x4ae5c6: file src/Fireworks/Core/src/FWRPZDataProxyBuilderBaseFactory.cc, line 20.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /mount/cplagerdoc/cplager/build/cmsShow34g/cmsShow.exe
[New thread 2632.0xc84]
[New thread 2632.0x830]

Breakpoint 1, edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::get ()
    at src/Fireworks/Core/src/FWRPZDataProxyBuilderBaseFactory.cc:20
20      EDM_REGISTER_PLUGINFACTORY(FWRPZDataProxyBuilderBaseFactory,"cmsShow FWRPZDataProxyBuilderBase");
(gdb) step
PluginFactory (this=0x7998d8) at cms/FWCore/PluginManager/interface/PluginFactory.h:79
79            PluginFactory() {
(gdb)
PluginFactoryBase (this=0x7998d8) at cms/FWCore/PluginManager/interface/PluginFactoryBase.h:37
37            PluginFactoryBase() {}
(gdb)
signal (this=0x7998dc) at external/sigcpp/include/sigc++-2.0/sigc++/signal.h:3690
3690      signal() {}
(gdb)
signal2 (this=0x7998dc) at external/sigcpp/include/sigc++-2.0/sigc++/signal.h:2915
2915      signal2() {}
(gdb)
signal_base (this=0x7998dc) at signal_base.cc:92
92      signal_base::signal_base()
(gdb)
93      : impl_(0)
(gdb)
trackable (this=0x7998dc) at trackable.cc:32
32      : callback_list_(0)
(gdb)
33      {}
(gdb)
signal_base (this=0x7998dc) at signal_base.cc:94
94      {}
(gdb)
map (this=0x7998e4) at /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_map.h:156
156           : _M_t() { }
(gdb)
_Rb_tree (this=0x7998e4) at /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_tree.h:562
562           _Rb_tree() { }
(gdb)
_Rb_tree_impl (this=0x7998e4) at /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_tree.h:405
405                 _M_node_count(0)
(gdb)
allocator (this=0x7998e4) at /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/allocator.h:98
98            allocator() throw() { }
(gdb)
new_allocator (this=0x7998e4) at /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/ext/new_allocator.h:69
69            new_allocator() throw() { }
(gdb)
_Rb_tree_impl (this=0x7998e4) at /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_tree.h:406
406               { _M_initialize(); }
(gdb)
std::_Rb_tree<std::string, std::pair<std::string const, std::vector<std::pair<void*, std::string>, std::allocator<std::pair<void*, std::string> > > >, std::_Select1st<std::pair<std::string const, std::vector<std::pair<void*, std::string>, std::allocator<std::pair<void*, std::string> > > > >, std::less<std::string>, std::allocator<std::pair<std::string const, std::vector<std::pair<void*, std::string>, std::allocator<std::pair<void*, std::string> > > > > >::_Rb_tree_impl<std::less<std::string>, false>::_M_initialize (this=0x7998e4)
    at /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_tree.h:417
417                 this->_M_header._M_color = _S_red;
(gdb)
418                 this->_M_header._M_parent = 0;
(gdb)
419                 this->_M_header._M_left = &this->_M_header;
(gdb)
420                 this->_M_header._M_right = &this->_M_header;
(gdb)
421               }
(gdb)
PluginFactory (this=0x7998d8) at cms/FWCore/PluginManager/interface/PluginFactory.h:80
80              finishedConstruction();
(gdb) where
#0  PluginFactory (this=0x7998d8) at cms/FWCore/PluginManager/interface/PluginFactory.h:80
#1  0x004ae5fb in edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::get ()
    at src/Fireworks/Core/src/FWRPZDataProxyBuilderBaseFactory.cc:20
#2  0x0060cabb in PMaker (this=0x7a06d8, iName=@0x22cbac)
    at cms/FWCore/PluginManager/interface/PluginFactory.h:48
#3  0x00531bba in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535)
    at src/Fireworks/Vertices/plugins/FWVertexRPZProxyBuilder.cc:97
#4  0x00531ddc in global constructors keyed to _ZN23FWVertexRPZProxyBuilderC2Ev ()
    at src/Fireworks/Vertices/plugins/FWVertexRPZProxyBuilder.cc:97
#5  0x61004ea9 in __main () from /usr/bin/cygwin1.dll
#6  0x0059b35b in main ()
(gdb) step
edm::ValueMap<double>::operator+= (this=0x7998d8, o=@0x6ece56)
    at cms/DataFormats/Common/interface/ValueMap.h:145
145           add(o);
(gdb)
These function calls should all be aprt of the CMSDataFormats shared library. This library is large and takes 30 minutes for the linking stage to finish:
cplager@Hagrid> ll libCMSDataFormats.dll
-rwxr-xr-x 1 cplager None 412168947 2009-12-07 14:01 libCMSDataFormats.dll*

I wanted to check that nothing funny was going on with which libraries were being used with the executable:

cplager@Hagrid> cygcheck ./cmsShow.exe
C:\Documents and Settings\cplager\My Documents\cplager\build\cmsShow34g\cmsShow.exe
  C:\cygwin1.7\bin\cygwin1.dll
    C:\WINDOWS\system32\ADVAPI32.DLL
      C:\WINDOWS\system32\KERNEL32.dll
        C:\WINDOWS\system32\ntdll.dll
      C:\WINDOWS\system32\RPCRT4.dll
        C:\WINDOWS\system32\Secur32.dll
  C:\cygwin1.7\bin\cyggcc_s-1.dll
  C:\cygwin1.7\bin\cygstdc++-6.dll
  C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libGui.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libCint.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libCore.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libMathCore.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libRIO.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libGraf.dll
      C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libHist.dll
        C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libMatrix.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libGpad.dll
  C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libRint.dll
  C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libEG.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libGraf3d.dll
  C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libRGL.dll
    C:\cygwin1.7\bin\cygGL-1.dll
      C:\cygwin1.7\bin\cygX11-6.dll
        C:\cygwin1.7\bin\cygxcb-1.dll
          C:\cygwin1.7\bin\cygXau-6.dll
          C:\cygwin1.7\bin\cygXdmcp-6.dll
      C:\cygwin1.7\bin\cygXext-6.dll
    C:\cygwin1.7\bin\cygGLU-1.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libFTGL.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libGed.dll
      C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libTree.dll
        C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libThread.dll
        C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libNet.dll
  C:\Documents and Settings\cplager\My Documents\cplager\build\cmsShow34g\libCMSDataFormats.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\cmsShow34g\external\lib\libHepMC-2.03.06.dll
      C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libPhysics.dll
      C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libPostscript.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\cmsShow34g\external\lib\libsigcpp.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\cmsShow34g\external\lib\libCLHEP.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\cmsShow34g\external\lib\libuuid.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libReflex.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libGenVector.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libCintex.dll
    C:\cygwin1.7\usr\local\bin\cygboost_regex.dll
      C:\cygwin1.7\bin\cygicuuc38.dll
        C:\cygwin1.7\bin\cyggcc_s.dll
        C:\cygwin1.7\bin\cygicudata38.dll
      C:\cygwin1.7\bin\cygicui18n38.dll
    C:\cygwin1.7\usr\local\bin\cygboost_filesystem.dll
      C:\cygwin1.7\usr\local\bin\cygboost_system.dll
    C:\cygwin1.7\usr\local\bin\cygboost_thread.dll
  C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libEve.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libTreePlayer.dll
    C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libGeom.dll
  C:\Documents and Settings\cplager\My Documents\cplager\build\fireworksroot\root\bin\libGuiHtml.dll
  C:\cygwin1.7\usr\local\bin\cygboost_program_options.dll
cplager@Hagrid>
Hmmm... It's linking against the wrong boost libraries (in red). exe.out is the output of me building the cmsShow.exe executable.

Actually, it turns out that 1) those libraries are effectively the same (as I build them the same time I built boost, 2) I can fix this by changing my $PATH variable, and 3) it doesn't affect the behavior at all (still crashes exactly the same way).

Here is the updated output:

cplager@Hagrid> cygcheck ./cmsShow.exe > cmsShow_cygcheck.out

O.k. So the executable seems to be linked against reasonable

Friday, December 4

Problems Linking CMSDataFormats.dll  

It no longer has an problem finding Root libraries, but I'm still missing a bunch:

cplager@Hagrid> make core >& link.out&
cplager@Hagrid> perl -ne "if (m|undefined reference to |) { print $'}" link.out > undefined.out

Fixing Linking Problems  

It seems like the externals aren't being built correctly. I'm taking the .a files and remaking .dll:

cd sigcpp-2.0.18/lib/
cd $EXTERNAL
ar x libsigc-2.0.a
g++ -shared -O -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -o libsigcpp.dll *.o
rm *.o

After having done this, I no longer get errors for SigCPP. I did the same thing for HepMC:

cd HepMC/lib/
ar -x libHepMC.a
g++ -shared -O -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -o libHepMC.dll *.o
rrm *.o
In the case of Boost, the DLLs live in bin/ not lib/, so I'm chainging which directory is being used. Cross your fingers.

Getting Better  

Now it looks like most things are working except HepMC:

cplager@Hagrid> make core >& link.out&
cplager@Hagrid> perl -ne "if (m|undefined reference to |) { print $'}" link.out > missing.out
Here's the list of problems that's not HepMC:
cplager@Hagrid> grep -v HepMC missing.out
`ROOT::GenerateInitInstance(AutoLibraryLoader const*)'
`vtable for AutoLibraryLoader'
`vtable for AutoLibraryLoader'
`_uuid_generate_time'

More Tricks  

Chris and I editted the AutoLoaderLibrary so it no longer derived from TObject and then that problem went away. For _uuid_generate_time, I went to external/lib and ran:

ar -x /usr/lib/e2fsprogs/libuuid.a
g++ -shared -O -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -o libuuid.dll *.o
rrm *.0
and then added -luuid to the Makefile.

Finally, to deal with the HepMC, I took one of my Makefiles and wrote Makefile to compile it into a .dll.

After all of these changes, I successfully compiled libCMSDataFormats.dll.

Thursday, December 3

Problem with gccxml  

echo "generating dictionaries based on cms/DataFormats/Math/src/classes_def.xml"; \
        mkdir -p tmp/cms/DataFormats/Math/src/; \
        external/root/bin/genreflex cms/DataFormats/Math/src/classes.h -s cms/DataFormats/Math/src/classes_def.xml -o tmp/cms/DataFormats/Math/src/classes.cpp -I./ -Iexternal/root/include -Icms -Iexternal/boost/include -Iexternal/clhep/include -Iexternal/HepMC/include -Iexternal/sigcpp/include/sigc++-2.0 --gccxmlpath=external/gccxml/bin --gccxmlopt="--gccxml-cxxflags '-m32' --gccxml-compiler g++" 
generating dictionaries based on cms/DataFormats/Math/src/classes_def.xml
gccxml_cc1plus: internal compiler error: in c_common_valid_pch, at c-pch.c:239
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
As a temporary workaround to this problem, Chris generated classes.cpp on linux (with gcc434) and I am using his version of the file.

CLHEP and Shared Libraries  

No matter how I seem to configure CLHEP

 ./configure --prefix=/home/cplager/build/external/CLHEP-2.0.4.2 --enable-shared --disable-static
it insists on creating a static library instead of shared libraries. To build a shared library, I use a trick that Chris gave me:
ar x libCLHEP.a
g++ -shared -Wl,--export-all-symbols  -Wl,--enable-auto-import -o libCLHEP.dll *.o
\rm *.o *.a
In this case, we made an educated guess as to the options needed. Note that for the building of the CMS code, the options were just g++ -shared -m32.

Wednesday, December 2

Externals For Fireworks on Cygwin  

Chris Jones and I are trying to build Fireworks on Cygwin.

export BUILD=/home/cplager/build2
export EXTERNAL=/home/cplager/build/external
cd $BUILD
I want to build four things:
  1. gccxml
  2. CLHEP
  3. HepMC
  4. SigCPP

gccxml  

Starting with gccxml, I am looking at CMS' gccxml.spec for details.

cd $BUILD
wget http://cern.ch/service-spi/external/tarFiles/gccxml-0.9.0_20081130.tar.gz
tar xzf gccxml-0.9.0_20081130.tar.gz 
mkdir gccxmlBuild
cd gccxmlBuild/
cmake ../gccxml -DCMAKE_INSTALL_PREFIX:PATH=$EXTERNAL/gccxml-0.9.0_20081130
make -j4
make install

CLHEP  

The clhep.spec looks fairly involved. I need to talk to somebody to figure out what the deal here is. Liz thinks I should just do a config/make/makeinstall so I'm going to try that.

I needed to add #include to a file, so I made cstdlib.patch, a patch file (I think you'd install it with patch -p0 < cstdlib.patch, but I'm not sure).

wget http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/distributions/clhep-2.0.4.2.tgz
tar xzf clhep-2.0.4.2.tgz 
cd clhep-2.0.4.2.tgz 
mv 2.0.4.2 CLHEP-2.0.4.2/
cd CLHEP-2.0.4.2/
cd CLHEP/
./configure --prefix=$EXTERNAL/CLHEP-2.0.4.2
cp Random/src/DRand48Engine.cc DRand48Engine.cc_old
enw Random/src/DRand48Engine.cc
diff -uN DRand48Engine.cc_old Random/src/DRand48Engine.cc > cstdlib.patch
make -j4 >& clhep.out &
make install
O.k. That "worked" (didn't crash). But I don't seem to have dlls like I want.

O.k. Just for the fun of it:

cp -i ../Evaluator/src/*.cc  .
cp -i ../Evaluator/src/*.src .
cp -i ../GenericFunctions/src/*.cc .
cp -i ../Geometry/src/*.cc   .
cp -i ../Matrix/src/*.cc     .
cp -i ../Random/src/*.cc     .
cp -i ../Random/src/*.src    .
cp -i ../Random/*.cdat   .
cp -i ../RandomObjects/src/*.cc .
cp -i ../Vector/src/*.cc     .
cp -i ../HepPDT/src/*.cc  .
cp -i ../HepMC/src/*.cc  .
cp -i ../StdHep/src/*.cc  .
loop "g++ -c -O2 -ansi -Wall -I../.. -D_GNU_SOURCE %" *.cc
g++ -c -O2 -ansi -Wall -I../..  DRand48Engine.cc
g++ --shared -o libCLHEP-2.0.4.2.dll *.o
cp libCLHEP-2.0.4.2.dll $EXTERNAL/CLHEP-2.0.4.2/lib/
Some of the copy commands were no-ops (the files weren't there) and some files didn't compile. I needed to compile DRand48Engine.cc without the -D_GNU_SOURCE flag. I dunno if this is useful at all...

HepMC  

hepmc.spec looks a little easier. This one has two patches, hepmc-2.03.06-gcc43.patch and hepmc-2.03.06-reflex.patch.

cd $BUILD
wget http://lcgapp.cern.ch/project/simu/HepMC/download/HepMC-2.03.06.tar.gz
wget http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/CMSDIST/hepmc-2.03.06-gcc43.patch?revision=1.1 -O hepmc-2.03.06-gcc43.patch
wget http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/CMSDIST/hepmc-2.03.06-reflex.patch?revision=1.1 -O hepmc-2.03.06-reflex.patch
tar xzf HepMC-2.03.06.tar.gz 
cd HepMC-2.03.06
patch -p1 < ../hepmc-2.03.06-gcc43.patch 
patch -p0 < ../hepmc-2.03.06-reflex.patch 
./configure --prefix=$EXTERNAL/HepMC-2.03.06
make -j4 >& hepmc.out&
Hmmpth. That didn't work...

SigCPP  

sigcpp.spec also has a patch sigcpp-2.0.18-gcc42.patch:

cd $BUILD
wget http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.2/libsigc++-2.2.3.tar.gz
wget http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/COMP/CMSDIST/sigcpp-2.0.18-gcc42.patch?revision=1.1 -O sigcpp-2.0.18-gcc42.patch
tar xzf libsigc++-2.2.3.tar.gz 
cd libsigc++-2.2.3
patch -p2 < ../sigcpp-2.0.18-gcc42.patch 
./configure --prefix=$EXTERNAL/sigcpp-2.0.18
make -j4 >& sigcpp.out&
make install
cp $EXTERNAL/sigcpp-2.0.18/lib/sigc++-2.0/include/sigc++config.h $EXTERNAL/sigcpp-2.0.18/include/sigc++-2.0/

Go to November's log


Last modified: Tue Dec 8 11:05:12 CST 2009