anuragranj / spynet

Spatial Pyramid Network for Optical Flow
Other
234 stars 48 forks source link

Compilation on a gcc 6 toolchain? #6

Closed tkoham closed 7 years ago

tkoham commented 7 years ago

running luarocks make spits out errors:

In file included from /opt/cuda/include/cuda_runtime.h:78:0, from :0: /opt/cuda/include/host_config.h:119:2: error: #error -- unsupported GNU version! gcc versions later than 5 are not supported!

error -- unsupported GNU version! gcc versions later than 5 are not supported!

^~~~~ CMake Error at cuspy_generated_init.cu.o.cmake:207 (message): Error generating /home/tyson/Git/spynet/extras/spybhwd/build/CMakeFiles/cuspy.dir//./cuspy_generated_init.cu.o

make[2]: [CMakeFiles/cuspy.dir/build.make:65: CMakeFiles/cuspy.dir/cuspy_generated_init.cu.o] Error 1 make[1]: [CMakeFiles/Makefile2:104: CMakeFiles/cuspy.dir/all] Error 2 make: *** [Makefile:128: all] Error 2

Error: Build error: Failed building.

I've tried setting the environment variable via

export EXTRA_NVCCFLAGS="-Xcompiler -std=c++98"

with no success

anuragranj commented 7 years ago

Looks like a cuda issue. I haven't been able to replicate the bug on my local system. Could you try setting cuda gcc and g++ to 5.x, whichever you have, and see if that works.

$ sudo ln -s /usr/bin/gcc-5.x /usr/local/cuda/bin/gcc
$ sudo ln -s /usr/bin/g++-5.x /usr/local/cuda/bin/g++
tkoham commented 7 years ago

I linked gcc-5 and g++-5, same error. Trying a clean install of torch

I'm not very familiar with the luarocks build system, but can I pass an environment variable at build time to bypass this problem? something like

path_to_gcc5=$(which gcc-5)
if [ -x "$path_to_gcc5" ]; then
  export CC="$path_to_gcc5"
else
  echo "please install GCC 5"
fi
tkoham commented 7 years ago

I fixed it! for whatever reason, the nvcc compiler was wanting to use GCC 6 despite pointing it to 5. I fixed this by commenting out the error condition in host_config.h (line 119), and adding

LIST(APPEND CUDA_NVCC_FLAGS "-Xcompiler -std=c++98")

to CMakeLists.txt under FIND_PACKAGE(CUDA)

anuragranj commented 7 years ago

Great. Could you send a pull request that fixed it?

tkoham commented 7 years ago

sure, done.

anuragranj commented 7 years ago

Thanks :)