Search code examples
buildgoogletestqnxqnx-neutrino

How do I compile googleTestLibrary on QNX 6.5.0?


I want to compile google Test Library on QNX. But I did not success. I tried everything. Can be seen my compilation errors below

Is someone share to libGoogleTest_g.a and libGoogleTest.a file for me ?

D:/ETCT_PROJECTS/CommonLibrary/Test/ETCCommon/Common/QNXUnitTests/../../../../GoogleTestLibrary/lib\libgoogleTest_g.a(gtest-all.o): 
In function `_M_initialize_dispatch<const char* const*>':
/usr/qnx650/target/qnx6/usr/include/c++/4.4.2/ext/new_allocator.h:87: undefined reference to `std::__throw_bad_alloc()'
D:/ETCT_PROJECTS/CommonLibrary/Test/ETCCommon/Common/QNXUnitTests/../../../../GoogleTestLibrary/lib\libgoogleTest_g.a(gtest-all.o): 
In function `operator<< <char, std::char_traits<char>, std::allocator<char> >':
/usr/qnx650/target/qnx6/usr/include/c++/4.4.2/bits/basic_string.h:2506:
 undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
D:/ETCT_PROJECTS/CommonLibrary/Test/ETCCommon/Common/QNXUnitTests/../../../../GoogleTestLibrary/lib\libgoogleTest_g.a(gtest-all.o): 
In function `ValueHolder':
/usr/qnx650/target/qnx6/usr/include/c++/4.4.2/ext/new_allocator.h:87: undefined reference to `std::__throw_bad_alloc()'
D:/ETCT_PROJECTS/CommonLibrary/Test/ETCCommon/Common/QNXUnitTests/../../../../GoogleTestLibrary/lib\libgoogleTest_g.a(gtest-all.o): In function `~DeathTestImpl':
/home/emres/GoogleTest/./src/gtest-death-test.cc:374:
 undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/home/emres/GoogleTest/./src/gtest-death-test.cc:374:
 undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/home/emres/GoogleTest/./src/gtest-death-test.cc:374:
 undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'

Solution

  • Check this link to fix the compilation problem. https://code.google.com/p/googletest/issues/detail?id=444 After you fixed the compilation problem, follow the below steps to create your static library files.

    • Generate gtest-all.o object file for all configurations(DEBUG RELEASE) simply open QNX momentics and right click to gtest-all.cc
    • Login to QNX, and copy your gtest-all.o files to any directory
    • enter the directory to where files copied
    • create static libraries by using ar(archive) command as shown below.

      DEBUG : ar -rv libgoogle_test_g.a gtest-all.o

      RELEASE : ar -rv libgoogle_test.a gtest-all.o

    Copy *.a files from QNX and use new static library in your project