Differences between dynamic library in the Mac OS X and OpenSuSE
<p>I work on a program developed in C++ which worked well on Mac OS X. This code will help create libraries <code>*.so</code> from <code>*.cc</code> and <code>*.h</code>; I used this as flags:</p>

<pre><code>CXXFLAGS = -g -O2 -fPIC -Wall -ldl -D_GNU_SOURCE 
CXX := g++
</code></pre>

<p>and</p>

<pre><code>$(CXX) -shared -o $(LIBNAME) $(CLIBLIB) $(OUT_OBJS)
</code></pre>

<p>This step is fine; I got the <code>*.so</code> as follows:</p>

<hr>

<pre><code>morad@linux-nzlc:~/Musique/workdir&gt; ls library/tklibs/lib/
libAnalyticalJacobians.so libDetGeometry.so libGeomPropagators.so libPatternTestTools.so libSmearingClusterizers.so libTkLayout.so
libBaseMagneticField.so libDetLayout.so libKalmanUpdators.so libPatternTools.so libStatUtilities.so libTkNavigation.so
libBasicDet.so libDetUtilities.so libMaterialEffects.so libPropagators.so libSurfaceGeometry.so libTrackFitters.so
libBasicStripDet.so libDetVolumeGeometry.so libNumericalJacobians.so libRKPropagators.so libTkCommonDet.so libTrajectoryParametrization.so
libCommonStripDet.so libGenUtil.so libPatternPrimitives.so libSiPixelDet.so libTkFastSimHit.so libUI.so
morad@linux-nzlc:~/Musique/workdir&gt;
</code></pre>

<hr>

<p>Then the second step I would create the executable. For that I specify the <code>-I</code>, <code>-L</code> and <code>-l</code> in makefile I as flags:</p>

<pre><code>CXX = g++ 
</code></pre>

<p>and</p>

<pre><code>$(CXX) -O2 -g -fopenmp $(CILIBLAY) $(OUT_OBJS) $(OBJDIR)/$(MAIN_PROG).o -o $(MAIN_PROG).exe 
</code></pre>

<p>but after trying to link it on OpenSuSE, I get an error:</p>

<hr>

<pre><code>morad@linux-nzlc:~/Musique/workdir/layout/analyze&gt; make mainP=runAnalyze
Makefile:85: /home/morad/Musique/workdir/layout/build/analyze/myAnalyze.d: Aucun fichier ou dossier de ce type
g++ -MM -I/cern/CLHEP/2.0.4.5/include/ -I/home/morad/Musique/workdir/layout -I/home/morad/Musique/workdir/library/tklibs -I/cern/ROOT/source/root/include -I/usr/include/freetype2/freetype/ -I/usr/include/freetype2 -I/cern/Minuit2/5.28.00/include -I/usr/include/libxml2 -I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include/ -I/usr/include/glibmm-2.4/ -I/usr/lib/glibmm-2.4/include/ -I/usr/include/sigc++-2.0/ -I/usr/lib/sigc++-2.0/include/ -I/usr/include/glib-2.0/ -I/usr/lib/glib-2.0/include/ -I/cern/gettext/0.18.2/include/ myAnalyze.cc &gt; /home/morad/Musique/workdir/layout/build/analyze/myAnalyze.d.$$; \
sed 's,\(myAnalyze\)\.o[ :]*,\1.o /home/morad/Musique/workdir/layout/build/analyze/myAnalyze.d : ,g' &lt; /home/morad/Musique/workdir/layout/build/analyze/myAnalyze.d.$$ &gt; /home/morad/Musique/workdir/layout/build/analyze/myAnalyze.d; \
rm -f /home/morad/Musique/workdir/layout/build/analyze/myAnalyze.d.$$
g++ -c -I/cern/CLHEP/2.0.4.5/include/ -I/home/morad/Musique/workdir/layout -I/home/morad/Musique/workdir/library/tklibs -I/cern/ROOT/source/root/include -I/usr/include/freetype2/freetype/ -I/usr/include/freetype2 -I/cern/Minuit2/5.28.00/include -I/usr/include/libxml2 -I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include/ -I/usr/include/glibmm-2.4/ -I/usr/lib/glibmm-2.4/include/ -I/usr/include/sigc++-2.0/ -I/usr/lib/sigc++-2.0/include/ -I/usr/include/glib-2.0/ -I/usr/lib/glib-2.0/include/ -I/cern/gettext/0.18.2/include/ myAnalyze.cc -o /home/morad/Musique/workdir/layout/build/analyze/myAnalyze.o 
g++ -c -I/cern/CLHEP/2.0.4.5/include/ -I/home/morad/Musique/workdir/layout -I/home/morad/Musique/workdir/library/tklibs -I/cern/ROOT/source/root/include -I/usr/include/freetype2/freetype/ -I/usr/include/freetype2 -I/cern/Minuit2/5.28.00/include -I/usr/include/libxml2 -I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include/ -I/usr/include/glibmm-2.4/ -I/usr/lib/glibmm-2.4/include/ -I/usr/include/sigc++-2.0/ -I/usr/lib/sigc++-2.0/include/ -I/usr/include/glib-2.0/ -I/usr/lib/glib-2.0/include/ -I/cern/gettext/0.18.2/include/ runAnalyze.cxx -o /home/morad/Musique/workdir/layout/build/analyze/runAnalyze.o
g++ -O2 -g -fopenmp -L/home/morad/Musique/workdir/library/tklibs/lib -L/home/morad/Musique/workdir/layout/lib -lxmlgeom -ltrack -lcross -lMaterialEffects -lPropagators -ltracking -lgeom -lStatUtilities -lAnalyticalJacobians -ltkhist -lxmltkgeom -lutils -lopt -ldraw -lanalyze -L/usr/lib -lGeomPropagators -lPatternPrimitives -lSurfaceGeometry -lBaseMagneticField -lUI -lGenUtil -lSiPixelDet -lSmearingClusterizers -lBasicDet -lTrackFitters -lTkFastSimHit -lCommonStripDet -lDetLayout -lTkLayout -lDetGeometry -lKalmanUpdators -lTkCommonDet -lPatternTools -lTrajectoryParametrization -lBasicStripDet -lDetUtilities -lDetVolumeGeometry -lPatternTestTools -lRKPropagators -lTkNavigation -lNumericalJacobians -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lglib-2.0 -L/cern/ROOT/source/root/lib -L/cern/Minuit2/5.28.00/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lfreetype -lz /usr/lib/libbz2.so.1.0.6 -lpthread -lm -ldl -lMinuit2 -L/cern/CLHEP/2.0.4.5/lib/ -lCLHEP-2.0.4.5 /usr/lib/libstdc++.so.6 /home/morad/Musique/workdir/layout/build/analyze/myAnalyze.o /home/morad/Musique/workdir/layout/build/analyze/runAnalyze.o -o runAnalyze.exe
/home/morad/Musique/workdir/library/tklibs/lib/libSmearingClusterizers.so: undefined reference to `TrivialROUSetter::set(Module)'
/home/morad/Musique/workdir/library/tklibs/lib/libTkLayout.so: undefined reference to `FixTIDTopology::recreateTopologies()'
/home/morad/Musique/workdir/library/tklibs/lib/libSmearingClusterizers.so: undefined reference to `TkDetTypeName::shortName(DetType const&amp;)'
/home/morad/Musique/workdir/library/tklibs/lib/libTkLayout.so: undefined reference to `DetUnitGluer::glue(__gnu_cxx::__normal_iterator&lt;DetUnit**, std::vector&lt;DetUnit*, std::allocator&lt;DetUnit*&gt; &gt; &gt;, __gnu_cxx::__normal_iterator&lt;DetUnit**, std::vector&lt;DetUnit*, std::allocator&lt;DetUnit*&gt; &gt; &gt;, __gnu_cxx::__normal_iterator&lt;DetUnit**, std::vector&lt;DetUnit*, std::allocator&lt;DetUnit*&gt; &gt; &gt;, __gnu_cxx::__normal_iterator&lt;DetUnit**, std::vector&lt;DetUnit*, std::allocator&lt;DetUnit*&gt; &gt; &gt;)'
/home/morad/Musique/workdir/library/tklibs/lib/libTkFastSimHit.so: undefined reference to `RawHepEventFactoryFromGun::RawHepEventFactoryFromGun()'
/home/morad/Musique/workdir/library/tklibs/lib/libTkLayout.so: undefined reference to `toa::operator()(int const&amp;) const'
/home/morad/Musique/workdir/library/tklibs/lib/libTkLayout.so: undefined reference to `FixTIDTopology::FixTIDTopology()'
/home/morad/Musique/workdir/library/tklibs/lib/libTkLayout.so: undefined reference to `DetBlade::DetBlade(__gnu_cxx::__normal_iterator&lt;Det* const*, std::vector&lt;Det*, std::allocator&lt;Det*&gt; &gt; &gt;, __gnu_cxx::__normal_iterator&lt;Det* const*, std::vector&lt;Det*, std::allocator&lt;Det*&gt; &gt; &gt;)'
/home/morad/Musique/workdir/library/tklibs/lib/libTkLayout.so: undefined reference to `toa::~toa()'
/home/morad/Musique/workdir/library/tklibs/lib/libTkLayout.so: undefined reference to `FullTracker::instance()'
collect2: erreur: ld a retourné 1 code d'état d'exécution
make: *** [runAnalyze] Erreur 1
morad@linux-nzlc:~/Musique/workdir/layout/analyze&gt; 
</code></pre>

<hr>

<p>which is not defined in <code>*.so</code>. For example <code>TrivialROUSetter</code> is only declared in a <code>file.h</code> is not defined in <code>file.cc</code>.  I have a hunch that the g++ compiler for OpenSuSE needs flags for it seeking definitions included in <code>*. h</code> if it is necessary, unlike g++ for Mac OS X.</p>
