Apologies if this post is in the in-appropriate forum.
I'm building a small program which utilizes the log4cpp program for logging.
Below are a description of my files:
Testing.java -- Java test program which defines and uses a native method
Testing.cpp -- JNI C++ program which calls another C++ program
TestLog.cpp -- C++ program which instantiates the log4cpp for logging
Test.cpp -- C++ test program to use TestLog.cpp directly to verify that TestLog actually works.
Steps I've done:
1) Compile Testing.java to create the JNI header file for Testing.cpp
2) Compile TestLog.cpp and use TestLog.o to build a libtest.a file like so:
"g++ -o libtest.a TestLog.o ../log4cpp/include/*.o -shared -static -lc"
3) Compile Testing.cpp and create a libtesting.so using libtest.a and Testing.o
"g++ -o libtesting.so -shared -static -lc -L./ -ltest -I./ -I../log4cpp/include -I/usr/java/include -I/usr/java/include/linux Testing.cpp"
4) Check that the LD_LIBRARY_PATH parameter points to where my libtesting.so is.
It compiles fine, but when I tried to run Testing.java, the JVM bombs, giving a "Unexpected signal: 11 occured at PC=0x0".
When I comment off the log4cpp stuff in my C++ codes, the JNI works fine. And when I use my Test.cpp to verify log4cpp, it works fine too. I'm suspecting it is due to the way I use g++, that it somehows "forgot" about log4cpp. Perhaps I missed out some important flags during compilation or something?
Thanks!
regards,
Betty
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear all,
Apologies if this post is in the in-appropriate forum.
I'm building a small program which utilizes the log4cpp program for logging.
Below are a description of my files:
Testing.java -- Java test program which defines and uses a native method
Testing.cpp -- JNI C++ program which calls another C++ program
TestLog.cpp -- C++ program which instantiates the log4cpp for logging
Test.cpp -- C++ test program to use TestLog.cpp directly to verify that TestLog actually works.
Steps I've done:
1) Compile Testing.java to create the JNI header file for Testing.cpp
2) Compile TestLog.cpp and use TestLog.o to build a libtest.a file like so:
"g++ -o libtest.a TestLog.o ../log4cpp/include/*.o -shared -static -lc"
3) Compile Testing.cpp and create a libtesting.so using libtest.a and Testing.o
"g++ -o libtesting.so -shared -static -lc -L./ -ltest -I./ -I../log4cpp/include -I/usr/java/include -I/usr/java/include/linux Testing.cpp"
4) Check that the LD_LIBRARY_PATH parameter points to where my libtesting.so is.
It compiles fine, but when I tried to run Testing.java, the JVM bombs, giving a "Unexpected signal: 11 occured at PC=0x0".
When I comment off the log4cpp stuff in my C++ codes, the JNI works fine. And when I use my Test.cpp to verify log4cpp, it works fine too. I'm suspecting it is due to the way I use g++, that it somehows "forgot" about log4cpp. Perhaps I missed out some important flags during compilation or something?
Thanks!
regards,
Betty