isce-framework / fringe

Fine Resolution InSAR With Generalized Eigenvectors (FRInGE)
Apache License 2.0
80 stars 42 forks source link

Fringe cmake can't find GDAL #9

Open jlmaurer opened 4 years ago

jlmaurer commented 4 years ago

Building fringe using: CXX=g++ cmake -DCMAKE_INSTALL_PREFIX=../install ../src/fringe on "Ubuntu 18.04.4 LTS", where file structure is Fringe build src fringe install

I get the following error message:

CMake Error at /usr/local/home/jlmd9g/software/minicondda3/envs/fringe/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message): Could NOT find GDAL: Found unsuitable version "2.2.3", but required is at least "3.0" (found /usr/local/home/jlmd9g/software/minicondda3/envs/fringe/lib/libgdal.so) Call Stack (most recent call first): /usr/local/home/jlmd9g/software/minicondda3/envs/fringe/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:443 (_FPHSA_FAILURE_MESSAGE) cmake/FindGDAL.cmake:287 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:32 (FIND_PACKAGE)

-- Configuring incomplete, errors occurred! See also "/usr/local/home/jlmd9g/software/FRiNGE/build/CMakeFiles/CMakeOutput.log".

But: gdal-config --prefix /usr/local/home/jlmd9g/software/minicondda3/envs/fringe gdal-config --version 3.0.4 gdal-config --cflags -I/usr/local/home/jlmd9g/software/minicondda3/envs/fringe/include gdal-config --libs -L/usr/local/home/jlmd9g/software/minicondda3/envs/fringe/lib -lgdal

I've got GDAL_DIR and GDAL_ROOT specified to the same directory: echo $GDAL_DIR /usr/local/home/jlmd9g/software/minicondda3/envs/fringe//lib

in which is the .so files: ls /usr/local/home/jlmd9g/software/minicondda3/envs/fringe//lib/libgdal*

/usr/local/home/jlmd9g/software/minicondda3/envs/fringe//lib/libgdal.a /usr/local/home/jlmd9g/software/minicondda3/envs/fringe//lib/libgdal.so /usr/local/home/jlmd9g/software/minicondda3/envs/fringe//lib/libgdal.so.26 /usr/local/home/jlmd9g/software/minicondda3/envs/fringe//lib/libgdal.so.26.0.4

Any ideas?

piyushrpt commented 4 years ago

What is the version number in

/usr/local/home/jlmd9g/software/minicondda3/envs/fringe/include/gdal_version.h
piyushrpt commented 4 years ago

I would also check the cmake config output - I suspect its loading gdal.h from a different location than the lib and reporting the mismatch.

jlmaurer commented 4 years ago

less /usr/local/home/jlmd9g/software/minicondda3/envs/fringe/include/gdal_version.h: ... # define GDAL_RELEASE_NAME "3.0.4" ... Based on this page, it looks like cmake may search the default path before searching the path at the environment variable, and since gdal exists at the default path location on my system, it takes that one first.

The relevant lines from FindGDAL.cmake:

197 find_path(GDAL_INCLUDE_DIR gdal.h
198   HINTS
199     ENV GDAL_DIR
200     ENV GDAL_ROOT
201   PATH_SUFFIXES
202      include/gdal
203      include/GDAL
204      include
205      )

If this is true, requiring cmake to look in the specified ENV instead of the default first should fix the problem.

piyushrpt commented 4 years ago

So

GDAL_DIR=/usr/local/home/jlmd9g/software/minicondda3/envs/fringe CXX=g++ cmake -DCMAKE_INSTALL_PREFIX=../install ../src/fringe

doesn't work? What shell are you using?

jlmaurer commented 4 years ago

Just as a follow-up, cmake is definitely using gdal at the default location: grep '2.2.3' /usr/include/gdal/gdal_version.h # define GDAL_RELEASE_NAME "2.2.3"

And yes, that command gives me the same error. Shell is bash.

piyushrpt commented 4 years ago

What version of cmake? And are you clearing out the build folder before each cmake run? Else it will use the cached values

jlmaurer commented 4 years ago

That did it...

jlmaurer commented 4 years ago

It was using the cache. I'm feeling sheepish now. :)

piyushrpt commented 4 years ago

All is well .... these things are never documented :-P

jlmaurer commented 4 years ago

Thanks for the help! I'll push an update to the environment variable list at some point.

jlmaurer commented 4 years ago

If that is helpful!

piyushrpt commented 4 years ago

Go for it ..