Build with QNX Momentix Toolchain

864 views
Skip to first unread message

Daniel Graupner

unread,
Nov 2, 2010, 3:45:25 AM11/2/10
to Google C++ Testing Framework
Hello

we'd like to run our tests directly on a QNX target. They use a
modified gcc.

I tried to compile it without GTEST_OD_* define and -
DGTEST_USE_OWN_TR1_TUPLE=1.

Now there are some errors I do not know how to deal with:
In file included from C:/dagr2587/Projects/ADAS/ASW_FAS/projects/
Elektrobit/ADAS_MIB_X/gtest/include/gtest/internal/gtest-internal.h:
40,
from C:/dagr2587/Projects/ADAS/ASW_FAS/projects/
Elektrobit/ADAS_MIB_X/gtest/include/gtest/gtest.h:57,
from C:/dagr2587/Projects/ADAS/ASW_FAS/projects/
Elektrobit/ADAS_MIB_X/gtest/src/gtest-all.cc:39:
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h: In function 'int
testing::internal::posix::IsATTY(int)':
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h:1313: error: 'isatty' was not
declared in this scope
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h: In function 'int
testing::internal::posix::RmDir(const char*)':
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h:1319: error: 'rmdir' was not
declared in this scope
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h: In function 'int
testing::internal::posix::ChDir(const char*)':
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h:1341: error: 'chdir' was not
declared in this scope
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h: In function 'int
testing::internal::posix::Read(int, void*, unsigned int)':
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h:1355: error: 'read' was not
declared in this scope
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h: In function 'int
testing::internal::posix::Write(int, const void*, unsigned int)':
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h:1358: error: 'write' was not
declared in this scope
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h: In function 'int
testing::internal::posix::Close(int)':
C:/dagr2587/Projects/ADAS/ASW_FAS/projects/Elektrobit/ADAS_MIB_X/gtest/
include/gtest/internal/gtest-port.h:1360: error: 'close' was not
declared in this scope
cc: C:/QNX650/host/win32/x86/usr/lib/gcc/arm-unknown-nto-
qnx6.5.0/4.4.2/cc1plus caught signal 1
make[3]: *** [gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[2]: *** [gtest/CMakeFiles/gtest.dir/all] Error 2
make[1]: *** [gtest/CMakeFiles/gtest.dir/rule] Error 2
make: *** [gtest] Error 2

Any suggestions?

Thanks
Daniel

Vlad Losev

unread,
Nov 2, 2010, 10:56:32 PM11/2/10
to Daniel Graupner, Google C++ Testing Framework
Hi Daniel,

The POSIX standard -- to which Google Test is designed -- dictates that functions read, write, close, chdir, rmdir, and isatty be declared in the header <unistd.h>. If your toolchain declares them in another header, patch gtest-port.h to #include it.

HTH,
Vlad


Thanks
Daniel

Vlad Losev

unread,
Feb 9, 2011, 3:41:16 PM2/9/11
to DZhon, Google C++ Testing Framework
[adding back the list]

On Wed, Feb 9, 2011 at 8:39 AM, DZhon <thed...@gmail.com> wrote:
Ok, first of all, gtest doesn`t support QNX as POSIX-system. Please,
add __QNX__ variable for POSIX lists in internal/gtest-port.h

gtest did away with the list of POSIX systems in revision 448.
 
Also, with QCC (QNX default toolchain) pthreads detection doesnt`work.
Manually adding #include <pthread.h> helps me get gtest works !

Update gtest to a later revision and you only need to add -DGTEST_HAS_PTHREAD=1 to your compiler options to have pthread.h included. If you use the configure script, that can be achieved by giving it the --with-pthreads=yes option.
 
Finally, QNX QCC doesn`t support tr1 tuple, which can be handled by -
DGTEST_HAS_OWN_TR1_TUPLE.
Reply all
Reply to author
Forward
0 new messages