[Log4cplus-devel] log4cplus and undefined symbol with Sunstudio
Logging Framework for C++
Brought to you by:
wilx
|
From: Jeremy C. R. <re...@re...> - 2011-05-31 20:28:12
|
Using Sunstudio CC: Sun C++ 5.10 SunOS_sparc 2009/06/03
$ /usr/bin/CC -I/udir/jreed/opt/log4cplus/include -L/udir/jreed/opt/log4cplus/lib -llog4cplus ~/l1.cc
Undefined first referenced
symbol in file
log4cplus::Logger::~Logger() l1.o
log4cplus::Logger log4cplus::Logger::getInstance(const std::string &)
l1.o
ld: fatal: Symbol referencing errors. No output written to a.out
Here is example code:
$ cat ~/l1.cc
#include <log4cplus/logger.h>
int main ()
{
using namespace log4cplus;
Logger logger = Logger::getInstance("main");
return 0;
}
Using g++ for this compiles/links fine. I think Sunstudio is more
strict by default.
Note that the installed log4cplus was builting using g++ (GCC) 3.4.3
(csl-sol210-3_4-branch+sol_rpath).
So the installed header and the logger.cxx code has:
static Logger getInstance(const log4cplus::tstring& name);
getInstance (const log4cplus::tstring& name)
But nm shows:
[2134] | 251340| 48|FUNC |GLOB |0 |227 |log4cplus::Logger::getInstance(std::string )
Notice that the "const" and the "&" (ampersand) is gone.
As for the other undefined symbol, I don't know.
$ nm ~/opt/log4cplus/lib/liblog4cplus.so | c++filt | grep log4cplus::Logger::~Logger
[1852] | 251568| 104|FUNC |GLOB |0 |227 |log4cplus::Logger::~Logger()
[2116] | 251136| 108|FUNC |GLOB |0 |227 |log4cplus::Logger::~Logger()
[1369] | 251460| 108|FUNC |GLOB |0 |227 |log4cplus::Logger::~Logger()
I had this problem with 1.0.4 and with code from subversion (I am at
revision 1535).
This may not be a log4cplus problem, but maybe someone here recognizes
this or has some ideas?
Thanks,
Jeremy C. Reed
|