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

Compile on Ubuntu 14.04? #45

Closed
mrgloom opened this issue Feb 9, 2017 · 5 comments
Closed

Compile on Ubuntu 14.04? #45

mrgloom opened this issue Feb 9, 2017 · 5 comments

Comments

@mrgloom
Copy link

mrgloom commented Feb 9, 2017

What proper apt-get install command for gdal library?

List of my installed packages:

apt list --installed | grep gdal

gdal-bin/trusty,now 1.10.1+dfsg-5ubuntu1 amd64 [installed,automatic]
libgdal-dev/trusty,now 1.10.1+dfsg-5ubuntu1 amd64 [installed]
libgdal1h/trusty,now 1.10.1+dfsg-5ubuntu1 amd64 [installed,automatic]
python-gdal/trusty,now 1.10.1+dfsg-5ubuntu1 amd64 [installed]

Howewer:

cmake ..

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

Do we need to build gdal from source?

@543802360
Copy link

you do not need to build gdal from source.you can just install it.my os is macox,you can see this http://gis.stackexchange.com/questions/155403/installing-gdal-on-macosx

@mrgloom
Copy link
Author

mrgloom commented Apr 13, 2017

Problem is that on Ubuntu 14.04 by default apt-get install install some older version than cesium-terrain-builder need for compile:

sudo apt-get install gdal-bin
sudo apt-get install python-gdal
sudo apt-get install libgdal-dev

I have compiled gdal from source:

#For cesium-terrain-builder we need GDAL version >= 2.0.0
#Build gdal from source https://trac.osgeo.org/gdal/wiki/BuildingOnUnix
#All versions http://download.osgeo.org/gdal/
#Build with python support https://gis.stackexchange.com/questions/21728/installing-gdal-1-9-0-on-linux-ubuntu-server-10-04/21739#21739
wget http://download.osgeo.org/gdal/2.1.3/gdal-2.1.3.tar.gz
tar -xvzf gdal-2.1.3.tar.gz
cd gdal-2.1.3
mkdir build
./configure --with-python --prefix=`pwd`/build
sudo make
sudo make install

But how to specify location of the gdal to cmake?

-- 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


-- Configuring incomplete, errors occurred!
See also "/home/user/Downloads/cesium-terrain-builder/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/Downloads/cesium-terrain-builder/build/CMakeFiles/CMakeError.log".

@mrgloom
Copy link
Author

mrgloom commented Apr 13, 2017

It's something like:
~/Downloads/cesium-terrain-builder/build$ cmake -D GDAL_LIBRARY="/home/user/Downloads/gdal-2.1.3/build/lib" -D GDAL_INCLUDE_DIR="/home/user/Downloads/gdal-2.1.3/build/include" ..

But it produces error (seems same as here #15 ):

-- Found GDAL: /home/user/Downloads/gdal-2.1.3/build/lib  
-- 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


-- Configuring incomplete, errors occurred!

Howewer my gdal builded from source:

./gdal-config --version
2.1.3
./gdalinfo --version
GDAL 2.1.3, released 2017/20/01

After adding GDAL_CONFIG:

~/Downloads/cesium-terrain-builder/build$ cmake -D GDAL_LIBRARY="/home/user/Downloads/gdal-2.1.3/build/lib" -D GDAL_INCLUDE_DIR="/home/user/Downloads/gdal-2.1.3/build/include" -D GDAL_CONFIG="/home/user/Downloads/gdal-2.1.3/build/bin/gdal-config" ..
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


-- Configuring incomplete, errors occurred!
See also "/home/user/Downloads/cesium-terrain-builder/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/Downloads/cesium-terrain-builder/build/CMakeFiles/CMakeError.log".

@mrgloom
Copy link
Author

mrgloom commented Apr 13, 2017

Also I can find GDALOpenEx function in headers:

~/Downloads/gdal-2.1.3/build/include$ grep -n -r GDALOpenEx .
./gdal_priv.h:298:    friend GDALDatasetH CPL_STDCALL GDALOpenEx( const char* pszFilename,
./gdal.h:358: * Used by GDALOpenEx().
./gdal.h:364: * Used by GDALOpenEx().
./gdal.h:370: * Used by GDALOpenEx().
./gdal.h:376: * Used by GDALOpenEx().
./gdal.h:382: * Used by GDALOpenEx().
./gdal.h:389: * Used by GDALOpenEx().
./gdal.h:402: * Used by GDALOpenEx().
./gdal.h:408: * Used by GDALOpenEx().
./gdal.h:416: * Used by GDALOpenEx().
./gdal.h:427: * Used by GDALOpenEx().
./gdal.h:437: * Used by GDALOpenEx().
./gdal.h:447: * Used by GDALOpenEx().
./gdal.h:455:GDALDatasetH CPL_DLL CPL_STDCALL GDALOpenEx( const char* pszFilename,

Howerwer commenting out this condition not helped:

#check_library_exists(gdal GDALOpenEx "${GDAL_LIBRARY_DIR}" HAVE_UNIFIED_GDAL)
#if(NOT MSVC AND NOT HAVE_UNIFIED_GDAL)
#  message(FATAL_ERROR "The GDAL version must be one that implements RFC 46 (GDAL/OGR unification) i.e. >= 2.0.0")
#endif()

Error:

~/Downloads/cesium-terrain-builder/build$ make
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
CMakeFiles/ctb-export.dir/ctb-export.cpp.o: In function `terrain2tiff(ctb::TerrainTile&, char const*)':
ctb-export.cpp:(.text+0x26): undefined reference to `GDALGetDriverByName'
ctb-export.cpp:(.text+0x57): undefined reference to `GDALCreateCopy'
ctb-export.cpp:(.text+0x6e): undefined reference to `GDALClose'
ctb-export.cpp:(.text+0x7a): undefined reference to `GDALClose'
CMakeFiles/ctb-export.dir/ctb-export.cpp.o: In function `main':
ctb-export.cpp:(.text+0x1c5): undefined reference to `GDALAllRegister'
../src/libctb.so: undefined reference to `CPLMalloc'
../src/libctb.so: undefined reference to `GDALRasterBand::GetXSize()'
../src/libctb.so: undefined reference to `VSIFree'
../src/libctb.so: undefined reference to `GDALDataset::GetRasterYSize()'
../src/libctb.so: undefined reference to `OGRSpatialReference::~OGRSpatialReference()'
../src/libctb.so: undefined reference to `GDALDataset::GetRasterBand(int)'
../src/libctb.so: undefined reference to `CPLStringList::CPLStringList(char**, int)'
../src/libctb.so: undefined reference to `GDALDataset::Dereference()'
../src/libctb.so: undefined reference to `GDALDataset::GetRasterCount()'
../src/libctb.so: undefined reference to `OGRSpatialReference::operator=(OGRSpatialReference const&)'
../src/libctb.so: undefined reference to `GDALRasterIO'
../src/libctb.so: undefined reference to `GDALSetProjection'
../src/libctb.so: undefined reference to `GDALCreateApproxTransformer'
../src/libctb.so: undefined reference to `GDALApproxTransform'
../src/libctb.so: undefined reference to `CPLStringList::CPLStringList()'
../src/libctb.so: undefined reference to `OGRSpatialReference::importFromEPSG(int)'
../src/libctb.so: undefined reference to `GDALRasterBand::RasterIO(GDALRWFlag, int, int, int, int, void*, int, int, GDALDataType, long long, long long, GDALRasterIOExtraArg*)'
../src/libctb.so: undefined reference to `GDALDataset::Reference()'
../src/libctb.so: undefined reference to `OGRSpatialReference::OGRSpatialReference(OGRSpatialReference const&)'
../src/libctb.so: undefined reference to `CPLStringList::SetNameValue(char const*, char const*)'
../src/libctb.so: undefined reference to `GDALCreateWarpOptions'
../src/libctb.so: undefined reference to `GDALDataset::GetRasterXSize()'
../src/libctb.so: undefined reference to `OGRSpatialReference::Validate()'
../src/libctb.so: undefined reference to `OGRSpatialReference::IsSame(OGRSpatialReference const*) const'
../src/libctb.so: undefined reference to `GDALDestroyWarpOptions'
../src/libctb.so: undefined reference to `OGRSpatialReference::exportToWkt(char**) const'
../src/libctb.so: undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int, int)'
../src/libctb.so: undefined reference to `CPLStringList::~CPLStringList()'
../src/libctb.so: undefined reference to `GDALDestroyGenImgProjTransformer'
../src/libctb.so: undefined reference to `GDALSetGenImgProjTransformerDstGeoTransform'
../src/libctb.so: undefined reference to `GDALGetRasterBand'
../src/libctb.so: undefined reference to `OGRCreateCoordinateTransformation(OGRSpatialReference*, OGRSpatialReference*)'
../src/libctb.so: undefined reference to `GDALCreateWarpedVRT'
../src/libctb.so: undefined reference to `GDALCreateGenImgProjTransformer2'
../src/libctb.so: undefined reference to `GDALGenImgProjTransform'
../src/libctb.so: undefined reference to `OGRSpatialReference::OGRSpatialReference(char const*)'
../src/libctb.so: undefined reference to `GDALSuggestedWarpOutput2'
../src/libctb.so: undefined reference to `GDALSetGeoTransform'
../src/libctb.so: undefined reference to `GDALCreate'
../src/libctb.so: undefined reference to `GDALDataset::GetRefCount() const'
../src/libctb.so: undefined reference to `GDALGetProjectionRef'
../src/libctb.so: undefined reference to `CPLStringList::StealList()'
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: *** [all] Error 2

@mrgloom
Copy link
Author

mrgloom commented Apr 14, 2017

Seems this solve the problem(don't know what make a trick gdal version 2.0.1 or ./configure without prefix):

wget http://download.osgeo.org/gdal/2.0.1/gdal-2.0.1.tar.gz
tar -xvzf gdal-2.0.1.tar.gz
cd gdal-2.0.1
mkdir build
./configure --with-python
sudo make
sudo make install

@mrgloom mrgloom closed this as completed Apr 14, 2017
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

2 participants