

OpenPoseのビルド時に以下のようなエラーが発生する。

[code]

    my@PC:~/openpose/build$ make -j`nproc`
    
    Scanning dependencies of target openpose_caffe
    [ 12%] Creating directories for 'openpose_caffe'
    [ 25%] No download step for 'openpose_caffe'
    [ 37%] [ 50%] No patch step for 'openpose_caffe'
    No update step for 'openpose_caffe'
    [ 62%] Performing configure step for 'openpose_caffe'
    -- The C compiler identification is GNU 4.9.4
    -- The CXX compiler identification is GNU 4.9.4
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Boost version: 1.54.0
    -- Found the following Boost libraries:
    --   system
    --   thread
    --   filesystem
    -- Looking for include file pthread.h
    -- Looking for include file pthread.h - found
    -- Looking for pthread_create
    -- Looking for pthread_create - not found
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - not found
    -- Looking for pthread_create in pthread
    -- Looking for pthread_create in pthread - found
    -- Found Threads: TRUE  
    -- Found GFlags: /usr/include  
    -- Found gflags  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
    -- Found Glog: /usr/include  
    -- Found glog    (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
    -- Found PROTOBUF: /usr/lib/x86_64-linux-gnu/libprotobuf.so  
    -- Found PROTOBUF Compiler: /usr/bin/protoc
    -- Found HDF5: /usr/lib/x86_64-linux-gnu/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/libhdf5.so  
    -- CUDA detected: 8.0
    -- Found cuDNN: ver. 5.1.10 found (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
    -- Automatic GPU detection failed. Building for all known architectures.
    -- Added CUDA NVCC flags for: sm_30 sm_35 sm_50 sm_52 sm_60 sm_61
    -- Found Atlas: /usr/include  
    -- Found Atlas (include: /usr/include library: /usr/lib/libatlas.so lapack: /usr/lib/liblapack.so
    -- Python interface is disabled or not all required dependencies found. Building without it...
    -- Found Git: /usr/bin/git (found version "1.9.1") 
    -- 
    -- ******************* Caffe Configuration Summary *******************
    -- General:
    --   Version           :   1.0.0
    --   Git               :   1.0-141-g974172c
    --   System            :   Linux
    --   C++ compiler      :   /usr/bin/c++
    --   Release CXX flags :   -O3 -DNDEBUG -fPIC -Wall -std=c++11 -Wno-sign-compare -Wno-uninitialized
    --   Debug CXX flags   :   -g -fPIC -Wall -std=c++11 -Wno-sign-compare -Wno-uninitialized
    --   Build type        :   Release
    -- 
    --   BUILD_SHARED_LIBS :   ON
    --   BUILD_python      :   OFF
    --   BUILD_matlab      :   OFF
    --   BUILD_docs        :   OFF
    --   CPU_ONLY          :   OFF
    --   USE_OPENCV        :   OFF
    --   USE_LEVELDB       :   OFF
    --   USE_LMDB          :   OFF
    --   USE_NCCL          :   OFF
    --   ALLOW_LMDB_NOLOCK :   OFF
    --   USE_HDF5          :   ON
    -- 
    -- Dependencies:
    --   BLAS              :   Yes (Atlas)
    --   Boost             :   Yes (ver. 1.54)
    --   glog              :   Yes
    --   gflags            :   Yes
    --   protobuf          :   Yes (ver. 2.5.0)
    --   CUDA              :   Yes (ver. 8.0)
    -- 
    -- NVIDIA CUDA:
    --   Target GPU(s)     :   Auto
    --   GPU arch(s)       :   sm_30 sm_35 sm_50 sm_52 sm_60 sm_61
    --   cuDNN             :   Yes (ver. 5.1.10)
    -- 
    -- Install:
    --   Install path      :   /home/miyo/openpose/build/caffe
    -- 
    CMake Warning (dev) in src/caffe/CMakeLists.txt:
      Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
      interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
      cmake_policy command to set the policy and suppress this warning.
    
      Target "caffe" has an INTERFACE_LINK_LIBRARIES property which differs from
      its LINK_INTERFACE_LIBRARIES properties.
    
      INTERFACE_LINK_LIBRARIES:
    
        caffeproto;/usr/lib/x86_64-linux-gnu/libboost_system.so;/usr/lib/x86_64-linux-gnu/libboost_thread.so;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libglog.so;/usr/lib/x86_64-linux-gnu/libgflags.so;$<$<NOT:$<CONFIG:DEBUG>>:/usr/lib/x86_64-linux-gnu/libprotobuf.so>;$<$<CONFIG:DEBUG>:/usr/lib/x86_64-linux-gnu/libprotobuf.so>;-lpthread;/usr/lib/x86_64-linux-gnu/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/lib/x86_64-linux-gnu/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/lib/x86_64-linux-gnu/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/lib/x86_64-linux-gnu/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/local/cuda-8.0/lib64/libcudart.so;/usr/local/cuda-8.0/lib64/libcurand.so;/usr/local/cuda-8.0/lib64/libcublas.so;/usr/lib/x86_64-linux-gnu/libcudnn.so;/usr/lib/liblapack.so;/usr/lib/libcblas.so;/usr/lib/libatlas.so
    
      LINK_INTERFACE_LIBRARIES:
    
        caffeproto;/usr/lib/x86_64-linux-gnu/libboost_system.so;/usr/lib/x86_64-linux-gnu/libboost_thread.so;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libglog.so;/usr/lib/x86_64-linux-gnu/libgflags.so;/usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread;/usr/lib/x86_64-linux-gnu/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/lib/x86_64-linux-gnu/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/lib/x86_64-linux-gnu/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/lib/x86_64-linux-gnu/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/local/cuda-8.0/lib64/libcudart.so;/usr/local/cuda-8.0/lib64/libcurand.so;/usr/local/cuda-8.0/lib64/libcublas.so;/usr/lib/x86_64-linux-gnu/libcudnn.so;/usr/lib/liblapack.so;/usr/lib/libcblas.so;/usr/lib/libatlas.so
    
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/miyo/openpose/build/caffe/src/openpose_caffe-build
    [ 75%] Performing build step for 'openpose_caffe'
    [  1%] Running C++/Python protocol buffer compiler on /home/miyo/openpose/3rdparty/caffe/src/caffe/proto/caffe.proto
    Scanning dependencies of target caffeproto
    [  1%] Building CXX object src/caffe/CMakeFiles/caffeproto.dir/__/__/include/caffe/proto/caffe.pb.cc.o
    Linking CXX static library ../../lib/libcaffeproto.a
    [  1%] Built target caffeproto
    [  1%] [  1%] [  2%] [  2%] [  4%] [  5%] [  6%] [  6%] [  6%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_sgd_solver.cu.o
    Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/util/./cuda_compile_generated_math_functions.cu.o
    [  6%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_adam_solver.cu.o
    Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_deconv_layer.cu.o
    Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/util/./cuda_compile_generated_im2col.cu.o
    Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_adagrad_solver.cu.o
    Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_rmsprop_solver.cu.o
    Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_nesterov_solver.cu.o
    Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_adadelta_solver.cu.o
    [  8%] [  8%] Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_lrn_layer.cu.o
    Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_hdf5_data_layer.cu.o
    Building NVCC (Device) object src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_cudnn_sigmoid_layer.cu.o
    /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h(432): error: identifier "nullptr" is undefined
    
    /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h(432): error: expected a ";"
    
    /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h(432): error: identifier "nullptr" is undefined
    
    /usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h(432): error: expected a ";"
    
    
    ...
    
    
    /usr/include/c++/4.9/cmath(202): error: variable "std::constexpr" has already been defined
    
    /usr/include/c++/4.9/cmath(202): error: expected a ";"
    
    /usr/include/c++/4.9/cmath(221): error: inline specifier allowed on function declarations only
    
    /usr/include/c++/4.9/cmath(221): error: variable "std::constexpr" has already been defined
    
    /usr/include/c++/4.9/cmath(221): error: expected a ";"
    
    /usr/include/c++/4.9/cmath(240): error: inline specifier allowed on function declarations only
    
    /usr/include/c++/4.9/cmath(240): error: variable "std::constexpr" has already been defined
    
    /usr/include/c++/4.9/cmath(240): error: expected a ";"
    
    Error limit reached.
    100 errors detected in the compilation of "/tmp/tmpxft_00001d71_00000000-17_math_functions.compute_61.cpp1.ii".
    Compilation terminated.
    CMake Error at cuda_compile_generated_math_functions.cu.o.cmake:264 (message):
      Error generating file
      /home/miyo/openpose/build/caffe/src/openpose_caffe-build/src/caffe/CMakeFiles/cuda_compile.dir/util/./cuda_compile_generated_math_functions.cu.o
    
    
    make[5]: *** [src/caffe/CMakeFiles/cuda_compile.dir/util/./cuda_compile_generated_math_functions.cu.o] Error 1
    make[4]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
    make[3]: *** [all] Error 2
    make[2]: *** [caffe/src/openpose_caffe-stamp/openpose_caffe-build] Error 2
    make[1]: *** [CMakeFiles/openpose_caffe.dir/all] Error 2
    make: *** [all] Error 2
    
[/code]

問題の解決方法を教えてください。

Ubuntu / 14.04  
Cuda / 8.0  
cudnn / 5.1  
gcc / 4.9  
g++ / 4.9

### 追記

こちらにマルチポストしています

  * <https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/981>
  * <https://stackoverflow.com/questions/53880164/when-i-try-make-i-get-error-identifier-nullptr-is-undefined>

githubで教えて頂いた解決法として以下のコードを試したが、問題は解決できませんでした。

[code]

    sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
    
[/code]

### 追記２

[code]

    my@PC:~$ cc --version
    cc (Ubuntu 4.9.4-2ubuntu1~14.04.1) 4.9.4
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    my@PC:~$ c++ --version
    c++ (Ubuntu 4.9.4-2ubuntu1~14.04.1) 4.9.4
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
[/code]


CC BY-SA 4.0
2018-12-21T04:40:42.870
51408
2018-12-21T09:44:52.480
2018-12-21T09:44:52.480
19110
31540
question
c++ makefile cmake
OpenPoseのビルド時にerror: identifier "nullptr" is undefinedのエラーが発生する。