on 2013 May 14 11:04 AM
hello I apologize if my question bothers you I work on a code developed in C + + which worked well on mac os, this code will help create libraries .so from .cc and .h I used this as flags:CXXFLAGS = -g -O2 -fPIC -Wall -ldl -D_GNU_SOURCE ,CXX := g++ and $(CXX)-shared -o $(LIBNAME) $(CLIBLIB) $(OUT_OBJS)this step is fine I got the .so as follows. :
morad@linux-nzlc:~/Musique/workdir> 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>
then the second step I would create the executable for that I specify the-I,-L and-l in makfile I use as flags:CXX = g++ and $(CXX) -O2 -g -fopenmp $(CILIBLAY) $(OUT_OBJS) $(OBJDIR)/$(MAIN_PROG).o -o $(MAIN_PROG).exe but after running it I get an error:
morad@linux-nzlc:~/Musique/workdir/layout/analyze> 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 > /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' < /home/morad/Musique/workdir/layout/build/analyze/myAnalyze.d.$$ > /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&)' /home/morad/Musique/workdir/library/tklibs/lib/libTkLayout.so: undefined reference to `DetUnitGluer::glue(__gnu_cxx::__normal_iterator<DetUnit**, std::vector<DetUnit*, std::allocator<DetUnit*> > >, __gnu_cxx::__normal_iterator<DetUnit**, std::vector<DetUnit*, std::allocator<DetUnit*> > >, __gnu_cxx::__normal_iterator<DetUnit**, std::vector<DetUnit*, std::allocator<DetUnit*> > >, __gnu_cxx::__normal_iterator<DetUnit**, std::vector<DetUnit*, std::allocator<DetUnit*> > >)' /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&) 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<Det* const*, std::vector<Det*, std::allocator<Det*> > >, __gnu_cxx::__normal_iterator<Det* const*, std::vector<Det*, std::allocator<Det*> > >)' /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>
which is not defined in .so for example TrivialROUSetter is only declared in a file.h is not defined in file.cc I have a hunch that the g+ + compiler for opensuse needs a flags for is seeking definitions includes . h if it is necessary unlike g+ + mac-os thank you in advance
did you know someone expert in this topic please you indicate he to me .I cann't find someone expert in this topic to answer me on this question!!!! this is my communication :http://www.developpez.net/forums/d1342351/cpp/probleme-dans-librairie-dynamique-so-linux/#post7286889 ,http://www.cplusplus.com/forum/unices/101797/ and http://www.aptech.com/questions/problem-in-my-dynamic-lib-so/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.