-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Failing to compile torchvision C++ API from source (>C++14 compiler required, which is installed) #4175
Comments
Looks to be similar to #2470 as they both fail at the same step in the build process. |
Update: I was able to successfully compile by manually changing the
Now to figure out how to fix that in CMake! |
Hmm, can you share output of |
|
Thanks for the report and fix @mattpopovich I had the exact same issue on my side, and this did help fixing it, simply add I tried adding |
How can use C++17 in setup.py files? @mattpopovich #error C++17 or later compatible compiler is required to use ATen. |
🐛 Bug
I have installed PyTorch version 1.8.0 from source and am now attempting to install the C++ API to torchvision 0.9.0 from source.
When making torchvision's C++ API I am getting an error that I need to use a C++14 or later compatible compiler (I am using gcc 9.3.0 which supports C++14):
I think the places of interest are the following:
-std=gnu++14
-std=c++11
It seems like all of the CPU builds use the C++14 flag and the CUDA builds (incorrectly) use the C++11 flag.
Can I point this to
CMAKE_CUDA_FLAGS
being set invision/CMakeLists.txt
? It looks likeCUDA_FLAGS
contains the flag-std=c++11
as shown invision/build/CMakeFiles/torchvision.dir/flags.make
:Any idea where this is coming from? How it's getting set? And how to change it so that it is set to
-std=gnu++14
or similar? Is it coming from my PyTorch install?To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/pytorch/vision.git
cd vision
git checkout v0.9.0
mkdir build && cd build
cmake -DTorch_DIR=/usr/local/lib/python3.8/dist-packages/torch/share/cmake/Torch/ -DWITH_CUDA=on ..
make -j4
Expected behavior
The make (build) completes without error.
Environment
Click to display environment
conda
,pip
, source): source / sourceAdditional context
The commands I used to build PyTorch:
git clone https://github.com/pytorch/pytorch.git
cd pytorch
git checkout v1.8.0
git submodule sync
git submodule update --init --recursive
python3 setup.py build -j4 --cmake-only
cd build
cmake -DBUILD_CUSTOM_PROTOBUF=0 ..
cmake --build . -j4 --target install
cd ..
python3 setup.py install
Additionally,
python
maps to Python 2.7.18python3
maps to Python 3.8.10Lastly, I do have a Dockerfile that I am using... but it builds cuDNN, PyTorch, openCV, and torchvision from source... it's about 20GB and takes a few hours to build.
The text was updated successfully, but these errors were encountered: