Details
Description
Successfully downloaded compiled and linked log4cxx.so
total 43512 -rwxr-xr-x 1 X users 11701516 Oct 14 11:20 liblog4cxx.so.10.0.0 lrwxrwxrwx 1 X users 20 Oct 14 11:20 liblog4cxx.so.10 -> liblog4cxx.so.10.0.0 lrwxrwxrwx 1 X users 20 Oct 14 11:20 liblog4cxx.so -> liblog4cxx.so.10.0.0 -rwxr-xr-x 1 X users 1061 Oct 14 11:20 liblog4cxx.la -rw-r--r-- 1 X users 31221258 Oct 14 11:20 liblog4cxx.a
client code is very simple, will need to reduce code to make it understandable if we need to go there - Currently only interested in getting past a custom application compilation and linking of libraries in the simplest way possible - the custom application references the following log4cxx directives
... #include "log4cxx/logstring.h" #include "log4cxx/logger.h" #include "log4cxx/basicconfigurator.h" #include "log4cxx/helpers/exception.h" #include "log4cxx/helpers/messagebuffer.h" #include "log4cxx/ndc.h" ... using namespace log4cxx; using namespace log4cxx::helpers; using log4cxx::Logger; ... LoggerPtr logger(Logger::getLogger("MyApp")); ... LOG4CXX_WARN(logger, "WARN Entering getintv"); ...
Compilation references the include directory (-I/X/include) as well as the library directory (-L/X/lib) where the log4cxx libraries and includes are found (on the X path as seen above from the log4cxx lib listing) along with -llog4cxx
/usr/bin/g++ -z muldefs -m64 -L/X/lib -L/usr/lib64 -I/X/include -I../common -L/lib64 -L/home/oracle/app/product/11.1.0/db_1/precomp/lib/ -L/home/oracle/app/product/11.1.0/db_1/lib/ -L/home/oracle/app/product/11.1.0/db_1/lib/stubs/ -lc -lstdc++ -lclntsh -llog4cxx -o getintv getintv.o ../../../lib/debug/stproc.o ../../../lib/debug/list.o msg.o common.o fctl.o bcp.o xtrct.o
The result of the compilation
getintv.cc:237: undefined reference to `log4cxx::helpers::MessageBuffer::MessageBuffer()' getintv.o(.text+0x1ff):getintv.cc37: undefined reference to `log4cxx::helpers::MessageBuffer::operator<<(char const*)' getintv.o(.text+0x20e):getintv.cc:237: undefined reference to `log4cxx::helpers::MessageBuffer::str(log4cxx::helpers::CharMessageBuffer&)' getintv.o(.text+0x2a3):getintv.cc:237: undefined reference to `log4cxx::helpers::MessageBuffer::~MessageBuffer()' getintv.o(.text+0x2bb):getintv.cc:237: undefined reference to `log4cxx::helpers::MessageBuffer::~MessageBuffer()' getintv.o(.text+0x2e1):getintv.cc:238: undefined reference to `log4cxx::helpers::MessageBuffer::MessageBuffer()' getintv.o(.text+0x31b):getintv.cc:238: undefined reference to `log4cxx::helpers::MessageBuffer::operator<<(char const*)' getintv.o(.text+0x32a):getintv.cc:238: undefined reference to `log4cxx::helpers::MessageBuffer::str(log4cxx::helpers::CharMessageBuffer&)' getintv.o(.text+0x3bf):getintv.cc:238: undefined reference to `log4cxx::helpers::MessageBuffer::~MessageBuffer()' getintv.o(.text+0x3d7):getintv.cc:238: undefined reference to `log4cxx::helpers::MessageBuffer::~MessageBuffer()' collect2: ld returned 1 exit status
I extracted symbols (using nm - list symbols from object files) from liblog4cxx.a and was not able to find log4cxx::helpers::MessageBuffer - Instead I found references to only log4cxx::helpers::CharMessageBuffer
{code) nm -C liblog4cxx.a {code}will generate a large file, here is a small excerpt around grepping for MessageBuffer
U __gxx_personality_v0 U memcpy U strlen U _Unwind_Resume U operator delete(void*) 0000000000000030 T log4cxx::helpers::CharMessageBuffer::str(log4cxx::helpers::CharMessageBuffer&) 0000000000000760 T log4cxx::helpers::CharMessageBuffer::str(std::basic_ostream<char, std::char_traits<char> >&) 0000000000000230 T log4cxx::helpers::CharMessageBuffer::CharMessageBuffer() 0000000000000240 T log4cxx::helpers::CharMessageBuffer::CharMessageBuffer() 0000000000000350 T log4cxx::helpers::CharMessageBuffer::operator std::basic_ostream<char, std::char_traits<char> >&() 00000000000000d0 T log4cxx::helpers::CharMessageBuffer::~CharMessageBuffer() 0000000000000180 T log4cxx::helpers::CharMessageBuffer::~CharMessageBuffer() 0000000000000700 T log4cxx::helpers::CharMessageBuffer::operator<<(bool) 0000000000000250 T log4cxx::helpers::CharMessageBuffer::operator<<(char) 00000000000005c0 T log4cxx::helpers::CharMessageBuffer::operator<<(double) 0000000000000580 T log4cxx::helpers::CharMessageBuffer::operator<<(long double) 00000000000005f0 T log4cxx::helpers::CharMessageBuffer::operator<<(float) 0000000000000680 T log4cxx::helpers::CharMessageBuffer::operator<<(int) 0000000000000660 T log4cxx::helpers::CharMessageBuffer::operator<<(unsigned int) 0000000000000640 T log4cxx::helpers::CharMessageBuffer::operator<<(long) 0000000000000620 T log4cxx::helpers::CharMessageBuffer::operator<<(unsigned long) 00000000000000c0 T log4cxx::helpers::CharMessageBuffer::operator<<(char*) 0000000000000720 T log4cxx::helpers::CharMessageBuffer::operator<<(std::ios_base& (*)(std::ios_base&)) 0000000000000050 T log4cxx::helpers::CharMessageBuffer::operator<<(char const*) 0000000000000560 T log4cxx::helpers::CharMessageBuffer::operator<<(void*) 0000000000000000 T log4cxx::helpers::CharMessageBuffer::operator<<(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) 00000000000006c0 T log4cxx::helpers::CharMessageBuffer::operator<<(short)
Before I dig into the code I used to integrate log4cxx, should there be symbols in the log4cxx library for log4cxx::helpers::MessageBuffer