geo-data / cesium-terrain-builder

A C++ library and associated command line tools designed to create terrain tiles for use in the Cesium JavaScript library
Other
718 stars 342 forks source link

Missing gdalwraper.h by GDALTile.cpp #54

Open icemagno opened 7 years ago

icemagno commented 7 years ago

I'm trying to build CTB but its being a nightmare.

After geting stuck on

CMake Error at src/CMakeLists.txt:10 (message):
The GDAL version must be one that implements RFC 46 (GDAL/OGR unification)
i.e. >= 2.0.0

and

Could NOT find GDAL (missing:  GDAL_LIBRARY GDAL_INCLUDE_DIR) 
CMake Error at CMakeLists.txt:67 (message):
  The GDAL library cannot be found on the system

and some missing GDALOpenEx problem I'm now on this:


Scanning dependencies of target ctb
[  5%] Building CXX object src/CMakeFiles/ctb.dir/GDALTile.cpp.o
/.../cesium-terrain-builder-0.4.1/src/GDALTile.cpp:22:24: fatal error: gdalwarper.h: No such file or directory
compilation terminated.
src/CMakeFiles/ctb.dir/build.make:62: recipe for target 'src/CMakeFiles/ctb.dir/GDALTile.cpp.o' failed
make[2]: *** [src/CMakeFiles/ctb.dir/GDALTile.cpp.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/ctb.dir/all' failed
make[1]: *** [src/CMakeFiles/ctb.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Please put the REAL WORKING Instalation guide on your main page to avoid problems. I sugest you to start your guide from a fresh Ubuntu installation and you will see that just say The dependency is GDAL >= 2.x is not enough. Build the CTB from zero ground SO is a pain!

icemagno commented 7 years ago

My history (from a new Ubuntu install):

add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
apt-get update
apt-get upgrade
apt-get install gdal-bin python-gdal python3-gdal
gdalinfo --version

$ GDAL 2.2.1, released 2017/06/23

wget https://github.com/geo-data/cesium-terrain-builder/archive/v0.4.1.tar.gz
tar -xvf v0.4.1.tar.gz
cd cesium-terrain-builder-0.4.1/
mkdir build && cd build && cmake .. && make install

(oops! Missing cmake)

apt-get install cmake
mkdir build && cd build && cmake .. && make install

(oops... can't find compiler)

apt-get install build-essential
mkdir build && cd build && cmake .. && make install

(oops.. Could NOT find GDAL (missing:  GDAL_LIBRARY GDAL_INCLUDE_DIR)

vim CMakeLists.txt

(The  Thor method! comment what is doing wrong! )
# We need GDAL
#find_package(GDAL)
#if(NOT GDAL_FOUND)
#  message(FATAL_ERROR "The GDAL library cannot be found on the system")
#endif()
include_directories("/usr/lib")     <<<--------- My GDAL location by force!

mkdir build && cd build && cmake .. && make install

( oops... The GDAL version must be one that implements RFC 46 (GDAL/OGR unification))

apt-get install -y gdal-bin python-gdal libgdal-dev
mkdir build && cd build && cmake .. && make install

( oops !! DAMN IT ! fatal error: gdalwarper.h: No such file or directory )

Jesus !! I'm almost quit !

icemagno commented 7 years ago

Solved.

mea culpa

1) Remove comments made on CMakeLists.txt 2) Invoke

mkdir build && cd build && cmake cmake -DGDAL_LIBRARY_DIR=/usr/lib/ -DGDAL_LIBRARY=/usr/lib/libgdal.so -DGDAL_INCLUDE_DIR=/usr/include/gdal/ .. && make instal

and then

cp src/libctb.so /usr/lib

nmccready commented 4 years ago

For anyone else, adding this to the CMakeLists.txt helps debugging immensely

MESSAGE( STATUS "GDAL_LIBRARY_DIR:     "  ${GDAL_LIBRARY_DIR})
MESSAGE( STATUS "GDAL_INCLUDE_DIR:     "  ${GDAL_INCLUDE_DIR})
MESSAGE( STATUS "GDAL_LIBRARY:     "  ${GDAL_LIBRARY})
MESSAGE( STATUS "GDAL_VERSION:     "  ${GDAL_VERSION})

Also setting the GDAL_CONFIG only should set all the other variables for you.

cmake -DGDAL_CONFIG=/usr/local/Cellar/gdal/2.4.4/bin/gdal-config ../.