gfacciol/mgm

Error on cmake + make on branch multiscale

Closed this issue · 3 comments

I am trying to do cmake + make on branch multiscale.

I do the following steps, at the root of the repository:

mkdir build
cd build
cmake ..

Which gives the following output:

-- The C compiler identification is AppleClang 10.0.0.10001044
-- The CXX compiler identification is AppleClang 10.0.0.10001044
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/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: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No build type selected, default to Release
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.11")
-- Found TIFF: /usr/local/lib/libtiff.dylib (found version "4.0.10")
-- Found JPEG: /usr/local/lib/libjpeg.dylib (found version "62")
-- Found PNG: /usr/local/lib/libpng.dylib (found version "1.5.30")
FLAGS:  -O3 -std=c99 -funroll-loops -Wno-unused -DNDEBUG
/Users/guillaumelostis/Documents/Git/mgm/build/iio
/Users/guillaumelostis/Documents/Git/mgm/iio
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/guillaumelostis/Documents/Git/mgm/build

Then, make gives the following output:

Scanning dependencies of target IIOLIB
[  4%] Building C object iio/CMakeFiles/IIOLIB.dir/iio.c.o
[  9%] Linking C static library libIIOLIB.a
[  9%] Built target IIOLIB
Scanning dependencies of target mgm
[ 13%] Building CXX object CMakeFiles/mgm.dir/main_mgm.cc.o
/Users/guillaumelostis/Documents/Git/mgm/main_mgm.cc:239:10: warning: add explicit braces to avoid dangling else [-Wdangling-else]
         else
         ^
1 warning generated.
[ 18%] Building CXX object CMakeFiles/mgm.dir/mgm_multiscale.cc.o
[ 22%] Building CXX object CMakeFiles/mgm.dir/img.cc.o
[ 27%] Building CXX object CMakeFiles/mgm.dir/point.cc.o
[ 31%] Building CXX object CMakeFiles/mgm.dir/mgm_costvolume.cc.o
[ 36%] Building CXX object CMakeFiles/mgm.dir/mgm_core.cc.o
[ 40%] Building CXX object CMakeFiles/mgm.dir/census_tools.cc.o
[ 45%] Building C object CMakeFiles/mgm.dir/shear.c.o
/Users/guillaumelostis/Documents/Git/mgm/shear.c:10:10: fatal error: 'fftw3.h' file not found
#include <fftw3.h>
         ^~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/mgm.dir/shear.c.o] Error 1
make[1]: *** [CMakeFiles/mgm.dir/all] Error 2
make: *** [all] Error 2

However locate fftw3.h shows me that I do have this file at /usr/local/include/fftw3.h, which is on my PATH.

If instead of this I do make directly at the root of the repo, it works.

You need to specify it INCLUDE_PATH=/usr/local/include/ before running cmake.
PATH is only for the executables. Let me know if this solves the issue.

This happens all the time on macos, for instance I have these exports in my ~/.bash_profiles

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib:/opt/X11/lib
export CPATH=$CPATH:/usr/local/include:/opt/X11/include

These paths are usually configured system wide and/or hardcoded in the compiler.