fringe icon indicating copy to clipboard operation
fringe copied to clipboard

Fringe cmake can't find GDAL

Open jlmaurer opened this issue 5 years ago • 12 comments

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?

jlmaurer avatar Apr 21 '20 02:04 jlmaurer

What is the version number in

/usr/local/home/jlmd9g/software/minicondda3/envs/fringe/include/gdal_version.h

piyushrpt avatar Apr 21 '20 03:04 piyushrpt

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.

piyushrpt avatar Apr 21 '20 03:04 piyushrpt

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.

jlmaurer avatar Apr 21 '20 03:04 jlmaurer

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?

piyushrpt avatar Apr 21 '20 03:04 piyushrpt

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.

jlmaurer avatar Apr 21 '20 03:04 jlmaurer

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

piyushrpt avatar Apr 21 '20 03:04 piyushrpt

That did it...

jlmaurer avatar Apr 21 '20 03:04 jlmaurer

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

jlmaurer avatar Apr 21 '20 03:04 jlmaurer

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

piyushrpt avatar Apr 21 '20 03:04 piyushrpt

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

jlmaurer avatar Apr 21 '20 03:04 jlmaurer

If that is helpful!

jlmaurer avatar Apr 21 '20 03:04 jlmaurer

Go for it ..

piyushrpt avatar Apr 21 '20 04:04 piyushrpt