I'am trying to use cppunit 1.8.0 with SunOS 5.8 and gcc 2.95.2.
I've already spent few hours to get it working - unfortunatelly with static linkage only. Now I stuck in bigger problem. Static linkage disqualifies using pthreads because it has only dynamic library. But even when I do not use pthread library explicit when linking, but only declaring -D_PTHREADS, linker has problems with cppunit. What's going on? On linux it works, on Solaris not. Using followind main.cpp file defined as:
#include <cppunit/ui/text/TestRunner.h>
int main( int argc, char **argv)
{
CppUnit::TextUi::TestRunner runner;
runner.run();
return 0;
}
when compiled this way, everything is ok:
$ g++ -c -o main.o main.cpp
$ g++ -o test main.o -lcppunit
but doing such thing, is not:
$ g++ -D_PTHREADS -c -o main.o main.cpp
$ g++ -o test main.o -lcppunit
Undefined first referenced
symbol in file
CppUnit::TextUi::TestRunner::run(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >, bool, bool, bool)main.o
ld: fatal: Symbol referencing errors. No output written to test
collect2: ld returned 1 exit status
Any ideas? It seems that Java is better solution, especially in such problems like this :/
Second problem is that I'am not fluent in low-level updates. I have read about problems with exception handling (ld does not support building shared libraries with exception suport because it is designed for C not C++) which causes abort (and core dump) on assert which raises exception. What should I do? Do I need replace ld linker to allow dynamic binding C++ libraries at runtime? Keeping in mind I need pthreads it looks like only way. What is minimal change on development server? I do not want begin revolution on this SunOS host.
Thanx for any advice.
andrew
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'am trying to use cppunit 1.8.0 with SunOS 5.8 and gcc 2.95.2.
I've already spent few hours to get it working - unfortunatelly with static linkage only. Now I stuck in bigger problem. Static linkage disqualifies using pthreads because it has only dynamic library. But even when I do not use pthread library explicit when linking, but only declaring -D_PTHREADS, linker has problems with cppunit. What's going on? On linux it works, on Solaris not. Using followind main.cpp file defined as:
#include <cppunit/ui/text/TestRunner.h>
int main( int argc, char **argv)
{
CppUnit::TextUi::TestRunner runner;
runner.run();
return 0;
}
when compiled this way, everything is ok:
$ g++ -c -o main.o main.cpp
$ g++ -o test main.o -lcppunit
but doing such thing, is not:
$ g++ -D_PTHREADS -c -o main.o main.cpp
$ g++ -o test main.o -lcppunit
Undefined first referenced
symbol in file
CppUnit::TextUi::TestRunner::run(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >, bool, bool, bool)main.o
ld: fatal: Symbol referencing errors. No output written to test
collect2: ld returned 1 exit status
Any ideas? It seems that Java is better solution, especially in such problems like this :/
Second problem is that I'am not fluent in low-level updates. I have read about problems with exception handling (ld does not support building shared libraries with exception suport because it is designed for C not C++) which causes abort (and core dump) on assert which raises exception. What should I do? Do I need replace ld linker to allow dynamic binding C++ libraries at runtime? Keeping in mind I need pthreads it looks like only way. What is minimal change on development server? I do not want begin revolution on this SunOS host.
Thanx for any advice.
andrew