Hi,
I just build a static version from the svn head and tried to compile a little 
test programm with static linking. Without success till now. :/
Perhaps someone can give me a hint, what i might have done wrong.
So here is what I did so far:

Build SVN Version with:
ant -Ddebug=true -Doptimize=none -Dlib.type=static -Dapr.lib.type=static 
-Daprutil.lib.type=static -Dapriconv.lib.type=static 

Produced libapr-1.a, libaprutil-1.a, liblog4cxx.a and some other files in 
build/debug/static

Than I wrote a little test programm:
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
#include <log4cxx/helpers/exception.h>

#include <iostream>

using namespace std;
using namespace log4cxx;
using namespace log4cxx::helpers;

LoggerPtr logger(Logger::getLogger("MyLogging.Test"));

int main(int argc, char *argv[])
{
//  LOG4CXX_ERROR(logger, "My first error Log");
  cout << "jojo" << endl;


return 0;
}


And tried to compile it with:
g++ -I./include -L./lib -llog4cxx  -static -o test  test.cpp

And the result is:
/tmp/ccUOHsmb.o: In function `__static_initialization_and_destruction_0(int, 
int)':
test.cpp:(.text+0xda): undefined reference to `log4cxx::Logger::getLogger(char 
const*)'
collect2: ld returned 1 exit status

And yes, I copied the log4cxx include dir to ./include and the .a to ./lib
When I build and shared version with ant first and than do the same thing 
with .so and without -static everything works just fine.

Hope someone can help me.

Best regards, 
Daniel

PS: Anyone knows how to cross-compile log4cxx with ant? 

Reply via email to