Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which GDAL version for compiling #15

Open
MCerk opened this issue Feb 15, 2015 · 32 comments
Open

Which GDAL version for compiling #15

MCerk opened this issue Feb 15, 2015 · 32 comments

Comments

@MCerk
Copy link

MCerk commented Feb 15, 2015

Hi, I have pulled GDAL from SVN (https://svn.osgeo.org/gdal/trunk/gdal) and installed it by ./configure, make, make install (I did not choose any extra configure parameters). The installed version is:

GDAL 2.0.0dev, released 2014/04/16

But the cmake of CTB still throws an error:

The GDAL version must be one that implements RFC 46 (GDAL/OGR unification)
i.e. >= 2.0.0

Which GDAL version should I install?

@gberaudo
Copy link
Contributor

Latest ctb version has a fix for a similar issue.
See #14.

@MCerk
Copy link
Author

MCerk commented Feb 16, 2015

I have used now the latest ctp version and I pass that error. However now it can't find the GDALOpenEx function.

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - 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
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found GDAL: /usr/local/lib/libgdal.so
-- Looking for GDALOpenEx in gdal
-- Looking for GDALOpenEx in gdal - not found
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

@gberaudo
Copy link
Contributor

gberaudo commented Feb 16, 2015 via email

@MCerk
Copy link
Author

MCerk commented Feb 16, 2015

I have installed GDAL from source yesterday (see my first post). This is the list (ls) of the file above:

lrwxrwxrwx 1 root root 17 Feb 15 23:51 /usr/local/lib/libgdal.so -> libgdal.so.1.18.0

By installing GDAL I did not pass any parameters (./configure), neither did I by CTP (cmake).

@epifanio
Copy link

I'm having similar issues tring to build the latest git clone of cesium-terrain-builder. On my system i have gdal installed from its git-svn mirror

My gdal version :

gdalinfo --version
GDAL 2.0.0dev, released 2014/04/16

I installed gdal on a non standard prefix, this is the results of gdal-config --libs :

which gdal-config 
/home/epilib/Envs/env1/bin//gdal-config
gdal-config --libs
-L/home/epilib/Envs/env1/lib -lgdal

In the cesium-terrain-builder cmake configuration i have the following :

 GDAL_CONFIG                      /home/epilib/Envs/env1/bin/gdal-config                             
 GDAL_INCLUDE_DIR                 /home/epilib/Envs/env1/include                                     
 GDAL_LIBRARY                     /home/epilib/Envs/env1/lib/libgdal.so 

But the cmake configure ends with the following error :

 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

In my /lib ls ../lib/ | grep gdal directory i have :


gdalplugins
libgdal.a
libgdal.la
libgdal.so
libgdal.so.1
libgdal.so.1.17.1
libgdal.so.1.18.0

that's my gdal.pc cat ../lib/pkgconfig/gdal.pc:

CONFIG_VERSION=2.0.0
CONFIG_INST_PREFIX=/home/epilib/Envs/env1
CONFIG_INST_LIBS=-L/home/epilib/Envs/env1/lib -lgdal
CONFIG_INST_CFLAGS=-I/home/epilib/Envs/env1/include
CONFIG_INST_DATA=/home/epilib/Envs/env1/share/gdal/data
prefix=${CONFIG_INST_PREFIX}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${exec_prefix}/include
datadir=${CONFIG_INST_DATA}

Name: libgdal
Description: Geospatial Data Abstraction Library
Version: ${CONFIG_VERSION}
Libs: ${CONFIG_INST_LIBS}
Cflags: ${CONFIG_INST_CFLAGS}

@epifanio
Copy link

i had to remove the check and ctb built fine without errors/worning. I'll try to generate tiles and see if any trouble (i'm using gdal from svn trubk)

@mrgloom
Copy link

mrgloom commented Apr 13, 2017

Any update on this?

Seems I have same problem here #45
Also similar problem here #6

@icemagno
Copy link

Solved with sudo apt install -y gdal-bin python-gdal libgdal-dev

@markerikson
Copy link

As best as I can tell, this only compiles with GDAL 2.1.x, because of the overview function described in #51 .

Would be great if we can figure out how to get it to compile with GDAL 2.2.x instead.

@markerikson
Copy link

So it seems that GDALCreateOverviewDataset both had a signature change, and is not exported any more in 2.2, per GDAL changeset 37723. Not sure why that was changed, but it was.

There's some relevant discussion in rasterio/rasterio#1161 . Still trying to go through this.

@epifanio
Copy link

epifanio commented Mar 21, 2018

I'm facing the same problem:

epinux@Ubuntu-1604-xenial-64-minimal:~/dev/cesium-terrain-builder/build$ make
Scanning dependencies of target ctb
[  5%] Building CXX object src/CMakeFiles/ctb.dir/GDALTile.cpp.o
[ 11%] Building CXX object src/CMakeFiles/ctb.dir/GDALTiler.cpp.o
/home/epinux/dev/cesium-terrain-builder/src/GDALTiler.cpp: In function ‘void* getOverviewDataset(GDALDatasetH, GDALTransformerFunc, void*)’:
/home/epinux/dev/cesium-terrain-builder/src/GDALTiler.cpp:249:87: error: too many arguments to function ‘GDALDataset* GDALCreateOverviewDataset(GDALDataset*, int, int)’
                   poSrcOvrDS = GDALCreateOverviewDataset( poSrcDS, iOvr, FALSE, FALSE );
                                                                                       ^
In file included from /home/epinux/dev/cesium-terrain-builder/src/GDALTiler.cpp:27:0:
/usr/local/include/gdal_priv.h:1566:14: note: declared here
 GDALDataset* GDALCreateOverviewDataset(GDALDataset* poDS, int nOvrLevel,
              ^
src/CMakeFiles/ctb.dir/build.make:86: recipe for target 'src/CMakeFiles/ctb.dir/GDALTiler.cpp.o' failed
make[2]: *** [src/CMakeFiles/ctb.dir/GDALTiler.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

this happen with gdal trunk as well as with gdal installed from the ubuntu-gis repository:

/usr/bin/gdal-config --version
2.2.2

@epifanio
Copy link

To fix the build, just remove the extra argument. Not sure it will affect the library behaviour... in GDALTiler.cpp:249

---  poSrcOvrDS = GDALCreateOverviewDataset( poSrcDS, iOvr, FALSE, FALSE );
+++ poSrcOvrDS = GDALCreateOverviewDataset( poSrcDS, iOvr, FALSE );

testing now.

@ahuarte47
Copy link

ahuarte47 commented Mar 21, 2018

Hi, I had the same problem, @epifanio is right, I removed the extra argument and CTB runs fine

@epifanio
Copy link

Testing the change, ctb-tile produced correct tiles. I'm using geo-data/cesium-terrain-builder:master @ahuarte47 , now switching on your fork to test #55 (/me feelling excytied!)

@ahuarte47
Copy link

ahuarte47 commented Mar 21, 2018

Just now I am changing the code to create the Json metadata file when the tile set is created first time. It avoids to execute CTB twice.

@epifanio
Copy link

epifanio commented Mar 21, 2018

@ahuarte47 thanks! Quick OT question: To test the quantized-mesh output before the PR will be merged, is https://github.com/ahuarte47/cesium-terrain-builder.git [branch:master-quantized-mesh] the right repo?

@ahuarte47
Copy link

Yes, direct link here

@ahuarte47
Copy link

Hi @epifanio, I updated the PR to can build with different versions of GDAL+GDALCreateOverviewDataset.

@epifanio
Copy link

Thanks @ahuarte47 - Merged the PR on my fork. Tested, it builds with gdal maser and tiles are generated with no errors. I need to test this on underwater surfaces. How do you serve the tiles to cesium? Is cesium-terrain-server master what I need to use?

@ahuarte47
Copy link

ahuarte47 commented Mar 22, 2018

It is an option), but you can directly publish the directory in a Tomcat, Wildfly, IIS, or so on. Cesium can fetch the tiles via REST, you could read about it in TerrainCesiumProvider documentation.

@epifanio
Copy link

@ahuarte47 continuing the discussion on #55

@ahuarte47
Copy link

ok

@ediebold
Copy link

@markerikson - moved here. I'm having trouble building since updating to GDAL 2.2.2, since it's not exporting the GDALCreateOverviewDataset function. Is there a fix?

@markerikson
Copy link

My workaround for now was to just build GDAL 2.1.4 myself, and compile CTB against that.

@ahuarte47
Copy link

ahuarte47 commented Mar 26, 2018

My workaround was to include the gdaloverviewdataset.cpp source file in GDALTiler.cpp just before "getOverviewDataset" declaration. I build with GDAL 2.3.x in Windows.

LINE204: #include "gdaloverviewdataset.cpp"

But obviously you have to download the GDAL sources

@ediebold
Copy link

Okay, thanks to the fix in #55 to allow for 2.1 support, I was able to build using the 2.1.3 GDAL library from the ubuntugis stable ppa.

Thanks!

@mrgloom
Copy link

mrgloom commented May 18, 2018

I was using apt-get to install gdal on Ubuntu 14.04:

sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt install -y gdal-bin python-gdal libgdal-dev

I get

../src/libctb.so: undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int)'

with

ls /usr/lib/ | grep gdal
libgdal.a
libgdal.so
libgdal.so.20
libgdal.so.20.3.1
apt list --installed | grep gdal
gdal-bin/trusty,now 2.2.2+dfsg-1~trusty1 amd64 [installed]
gdal-data/trusty,now 2.2.2+dfsg-1~trusty1 all [installed,automatic]
libgdal-dev/trusty,now 2.2.2+dfsg-1~trusty1 amd64 [installed]
libgdal20/trusty,now 2.2.2+dfsg-1~trusty1 amd64 [installed,automatic]
python-gdal/trusty,now 2.2.2+dfsg-1~trusty1 amd64 [installed]
python3-gdal/trusty,now 2.2.2+dfsg-1~trusty1 amd64 [installed]
/usr/bin/gdal-config --version
2.2.2

Build log:

Cloning into 'cesium-terrain-builder'...
remote: Counting objects: 1071, done.
remote: Total 1071 (delta 0), reused 0 (delta 0), pack-reused 1071
Receiving objects: 100% (1071/1071), 260.28 KiB | 0 bytes/s, done.
Resolving deltas: 100% (763/763), done.
Checking connectivity... done.
HEAD is now at 8dd633c Fix building on Docker Hub.
-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- 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
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found GDAL: /usr/lib/libgdal.so  
-- Looking for GDALOpenEx in gdal
-- Looking for GDALOpenEx in gdal - found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/temp/cesium-terrain-builder/build
Scanning dependencies of target ctb
[  9%] Building CXX object src/CMakeFiles/ctb.dir/GDALTile.cpp.o
[ 18%] Building CXX object src/CMakeFiles/ctb.dir/GDALTiler.cpp.o
[ 27%] Building CXX object src/CMakeFiles/ctb.dir/TerrainTiler.cpp.o
[ 36%] Building CXX object src/CMakeFiles/ctb.dir/TerrainTile.cpp.o
[ 45%] Building CXX object src/CMakeFiles/ctb.dir/GlobalMercator.cpp.o
[ 54%] Building CXX object src/CMakeFiles/ctb.dir/GlobalGeodetic.cpp.o
Linking CXX shared library libctb.so
[ 54%] Built target ctb
Scanning dependencies of target commander
[ 63%] Building C object deps/CMakeFiles/commander.dir/commander.c.o
Linking C static library libcommander.a
[ 63%] Built target commander
Scanning dependencies of target ctb-export
[ 72%] Building CXX object tools/CMakeFiles/ctb-export.dir/ctb-export.cpp.o
Linking CXX executable ctb-export
../src/libctb.so: undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/ctb-export] Error 1
make[1]: *** [tools/CMakeFiles/ctb-export.dir/all] Error 2
make[1]: *** [tools/CMakeFiles/ctb-export.dir/all] Error 2
make: *** [all] Error 2

So, as I understand I need to install some 2.1.* gdal.

apt-cache show gdal-bin | grep Version
Version: 2.2.2+dfsg-1~trusty1
Version: 2.1.0+dfsg-1~trusty2
Version: 1.10.1+dfsg-5ubuntu1

I have tried 2.1.0:

sudo apt-get install libgdal20=2.1.0+dfsg-1~trusty2
sudo apt-get install gdal-bin=2.1.0+dfsg-1~trusty2
sudo apt-get install python-gdal=2.1.0+dfsg-1~trusty2
sudo apt-get install libgdal-dev=2.1.0+dfsg-1~trusty2

But it still give an error:

Cloning into 'cesium-terrain-builder'...
remote: Counting objects: 1071, done.
remote: Total 1071 (delta 0), reused 0 (delta 0), pack-reused 1071
Receiving objects: 100% (1071/1071), 260.28 KiB | 0 bytes/s, done.
Resolving deltas: 100% (763/763), done.
Checking connectivity... done.
HEAD is now at 8dd633c Fix building on Docker Hub.
-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- 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
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found GDAL: /usr/lib/libgdal.so  
-- Looking for GDALOpenEx in gdal
-- Looking for GDALOpenEx in gdal - found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/temp/cesium-terrain-builder/build
Scanning dependencies of target ctb
[  9%] Building CXX object src/CMakeFiles/ctb.dir/GDALTile.cpp.o
[ 18%] Building CXX object src/CMakeFiles/ctb.dir/GDALTiler.cpp.o
/home/user/temp/cesium-terrain-builder/src/GDALTiler.cpp: In function \u2018void* getOverviewDataset(GDALDatasetH, GDALTransformerFunc, void*)\u2019:
/home/user/temp/cesium-terrain-builder/src/GDALTiler.cpp:249:79: error: too few arguments to function \u2018GDALDataset* GDALCreateOverviewDataset(GDALDataset*, int, int, int)\u2019
                   poSrcOvrDS = GDALCreateOverviewDataset( poSrcDS, iOvr, FALSE);
                                                                               ^
In file included from /home/user/temp/cesium-terrain-builder/src/GDALTiler.cpp:27:0:
/usr/include/gdal/gdal_priv.h:1396:22: note: declared here
 GDALDataset CPL_DLL* GDALCreateOverviewDataset(GDALDataset* poDS, int nOvrLevel,
                      ^
make[2]: *** [src/CMakeFiles/ctb.dir/GDALTiler.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/ctb.dir/all] Error 2
make: *** [all] Error 2

@ahuarte47
Copy link

This comment could help you

@mrgloom
Copy link

mrgloom commented May 21, 2018

Do you mean using using hack adding external .h .cpp files?

Does current master will compile with GDAL 2.2.*?
3b9394f

Also related #66

@ahuarte47
Copy link

ahuarte47 commented May 21, 2018

Include #include "gdaloverviewdataset.cpp" just before of GDALCreateOverviewDataset call in GDALTiler.cpp

@mrgloom
Copy link

mrgloom commented May 22, 2018

Seems it works.
diff.txt

git clone https://github.com/geo-data/cesium-terrain-builder.git
cd cesium-terrain-builder
git reset --hard 8dd633c13582956a2bfdd9f447f62bde04682b9a
git apply diff.patch
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ..
make all

@meiyujack
Copy link

Seems it works.
diff.txt

git clone https://github.com/geo-data/cesium-terrain-builder.git
cd cesium-terrain-builder
git reset --hard 8dd633c13582956a2bfdd9f447f62bde04682b9a
git apply diff.patch
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ..
make all

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants