Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torchvision c++ api build from source, Build error about C++14 and C++11 #2470

Closed
weijian-sun opened this issue Jul 14, 2020 · 6 comments
Closed

Comments

@weijian-sun
Copy link

weijian-sun commented Jul 14, 2020

torchvision c++ api build from source, in master branch, Build error about C++14 and C++11

Environment

PyTorch Version: 1.5.1 build from source
OS (e.g., Linux): Ubuntu 16
How you installed PyTorch (conda, pip, source): source
Build command you used (if compiling from source):
#!/bin/bash
WORKSPACE=$(cd $(dirname $0);pwd)
export PATH=/opt/protobuf/bin:$PATH
mkdir build
cd build
/opt/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=${WORKSPACE}/output
-DCMAKE_PREFIX_PATH=/opt/had_deps/libtorch1.5 -DWITH_CUDA=ON ..
make -jgetconf _NPROCESSORS_CONF install
Python version: 3.5
CUDA/cuDNN version: 10.0

error message:

  • The C compiler identification is GNU 5.4.0
    -- The CXX compiler identification is GNU 5.4.0
    -- 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
    -- Detecting C compile features
    -- Detecting C compile features - 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
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- The CUDA compiler identification is NVIDIA 10.0.130
    -- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc
    -- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works
    -- Detecting CUDA compiler ABI info
    -- Detecting CUDA compiler ABI info - done
    -- Found Python3: /usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5m.so (found version "3.5.2") found components: Development
    -- Looking for pthread.h
    -- Looking for 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
    CMake Warning (dev) at /opt/had_deps/lib/cmake/protobuf/protobuf-config-version.cmake:50 (if):
    Policy CMP0054 is not set: Only interpret if() arguments as variables or
    keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
    details. Use the cmake_policy command to set the policy and suppress this
    warning.

    Quoted variables like "" will no longer be dereferenced when the policy is
    set to NEW. Since the policy is not set the OLD behavior will be used.
    Call Stack (most recent call first):
    /opt/had_deps/libtorch1.5/share/cmake/Caffe2/public/protobuf.cmake:4 (find_package)
    /opt/had_deps/libtorch1.5/share/cmake/Caffe2/Caffe2Config.cmake:56 (include)
    /opt/had_deps/libtorch1.5/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
    CMakeLists.txt:16 (find_package)
    This warning is for project developers. Use -Wno-dev to suppress it.

-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
-- Caffe2: Found protobuf with new-style protobuf targets.
-- Caffe2: Protobuf version 3.3.0
-- Found CUDA: /usr/local/cuda (found version "10.0")
-- Caffe2: CUDA detected: 10.0
-- Caffe2: CUDA nvcc is: /usr/local/cuda/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda
-- Caffe2: Header version is: 10.0
-- Found CUDNN: /usr/lib/x86_64-linux-gnu/libcudnn.so
-- Found cuDNN: v7.5.0 (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Autodetected CUDA architecture(s): 7.5
-- Added CUDA NVCC flags for: -gencode;arch=compute_75,code=sm_75
-- Found torch: /opt/had_deps/libtorch1.5/lib/libtorch.so
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.54")
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/administrator/workspace/vision/build
Scanning dependencies of target torchvision
[ 3%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/alexnet.cpp.o
[ 7%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/densenet.cpp.o
[ 10%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/googlenet.cpp.o
[ 14%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/inception.cpp.o
[ 17%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/mnasnet.cpp.o
[ 21%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/mobilenet.cpp.o
[ 25%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/resnet.cpp.o
[ 28%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/shufflenetv2.cpp.o
[ 32%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/squeezenet.cpp.o
[ 35%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/models/vgg.cpp.o
[ 39%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/PSROIAlign_cpu.cpp.o
[ 42%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/DeformConv_cpu.cpp.o
[ 46%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/PSROIPool_cpu.cpp.o
[ 50%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/ROIAlign_cpu.cpp.o
[ 53%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/ROIPool_cpu.cpp.o
[ 57%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/image/image.cpp.o
[ 60%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/image/readjpeg_cpu.cpp.o
[ 64%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/image/readpng_cpu.cpp.o
[ 67%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/cpu/nms_cpu.cpp.o
[ 71%] Building CUDA object CMakeFiles/torchvision.dir/torchvision/csrc/cuda/DeformConv_cuda.cu.o
In file included from /usr/include/c++/5/initializer_list:36:0,
from /opt/had_deps/libtorch1.5/include/c10/util/SmallVector.h:31,
from /opt/had_deps/libtorch1.5/include/c10/util/ArrayRef.h:18,
from /opt/had_deps/libtorch1.5/include/c10/core/MemoryFormat.h:5,
from /opt/had_deps/libtorch1.5/include/ATen/core/TensorBody.h:5,
from /opt/had_deps/libtorch1.5/include/ATen/Tensor.h:11,
from /opt/had_deps/libtorch1.5/include/ATen/Context.h:4,
from /opt/had_deps/libtorch1.5/include/ATen/ATen.h:5,
from /home/administrator/workspace/vision/torchvision/csrc/cuda/DeformConv_cuda.cu:69:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support
^
In file included from /opt/had_deps/libtorch1.5/include/c10/util/ArrayRef.h:19:0,
from /opt/had_deps/libtorch1.5/include/c10/core/MemoryFormat.h:5,
from /opt/had_deps/libtorch1.5/include/ATen/core/TensorBody.h:5,
from /opt/had_deps/libtorch1.5/include/ATen/Tensor.h:11,
from /opt/had_deps/libtorch1.5/include/ATen/Context.h:4,
from /opt/had_deps/libtorch1.5/include/ATen/ATen.h:5,
from /home/administrator/workspace/vision/torchvision/csrc/cuda/DeformConv_cuda.cu:69:
/opt/had_deps/libtorch1.5/include/c10/util/C++17.h:24:2: error: #error You need C++14 to compile PyTorch
#error You need C++14 to compile PyTorch

@pmeier
Copy link
Collaborator

pmeier commented Jul 15, 2020

Hi @weijian-sun,

I'm out of my depth for the build process, we'll have to wait for someone else. Still, I noticed one thing while skimming the output: In Environment you stated you have CUDA 10.2, but the build -- Found CUDA: /usr/local/cuda (found version "10.0").

@weijian-sun
Copy link
Author

weijian-sun commented Jul 15, 2020

Hi @weijian-sun,

I'm out of my depth for the build process, we'll have to wait for someone else. Still, I noticed one thing while skimming the output: In Environment you stated you have CUDA 10.2, but the build -- Found CUDA: /usr/local/cuda (found version "10.0").

oh, sorry for the typo, it's cuda 10.0, and the driver version is 440.33.01

@deweyamer
Copy link

did u solved this problem?

@weijian-sun
Copy link
Author

switch to a clean docker image, proglem solved, maybe some environment related issue

@deweyamer
Copy link

sorry, do u means use docker to download the vision?

@fmassa
Copy link
Member

fmassa commented Aug 3, 2020

@Dewey1994 if you are compiling torchvision from source, you need a compiler that supports C++14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants