/opt/gcc/4.8.2/snos/lib/gcc/x86_64-suse-linux/4.8.2/include/stddef.h(432): error: identifier "nullptr" is undefined
/opt/gcc/4.8.2/snos/lib/gcc/x86_64-suse-linux/4.8.2/include/stddef.h(432): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/x86_64-suse-linux/bits/c++config.h(190): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/exception(63): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/exception(68): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/exception(76): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/exception(83): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/exception(93): error: expected a "{"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(64): error: function "std::current_exception" returns incomplete type "std::__exception_ptr::exception_ptr"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(64): error: expected a "{"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(79): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(81): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(82): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(84): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(86): error: declaration is incompatible with previous "std::current_exception"
(64): here
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(86): error: use of a local type to declare a function
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(86): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(87): error: use of a local type to declare a function
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(90): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(92): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(95): error: incomplete type is not allowed
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(95): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(116): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(126): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(143): error: use of a local type to declare a function
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(144): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(147): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(152): error: use of a local type to declare a function
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(153): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(156): error: use of a local type to declare a function
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(157): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(160): error: use of a local type to declare a function
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(161): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/exception_ptr.h(169): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/nested_exception.h(57): error: incomplete type is not allowed
/opt/gcc/4.8.2/snos/include/g++/bits/nested_exception.h(60): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/nested_exception.h(66): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/bits/nested_exception.h(70): error: identifier "rethrow_exception" is undefined
/opt/gcc/4.8.2/snos/include/g++/bits/nested_exception.h(73): error: function "std::nested_exception::nested_ptr" returns incomplete type "std::__exception_ptr::exception_ptr"
/opt/gcc/4.8.2/snos/include/g++/new(95): error: expected a "{"
/opt/gcc/4.8.2/snos/include/g++/new(110): error: identifier "__p" is undefined
/opt/gcc/4.8.2/snos/include/g++/new(111): error: expected a "{"
/opt/gcc/4.8.2/snos/include/g++/new(115): error: expected a "{"
/opt/gcc/4.8.2/snos/include/g++/new(116): error: expected a "{"
/opt/nvidia/cudatoolkit6.5/6.5.14-1.0502.9613.6.1/include/common_functions.h(92): warning: exception specification is incompatible with that of previous function "operator new"
/opt/gcc/4.8.2/snos/include/g++/new(111): here
/opt/nvidia/cudatoolkit6.5/6.5.14-1.0502.9613.6.1/include/common_functions.h(93): warning: exception specification is incompatible with that of previous function "operator delete(void *, void *)"
/opt/gcc/4.8.2/snos/include/g++/new(115): here
/opt/nvidia/cudatoolkit6.5/6.5.14-1.0502.9613.6.1/include/common_functions.h(94): warning: exception specification is incompatible with that of previous function "operator delete"
/opt/gcc/4.8.2/snos/include/g++/new(116): here
/opt/gcc/4.8.2/snos/include/g++/bits/cpp_type_traits.h(184): error: identifier "char16_t" is undefined
/opt/gcc/4.8.2/snos/include/g++/bits/cpp_type_traits.h(191): error: identifier "char32_t" is undefined
/opt/gcc/4.8.2/snos/include/g++/bits/cpp_type_traits.h(191): error: class "std::__is_integer<
/opt/gcc/4.8.2/snos/include/g++/bits/cpp_type_traits.h(314): error: namespace "std::__gnu_cxx" has no member "__normal_iterator"
/opt/gcc/4.8.2/snos/include/g++/bits/cpp_type_traits.h(314): error: expected a ">"
/opt/gcc/4.8.2/snos/include/g++/cmath(80): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(80): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(105): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(105): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(105): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(124): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(124): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(124): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(143): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(143): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(143): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(162): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(162): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(162): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(183): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(183): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(183): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(202): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(202): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(202): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(221): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(221): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(221): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(240): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(240): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(240): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(259): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(259): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(259): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(278): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(278): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(278): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(297): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(297): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(297): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(328): error: "constexpr" is not a function or static data member
/opt/gcc/4.8.2/snos/include/g++/cmath(337): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(337): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(337): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(356): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(356): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(356): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(375): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(375): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(375): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(406): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(406): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(406): error: expected a ";"
/opt/gcc/4.8.2/snos/include/g++/cmath(443): error: inline specifier allowed on function declarations only
/opt/gcc/4.8.2/snos/include/g++/cmath(443): error: variable "std::constexpr" has already been defined
/opt/gcc/4.8.2/snos/include/g++/cmath(443): error: expected a ";"
Error limit reached.
100 errors detected in the compilation of "/tmp/tmpxft_00001363_00000000-6_main.cpp1.ii".
Compilation terminated.
CMake Error at picongpu_generated_main.cu.o.cmake:264 (message):
Error generating file
/ccs/home/anshuman/ComputationalRadiationPhysics/picongpu-repos/release-0.1.1-09-17-2015/builds/008/build_picongpu/CMakeFiles/picongpu.dir//./picongpu_generated_main.cu.o
make[2]: ** [build_picongpu/CMakeFiles/picongpu.dir/picongpu_generated_main.cu.o] Error 1
make[1]: ** [build_picongpu/CMakeFiles/picongpu.dir/all] Error 2
make: *** [all] Error 2
Probably related to this post on so
I think the gnu compiler 4.8 not supports c++11 very well also nvcc with the toolkit 6.5 not supports c++11.
Please try to use gnu 4.9.2+
@anshumang funny, the stackoverflow answer you linked is my answer ;)
to make it short: PIConGPU does not yet have official C++11 support (not even for host-side compilers), nor are our build scripts yet designed for it.
We are currently adding more support to PMacc to work with C++11 in dev, but this is just part of the story. We are planning to move to a fully-flavoured C++11 code base in roughly two stable releases in both device and host-side kernels, but since this needs a lot of work, will cause some re-designs of input files and we will need CUDA 7.0+ (or maybe even 7.5) on all machines for it we can not rush it (nor do we have the capacities to quickly spin of a preview).
Due to the very "conservative" CUDA version updates on Titan (vendors need to adapt to new drivers/apis/frameworks and environments need to stay stable), it is likely to be the major machine holding back our C++11 upgrade. I personally expect official host&device C++11 support in early/mid 2016 on it earliest.
In case the newer version of gcc as suggested by @psychocoderHPC does not help about it:
Do you urgently need C++11 or can you compile and link the parts using C++11 separately?
Also: how did you pass the flag exactly (env var, cmd line, etc.)?
tried it with module gcc/4.9.3 (not supported by CUDA 6.5) and the default gcc/4.8.2 with export CXXFLAGS="-std=c++11" and got the same problem.
also $PICSRC/configure -c"-DCUDA_NVCC_FLAGS='-Xcompiler=-std=c++11'" <pathToCase> did not cut it, but as I said our scripts are also not yet tuned to support it.
seems like export CXXFLAGS="-std=c++11" and $PICSRC/configure -c"-DCUDA_PROPAGATE_HOST_FLAGS=OFF" <pathToCase> could work, maybe passing some more -Xcompiler= flags for now...
Thanks @psychocoderHPC and @ax3l for following up...I wanted to use C++11 for the convenience of thread, condition_variable, mutex and unique_lock....I fell back to using pthread_*...
I feel your pain :S
you could also go with boost thread or boost asio for the while.
Finally using nanomsg which is trouble-free on Titan :relieved:
I successfully compiled PMacc with C++11 on my local machine and hypnos (HZDR cluster) with CUDA 7 and 7.5 with gcc 4.8.2 as the host compiler.
So your problem is simply: CUDA 6.5 does not support C++11. The first error should have already beaten you to it error: identifier "nullptr" is undefined. nullptr is a C++11 feature. So if the compiler complains about it, it is not a C++11 compiler ;)
For future use: set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++11") in the CMakelists enables C++11 support for CUDA and host compiler. Probably running $PICSRC/configure -c"-DCUDA_NVCC_FLAGS='-std=c++11'" <pathToCase> would already solve the problem. Do not try to pass it to XCompiler as nvcc must know about that!
So your problem is simply: CUDA 6.5 does not support C++11
the problem is, that is not the case: CUDA 6.5 added undocumented, experimental C++11 support (_in_ kernels). pretty weird.
Interesting... Then I assume he did not pass the flag to nvcc or nvcc did not pass it to the host compiler. CUDA 7 kinda works with C++11 and picongpu although I'm currently preparing 2 commits to fix some picongpu/pmacc related issues
could also be cmake version related, I think to remember there were also changes in the CUDA module related to the new flags.
Should not be the case. CUDA_NVCC_FLAGS are passed to nvcc in any CMake version IMO. If that still results in an error I'd need to see the make VERBOSE=1 output of the compiler invocation.
after export CXXFLAGS="-std=c++11":
<...>/nvcc $HOME/src/picongpu/src/picongpu/main.cu -c \
-o $HOME/build/build_picongpu/CMakeFiles/picongpu.dir//./picongpu_generated_main.cu.o \
-ccbin `which CC` -m64 -DPMACC_VERBOSE_LVL=0 -DPIC_VERBOSE_LVL=9 \
-DENABLE_ADIOS=1 -DADIOS_TRANSFORMS=1 -DENABLE_HDF5=1 \
-DPIC_ENABLE_PNG=1 \
-Xcompiler ,\"-std=c++11\",\"-fopenmp\",\"-Wall\",\"-Wno-unknown-pragmas\",\"-Wextra\",\"-Wno-unused-parameter\",\"-Wno-unused-local-typedefs\",\"-g\" \
-arch=sm_35 --use_fast_math --ftz=false -g \
-Xcompiler=-g,-pthread -DNVCC -I<CUDA>/include \
-I<exampleCase>/include -I/opt/cray/mpt/7.2.2/gni/mpich2-gnu/48/include \
-I/sw/xk6/boost/1.57.0/cle5.2_gnu4.8.2/include \
-I$HOME/src/picongpu/thirdParty/mallocMC/src/include \
-I<...>/lib/adios-1.9.0/include -I$HOME/src/picongpu/src/picongpu/../libPMacc/include \
-I<...>/lib/splash/include -I/opt/cray/hdf5-parallel/1.8.14/GNU/48/include \
-I/opt/cray/mpt/7.2.2/gni/mpich2-gnu/48/include -I<...>/lib/pngwriter/include \
-I/usr/include -I/usr/include -I/usr/include -I/usr/include/freetype2 \
-I$HOME/src/picongpu/src/picongpu/include -I<CUDA>/include
with cmake 2.8.10.2.
Hm, I might be right with cmake support history, see e.g. this commit.
@ax3l You need to pass the flag to nvcc. So either CUDA_PROPAGATE_HOST_FLAGS must be set to ON or you can also directly set it in the CUDA_NVCC_FLAGS. As mentioned above the following works for picongpu:
$PICSRC/configure -c"-DCUDA_NVCC_FLAGS='-std=c++11'" <pathToCase>
Or for cmake it should be:
cmake -DCUDA_NVCC_FLAGS='-std=c++11' <...>
thx for the help @Flamefire !
he will close
constexpr macro for C++11 compile on parts where we use static float x = value; inside classes (can't find an issue number right now)@ax3l I added issue #1154
@Flamefire thx!
Almost done. -> #1155
However I run into another known boost bug: https://svn.boost.org/trac/boost/ticket/6779
Compilation with C++11 should work with boost >= 1.57 and after #1155 and #1156 are merged.
@Flamefire awesome :sparkles: :rocket:
I also got the same errors. I added -DCUDA_PROPAGATE_HOST_FLAGS=OFF in cmake for compiling opencv, no errors again.
Interesting solution, thanks for reporting!
Admittedly, we are not the OpenCV project but this CMake flag is still good to know!
Most helpful comment
I successfully compiled PMacc with C++11 on my local machine and hypnos (HZDR cluster) with CUDA 7 and 7.5 with gcc 4.8.2 as the host compiler.
So your problem is simply: CUDA 6.5 does not support C++11. The first error should have already beaten you to it
error: identifier "nullptr" is undefined.nullptris a C++11 feature. So if the compiler complains about it, it is not a C++11 compiler ;)For future use:
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++11")in the CMakelists enables C++11 support for CUDA and host compiler. Probably running$PICSRC/configure -c"-DCUDA_NVCC_FLAGS='-std=c++11'" <pathToCase>would already solve the problem. Do not try to pass it to XCompiler as nvcc must know about that!