ddavis2speedray / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

CUDA compiler don't support TR1 #249

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. write a ".cu" file that includes <gtest/gtest.h>
2. Compile it with NVCC

What is the expected output? What do you see instead?

Should Compile. However, it compiles error with 
"/usr/include/c++/4.3/tr1/tuple"
The previous lines of errors are:
$/usr/local/cuda/bin/nvcc -c -arch=sm_13 -deviceemu -g -I. -
I/usr/local/cuda/include -I/home/XXXXX/googlelibs/include -O  -o test.o 
test.cu

/usr/include/c++/4.3/tr1/tuple(74): error: expected an identifier

/usr/include/c++/4.3/tr1/tuple(82): error: too few arguments for class 
template "std::tr1::_Tuple_impl"

/usr/include/c++/4.3/tr1/tuple(82): error: too few arguments for class 
template "std::tr1::_Tuple_impl"

What version of the product are you using? On what operating system?

Ubuntu 9.04
GCC 4.3.3
NVCC release 2.3, V0.2.1221

Please provide any additional information below, such as a code snippet.

At line around 382 in <gtest/internal/gtest-port.h>, it defines the macro 
GTEST_USE_OWN_TR1_TUPLE to be as
"""
#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
#define GTEST_USE_OWN_TR1_TUPLE 0
#else
#define GTEST_USE_OWN_TR1_TUPLE 1
#endif  // defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
"""
which results 0 for NVCC will finally use GCC to compile. But NVCC doesn't 
support TR1 yet, and doesn't accept "-std=c++0x" either. So it goes wrong 
if <tuple> is included.

My current workaround is to set GTEST_USE_OWN_TR1_TUPLE 1 if the macro 
__CUDACC__ is defined. __CUDACC__ is a predefined macro if the compiler is 
NVCC.

Original issue reported on code.google.com by jeru.sh...@gmail.com on 27 Jan 2010 at 1:00

GoogleCodeExporter commented 9 years ago

Original comment by w...@google.com on 27 Jan 2010 at 5:02

GoogleCodeExporter commented 9 years ago
Fixed in revision 368 in the trunk.

Original comment by w...@google.com on 27 Jan 2010 at 10:28

GoogleCodeExporter commented 9 years ago
Interesting, didn't have this problem on my Mac (older gcc version, same CUDA 
version).. however on Ubuntu I have the same problem..

Original comment by n.brueng...@gmail.com on 22 Aug 2010 at 10:33