whitelok / ldbm-image-background-remover

Remove image background automatically
MIT License
92 stars 18 forks source link

Need help compiling it on ubuntu 20.04 #5

Closed LordJABA closed 3 years ago

LordJABA commented 3 years ago

I have problems compiling that under ubuntu 20.04 Is seems it can't find Eigen3 libraries I installed libopencv-dev and libeigen3-dev but I'm still getting error when i try make Here is what I do and what I get:

mkdir build
❯ cd build
❯ cmake ..
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 8.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
-- Found OpenCV: /usr (found version "4.2.0") 
-- Configuring done
-- Generating done
-- Build files have been written to:/home/thecore/tmp/ldbm-image-background-remover/build

❯ make
/usr/bin/cmake -S/home/thecore/tmp/ldbm-image-background-remover -B/home/thecore/tmp/ldbm-image-background-remover/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/thecore/tmp/ldbm-image-background-remover/build/CMakeFiles /home/thecore/tmp/ldbm-image-background-remover/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Wejście do katalogu '/home/thecore/tmp/ldbm-image-background-remover/build'
make -f CMakeFiles/LDBMImageBackgroundRemover.dir/build.make CMakeFiles/LDBMImageBackgroundRemover.dir/depend
make[2]: Wejście do katalogu '/home/thecore/tmp/ldbm-image-background-remover/build'
cd /home/thecore/tmp/ldbm-image-background-remover/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/thecore/tmp/ldbm-image-background-remover /home/thecore/tmp/ldbm-image-background-remover /home/thecore/tmp/ldbm-image-background-remover/build /home/thecore/tmp/ldbm-image-background-remover/build /home/thecore/tmp/ldbm-image-background-remover/build/CMakeFiles/LDBMImageBackgroundRemover.dir/DependInfo.cmake --color=
Scanning dependencies of target LDBMImageBackgroundRemover
make[2]: Opuszczenie katalogu '/home/thecore/tmp/ldbm-image-background-remover/build'
make -f CMakeFiles/LDBMImageBackgroundRemover.dir/build.make CMakeFiles/LDBMImageBackgroundRemover.dir/build
make[2]: Wejście do katalogu '/home/thecore/tmp/ldbm-image-background-remover/build'
[ 33%] Building CXX object CMakeFiles/LDBMImageBackgroundRemover.dir/src/LDBM.cpp.o
/usr/bin/c++   -isystem /usr/include/opencv4  -v   -o CMakeFiles/LDBMImageBackgroundRemover.dir/src/LDBM.cpp.o -c /home/thecore/tmp/ldbm-image-background-remover/src/LDBM.cpp
Using built-in specs.
COLLECT_GCC=/usr/bin/c++
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.4.0-3ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.4.0 (Ubuntu 8.4.0-3ubuntu2) 
COLLECT_GCC_OPTIONS='-isystem' '/usr/include/opencv4' '-v' '-o' 'CMakeFiles/LDBMImageBackgroundRemover.dir/src/LDBM.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/8/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -isystem /usr/include/opencv4 /home/thecore/tmp/ldbm-image-background-remover/src/LDBM.cpp -quiet -dumpbase LDBM.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/LDBMImageBackgroundRemover.dir/src/LDBM.cpp.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccTeHvDE.s
GNU C++14 (Ubuntu 8.4.0-3ubuntu2) version 8.4.0 (x86_64-linux-gnu)
        compiled by GNU C version 8.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/8"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/opencv4
 /usr/include/c++/8
 /usr/include/x86_64-linux-gnu/c++/8
 /usr/include/c++/8/backward
 /usr/lib/gcc/x86_64-linux-gnu/8/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++14 (Ubuntu 8.4.0-3ubuntu2) version 8.4.0 (x86_64-linux-gnu)
        compiled by GNU C version 8.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 7f898f3e7c9bafa983b4c472f0e6877a
/home/thecore/tmp/ldbm-image-background-remover/src/LDBM.cpp:8:10: fatal error: eigen3/Eigen/core: Nie ma takiego pliku ani katalogu
 #include <eigen3/Eigen/core>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/LDBMImageBackgroundRemover.dir/build.make:66: CMakeFiles/LDBMImageBackgroundRemover.dir/src/LDBM.cpp.o] Błąd 1
make[2]: Opuszczenie katalogu '/home/thecore/tmp/ldbm-image-background-remover/build'
make[1]: *** [CMakeFiles/Makefile2:79: CMakeFiles/LDBMImageBackgroundRemover.dir/all] Błąd 2
make[1]: Opuszczenie katalogu '/home/thecore/tmp/ldbm-image-background-remover/build'
make: *** [Makefile:87: all] Błąd 2

Any suggestions how to fix that ? - not cpp programer so cmake it's some kind of magic to me

LordJABA commented 3 years ago

looking at my libraries I changed line 8 in LDBM.cpp from #include <eigen3/Eigen/core> to #include <eigen3/Eigen/Core> to match the filename I have but now im getting this error :

GNU C++14 (Ubuntu 8.4.0-3ubuntu2) version 8.4.0 (x86_64-linux-gnu)
        compiled by GNU C version 8.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 7f898f3e7c9bafa983b4c472f0e6877a
/home/thecore/tmp/ldbm-image-background-remover/src/main.cpp: In function ‘cv::Mat cutoutImg(cv::Mat, cv::Mat, double)’:
/home/thecore/tmp/ldbm-image-background-remover/src/main.cpp:53:37: error: ‘CV_BGR2BGRA’ was not declared in this scope
     cv::cvtColor(input, input_bgra, CV_BGR2BGRA);
                                     ^~~~~~~~~~~
make[2]: *** [CMakeFiles/LDBMImageBackgroundRemover.dir/build.make:79: CMakeFiles/LDBMImageBackgroundRemover.dir/src/main.cpp.o] Błąd 1
make[2]: Opuszczenie katalogu '/home/thecore/tmp/ldbm-image-background-remover/build'
make[1]: *** [CMakeFiles/Makefile2:79: CMakeFiles/LDBMImageBackgroundRemover.dir/all] Błąd 2
make[1]: Opuszczenie katalogu '/home/thecore/tmp/ldbm-image-background-remover/build'
make: *** [Makefile:87: all] Błąd 2
LordJABA commented 3 years ago

Sucess!

changed line 53 in main.cpp to cv::cvtColor(input, input_bgra, cv::COLOR_RGB2BGR); and it worked. Can be closed - maybe someone will find that useful