StephanPreibisch / FourierConvolutionCUDALib

Implementation of 3d non-separable convolution using CUDA & FFT Convolution
19 stars 13 forks source link

Failing to build on Ubuntu 18.04.2.LTS #33

Closed mnqslbs2 closed 5 years ago

mnqslbs2 commented 5 years ago

Hi, I am trying to build this on Ubuntu 18.04.2 LTS and I'm getting errors that I don't understand when I run the make command. My call to cmake is the following, and seems to run fine:

cmake -DCMAKE_INSTALL_PREFIX=/home/microscopy/Software/Fiji.app/lib/linux64/ ..
-- The CXX compiler identification is GNU 7.4.0
-- The C compiler identification is GNU 7.4.0
-- 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
-- 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
>> Setting up Release build
-- 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  
-- Found CUDA: /usr (found version "9.1") 
>> CUDA version 9.1 detected, compiling for Compute Capability/ies 30;32;35;37;50;52;60;61;70 (highest SM: 70)
>> Boost UTF: /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/microscopy/repos/FourierConvolutionCUDALib/build

But when I then run the make command it fails with errors:

make
[  5%] Building NVCC (Device) object src/CMakeFiles/FourierConvolutionCUDALib_static.dir/FourierConvolutionCUDALib_static_generated_standardCUDAfunctions.cu.o
-- Removing /home/microscopy/repos/FourierConvolutionCUDALib/build/src/CMakeFiles/FourierConvolutionCUDALib_static.dir//./FourierConvolutionCUDALib_static_generated_standardCUDAfunctions.cu.o
/usr/bin/cmake -E remove /home/microscopy/repos/FourierConvolutionCUDALib/build/src/CMakeFiles/FourierConvolutionCUDALib_static.dir//./FourierConvolutionCUDALib_static_generated_standardCUDAfunctions.cu.o
-- Generating dependency file: /home/microscopy/repos/FourierConvolutionCUDALib/build/src/CMakeFiles/FourierConvolutionCUDALib_static.dir//FourierConvolutionCUDALib_static_generated_standardCUDAfunctions.cu.o.NVCC-depend
/usr/bin/nvcc -M -D__CUDACC__ /home/microscopy/repos/FourierConvolutionCUDALib/src/standardCUDAfunctions.cu -o /home/microscopy/repos/FourierConvolutionCUDALib/build/src/CMakeFiles/FourierConvolutionCUDALib_static.dir//FourierConvolutionCUDALib_static_generated_standardCUDAfunctions.cu.o.NVCC-depend -ccbin /usr/bin/c++ -m64 -Xcompiler ,\"-O3\",\"-DNDEBUG\" -gencode arch=compute_30,code=sm_30 -gencode arch=compute_32,code=sm_32 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -O2 --use_fast_math -DNVCC -I/usr/include -I/home/microscopy/repos/FourierConvolutionCUDALib/src/.
In file included from /usr/include/host_config.h:50:0,
                 from /usr/include/cuda_runtime.h:78,
                 from <command-line>:0:
/usr/include/crt/host_config.h:121:2: error: #error -- unsupported GNU version! gcc versions later than 6 are not supported!
 #error -- unsupported GNU version! gcc versions later than 6 are not supported!
  ^~~~~
CMake Error at FourierConvolutionCUDALib_static_generated_standardCUDAfunctions.cu.o.Release.cmake:219 (message):
  Error generating
  /home/microscopy/repos/FourierConvolutionCUDALib/build/src/CMakeFiles/FourierConvolutionCUDALib_static.dir//./FourierConvolutionCUDALib_static_generated_standardCUDAfunctions.cu.o

src/CMakeFiles/FourierConvolutionCUDALib_static.dir/build.make:84: recipe for target 'src/CMakeFiles/FourierConvolutionCUDALib_static.dir/FourierConvolutionCUDALib_static_generated_standardCUDAfunctions.cu.o' failed
make[2]: *** [src/CMakeFiles/FourierConvolutionCUDALib_static.dir/FourierConvolutionCUDALib_static_generated_standardCUDAfunctions.cu.o] Error 1
CMakeFiles/Makefile2:87: recipe for target 'src/CMakeFiles/FourierConvolutionCUDALib_static.dir/all' failed
make[1]: *** [src/CMakeFiles/FourierConvolutionCUDALib_static.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

Can someone point me to what might be my problem here? As I cannot decipher it. Thanks in advance, Ben

mnqslbs2 commented 5 years ago

OK So I see that one reason that this fails is that I have an unsupported version of GNC. I have:

gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

And the make output states gcc versions later than 6 are not supported. Do I need to recompile under an older version of gcc? If so then how? I wonder could @psteinb help? Thanks, Ben

alonyan commented 5 years ago

Hi Ben, Just encountered a similar issue. All you need is to specify an older compiler for cmake to use(see below).

Cheers, Alon

check if you have a compiler <=6:

dpkg --list | grep compiler

if not, get one: sudo apt install g++-5 sudo apt install gcc-5

check where it is: whereis gcc-5

(should be at /usr/bin/gcc-5)

compile using cmake and specify the compiler version

cmake -D CMAKE_C_COMPILER=/usr/bin/gcc-5 -D CMAKE_CXX_COMPILER=/usr/bin/g++-5 -DCMAKE_INSTALL_PREFIX=/wherever/you/want/it/to/go ..

continue normally.

mnqslbs2 commented 5 years ago

Hi Alon, Thanks for this everything built without error in cmake and my test mvdecon worked well. I consider this issue now closed. Cheers, Ben