|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
FW: Linking errors: log4cxx as a shared library in Linux : 'Undefined Reference' to log4cxx methodsHello: log4cxx is compiled and installed in a linux machine. The shared library files (liblog4cxx.a, liblog4cxx.la,
liblog4cxx.so, liblog4cxx.so.9.0.0) are installed in the directory “home/corona/HEAP/BUILD/lib”. The shared library, “libStatusReporting.so” uses
“liblog4xcc”. ----------------------------------------------------------------------------------------- The command line for linking “libStatusReporting.so”
is shown below g++ -Wl,--rpath,/home/corona/HEAP/BUILD/lib
-Wl,-rpath,/usr/local/Trolltech/Qt-4.4.3/lib -shared
-Wl,-soname,libStatusReporting.so.1 -o libStatusReporting.so.1.0.0
debug/HApplicationInfo.o debug/HBaseException.o debug/HCallStackInfo.o
debug/HCInterface.o debug/HDivideByZeroException.o debug/HEventInfoHandler.o
debug/HExceptionAttribute.o debug/HExternStatusLogging.o debug/HGUI.o
debug/HInfoVersion.o debug/HLogFilter.o debug/HLogReport.o debug/HLogRouter.o
debug/HMessageBox.o debug/HMessageRouter.o debug/HNullException.o
debug/HProcessInfo.o debug/HStatusBinder.o debug/HStatusCodes_StatusLogger.o
debug/HStatusCollector.o debug/HStatusInfoManager.o debug/HStatuslogger.o
debug/HStatusLoggerC.o debug/HStatusTranslator.o debug/HUserFriendlyMessage.o
debug/HUserFriendlyMessageC.o debug/moc_HMessageBox.o
debug/qrc_Resources.o -L/usr/local/Trolltech/Qt-4.4.3/lib
-L/usr/X11R6/lib -L./../../../lib -L. -L/usr/local/lib -llog4cxx -lQtSql
-L/usr/local/Trolltech/Qt-4.4.3/lib -pthread -pthread -lQtXml -pthread -pthread
-lQtOpenGL -L/usr/X11R6/lib -pthread -pthread -pthread -pthread -pthread
-pthread -pthread -pthread -lQtGui -pthread -lpng -lSM -lICE -pthread -pthread
-lXi -lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtNetwork
-pthread -pthread -lQtCore -lz -lm -pthread -lgthread-2.0 -lglib-2.0 -lrt -ldl
-lGLU -lGL -lpthread ln -s libStatusReporting.so.1.0.0 libStatusReporting.so ln -s libStatusReporting.so.1.0.0 libStatusReporting.so.1 ln -s libStatusReporting.so.1.0.0 libStatusReporting.so.1.0 rm -f Debug/libStatusReporting.so.1.0.0 rm -f Debug/libStatusReporting.so rm -f Debug/libStatusReporting.so.1 rm -f Debug/libStatusReporting.so.1.0 mv -f libStatusReporting.so.1.0.0 libStatusReporting.so
libStatusReporting.so.1 libStatusReporting.so.1.0 Debug/ The “ldd” output for “libStatusReporting.so” is below. (It
states liblog4cxx.so.9 is linked ) liblog4cxx.so.9
=> /home/corona/HEAP/BUILD/lib/liblog4cxx.so.9 (0x00e49000) libQtSql.so.4
=> /usr/local/Trolltech/Qt-4.4.3/lib/libQtSql.so.4 (0x00c70000) libQtXml.so.4
=> /usr/local/Trolltech/Qt-4.4.3/lib/libQtXml.so.4 (0x0034c000) libQtOpenGL.so.4
=> /usr/local/Trolltech/Qt-4.4.3/lib/libQtOpenGL.so.4 (0x00460000) libQtGui.so.4
=> /usr/local/Trolltech/Qt-4.4.3/lib/libQtGui.so.4 (0x00f3c000) libpng12.so.0
=> /usr/lib/libpng12.so.0 (0x00111000) libSM.so.6 =>
/usr/X11R6/lib/libSM.so.6 (0x00135000) libICE.so.6 =>
/usr/X11R6/lib/libICE.so.6 (0x0021d000) libXi.so.6 =>
/usr/X11R6/lib/libXi.so.6 (0x005d4000) libXrender.so.1
=> /usr/X11R6/lib/libXrender.so.1 (0x0013e000) libXrandr.so.2
=> /usr/X11R6/lib/libXrandr.so.2 (0x0025a000) libfreetype.so.6
=> /usr/lib/libfreetype.so.6 (0x00146000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00be7000) libXext.so.6
=> /usr/X11R6/lib/libXext.so.6 (0x00a00000) libX11.so.6 =>
/usr/X11R6/lib/libX11.so.6 (0x0025d000) libQtNetwork.so.4
=> /usr/local/Trolltech/Qt-4.4.3/lib/libQtNetwork.so.4 (0x005dc000) libQtCore.so.4
=> /usr/local/Trolltech/Qt-4.4.3/lib/libQtCore.so.4 (0x006f5000) libz.so.1 =>
/usr/lib/libz.so.1 (0x00b64000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x001b1000) libglib-2.0.so.0
=> /usr/lib/libglib-2.0.so.0 (0x003ca000) librt.so.1 =>
/lib/tls/librt.so.1 (0x001b5000) libdl.so.2 =>
/lib/libdl.so.2 (0x001c9000) libGLU.so.1 =>
/usr/X11R6/lib/libGLU.so.1 (0x004df000) libGL.so.1 =>
/usr/X11R6/lib/libGL.so.1 (0x00556000) libpthread.so.0
=> /lib/tls/libpthread.so.0 (0x00cec000) libstdc++.so.6
=> /usr/lib/libstdc++.so.6 (0x00cfe000) libm.so.6 =>
/lib/tls/libm.so.6 (0x00b35000) libgcc_s.so.1
=> /lib/libgcc_s.so.1 (0x001cd000) libc.so.6 =>
/lib/tls/libc.so.6 (0x06a21000) libxml2.so.2
=> /usr/lib/libxml2.so.2 (0x0690e000)
libboost_regex.so.1 => /usr/lib/libboost_regex.so.1 (0x0093a000) libexpat.so.0
=> /usr/lib/libexpat.so.0 (0x001d7000)
/lib/ld-linux.so.2 (0x00ad5000) libXxf86vm.so.1
=> /usr/X11R6/lib/libXxf86vm.so.1 (0x001f6000) Now I try to build the test client for
“libStatusReporting.so”; it’s an executable that uses “libStatusReporting.so”.
I get link time errors stating that some methods in “liblog4xcc” have undefined
references from “libStatusReporting.so”. ------------------------------------------------------------------------------ The command line for linking the test client executable. I
have checked and rechecked the path for the libraries; it’s a relative path
here: “-L./../../lib” which is the same as “home/corona/HEAP/BUILD/lib”. So, I
believe, library path is not the issue. g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.4.3/lib -o
debug/Status_Reporting_Driver_GUI debug/main.o debug/status_reporting_driver_gui.o
debug/moc_status_reporting_driver_gui.o debug/qrc_Resources.o
-L/usr/local/Trolltech/Qt-4.4.3/lib -L./../../lib -lStatusReporting -lQtSql
-L/usr/local/Trolltech/Qt-4.4.3/lib -pthread -pthread -lQtXml -pthread -pthread
-lQtGui -L/usr/X11R6/lib -pthread -lpng -lSM -lICE -pthread -pthread -lXi
-lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtNetwork -pthread
-pthread -lQtCore -lz -lm -pthread -lgthread-2.0 -lglib-2.0 -lrt -ldl -lpthread ./../../lib/libStatusReporting.so: undefined reference to
`log4cxx::Logger::info(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)' ./../../lib/libStatusReporting.so: undefined reference to
`log4cxx::File::exists(log4cxx::helpers::Pool&) const' ./../../lib/libStatusReporting.so: undefined reference to
`log4cxx::File::File(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)' ./../../lib/libStatusReporting.so: undefined reference to
`log4cxx::helpers::Pool::~Pool()' ./../../lib/libStatusReporting.so: undefined reference to
`log4cxx::helpers::Pool::Pool()' ./../../lib/libStatusReporting.so: undefined reference to
`log4cxx::PropertyConfigurator::configure(log4cxx::File const&)' ./../../lib/libStatusReporting.so: undefined reference to
`log4cxx::File::~File()' ./../../lib/libStatusReporting.so: undefined reference to
`log4cxx::helpers::ObjectPtrBase::exchange(void volatile**, void*)' collect2: ld returned 1 exit status make: *** [debug/Status_Reporting_Driver_GUI] Error 1 Any idea why these error were not encountered while linking
“libStatusReporting.so” in the first place? Is there something incorrect that I might be doing in the
build process or is it that log4cxx was not build properly? If necessary, I could also post the “nm” (symbol table
details) output for “liblog4cxx”. Thanks
& Regards, Saswata
Goswami |
| Free embeddable forum powered by Nabble | Forum Help |