DeadSix27 / waifu2x-converter-cpp

Improved fork of Waifu2X C++ using OpenCL and OpenCV
MIT License
792 stars 86 forks source link

Building Fails on Ubuntu 18LTS-based systems #227

Open awebeer256 opened 4 years ago

awebeer256 commented 4 years ago

I'm running Linux Mint 19.3 (which is based on Ubuntu 18.04) with an Nvidia CUDA GPU, and when I ran make -j4 in the build instructions, I got this error message: [ 17%] Generating modelHandler_CUDA.ptx30 ERROR: No supported gcc/g++ host compiler found, but clang-4.0 is available. Use 'nvcc -ccbin clang-4.0' to use that instead. CMakeFiles/gensrcs.dir/build.make:71: recipe for target 'modelHandler_CUDA.ptx30' failed make[2]: *** [modelHandler_CUDA.ptx30] Error 1 CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/gensrcs.dir/all' failed make[1]: *** [CMakeFiles/gensrcs.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 Some searching later and I came across this, and concluded that my default version of gcc (7.4.0) was too new. My first thought was to downgrade to gcc 7.3.0 (which is officially supported), but that would've necessitated reinstalling all of my cuda-related packages, so I searched for a better way. Eventually I made it work by installing gcc-6 and g++-6, and building with those instead; to do that, I went to the place the error happened: line 71 (actually 72) of waifu2x-converter-cpp/out/CMakeFiles/gensrcs.dir/build.make, and added -ccbin /usr/bin/gcc-6 after /usr/bin/nvcc.

So to fix this issue, I suggest implementing code to detect which compilers are installed (presumably, clang 4.0 would've worked too, as the error message states), and tweaking the generated build.make file accordingly (or if no compatible compilers are installed, spitting out an error message asking the user to install one).

Alex20129 commented 4 years ago

I confirm it. the g++7 compiler was installed in my system by default. Error solved after g++6 installation. i just 'apt install g++-6' without any troubles. [upd]: no need to touch any files. all be built normally if g++-6 already installed $ cmake ../ $ make done.