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

undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int)' #109

Open
xzg5101 opened this issue Jul 5, 2023 · 10 comments
Open

Comments

@xzg5101
Copy link

xzg5101 commented Jul 5, 2023

Hi!
I am trying to install CTB on WSL, Ubuntu 22.04.2 LTS. My gdal verson is 3.4.3, cmake version is 3.22.1.
When I run cmake in build directory, it seems normal? (I am not familiar with CMake, so maybe I failed to spot an issue):

xzg5101@DESKTOP:/path/to/repository/cesium-terrain-builder/build$ make install
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- 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 pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found GDAL: /usr/lib/libgdal.so (found version "3.4.3")
-- 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.11")
-- Configuring done
-- Generating done
-- Build files have been written to: /path/to/repository/cesium-terrain-builder/build

But when I ran make install, it gave me an error:

xzg5101@DESKTOP:/path/to/repository/cesium-terrain-builder/build$ make install
[  5%] Building CXX object src/CMakeFiles/ctb.dir/GDALTile.cpp.o
[ 11%] Building CXX object src/CMakeFiles/ctb.dir/GDALTiler.cpp.o
[ 17%] Building CXX object src/CMakeFiles/ctb.dir/TerrainTiler.cpp.o
[ 23%] Building CXX object src/CMakeFiles/ctb.dir/TerrainTile.cpp.o
[ 29%] Building CXX object src/CMakeFiles/ctb.dir/GlobalMercator.cpp.o
[ 35%] Building CXX object src/CMakeFiles/ctb.dir/GlobalGeodetic.cpp.o
[ 41%] Linking CXX shared library libctb.so
[ 41%] Built target ctb
[ 47%] Building C object deps/CMakeFiles/commander.dir/commander.c.o
[ 52%] Linking C static library libcommander.a
[ 52%] Built target commander
[ 58%] Building CXX object tools/CMakeFiles/ctb-tile.dir/ctb-tile.cpp.o
[ 64%] Linking CXX executable ctb-tile
/usr/bin/ld: ../src/libctb.so: undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/CMakeFiles/ctb-tile.dir/build.make:101: tools/ctb-tile] Error 1
make[1]: *** [CMakeFiles/Makefile2:193: tools/CMakeFiles/ctb-tile.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I confirmed GDAL are installed property in default directory, and have also tried to manully enter path for DGDAL_LIBRARY_DIR, DGDAL_LIBRARY, and DGDAL_INCLUDE_DIR, but it ended up the same. I wonder how can I resolve this issue. Any help is appreciated!

@xzg5101 xzg5101 changed the title undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int)' ../src/libctb.so: undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int)' Jul 5, 2023
@xzg5101 xzg5101 changed the title ../src/libctb.so: undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int)' undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int)' Jul 5, 2023
@BWibo
Copy link

BWibo commented Jul 5, 2023

This is no longer actively developed. It's very likely, that the GDAL version you are using is no longer compatible with CTB. Checkout this Docker image to use the tool without building it your own.
https://github.com/tum-gis/cesium-terrain-builder-docker

@xzg5101
Copy link
Author

xzg5101 commented Jul 11, 2023

This is no longer actively developed. It's very likely, that the GDAL version you are using is no longer compatible with CTB. Checkout this Docker image to use the tool without building it your own. https://github.com/tum-gis/cesium-terrain-builder-docker

Thank you very much for your reply. I was sick for the past 5 days so I did not see your suggestion right a way. My aim is actually automate the process of converting contour file (dwg/dxf) into cesiuim terrains, and add this function to a local toolkit program. I am not very familiar with docker and heard it would be pretty difficult to put it together with my app. Do you have any suggestion, comment, or thought on how to achieve this?

@BWibo
Copy link

BWibo commented Jul 12, 2023

I don't think so. You can run CTB inside Docker and use it like any other command line tool. If you are new to Docker there is learning curve for sure, but I guaratee you it's worth looking into!

@xzg5101
Copy link
Author

xzg5101 commented Jul 21, 2023

I don't think so. You can run CTB inside Docker and use it like any other command line tool. If you are new to Docker there is learning curve for sure, but I guaratee you it's worth looking into!

Do you know any library or python packages that would allow me to create .terrain file?

@BWibo
Copy link

BWibo commented Jul 21, 2023

No, I have nothing in mind by heart, but wait let me google that for you. ;-)

@xzg5101
Copy link
Author

xzg5101 commented Jul 24, 2023

Well, I managed to build gdal 2.4.2 and use CTB from the other fork today eventually. Turned out that sucessfully building it just the key of open the door of issues. There are a lot of things for a rookie like me to learn before starting anything at all, and the general health condition of the C++ GIS repos I saw in these days freaked me out a bit. The process of debugging is basically marching in a blackbox to me. Also sadly your google guide did not provide me any useful information as that was the first thing I did, which brought me here, but if it gave you joy at all I guess its worthwhile. I'll definetly learn docker, but its probably not something I would use for this task this time. Thank you for the suggestion anyway.

@BWibo
Copy link

BWibo commented Jul 24, 2023

Yes, I'd recommend to learn Docker. It's not too hard and really worth the effort. In many cases it will save you from building things on your own, which can be quite hard.

A quick search gave me this:

Please report back if one of those turned out to be helpful.

@xzg5101
Copy link
Author

xzg5101 commented Jul 25, 2023

I have checked the first two links before, and they are not helpful other than lead me to CTB. The third one looks promising, but it has a lot of dependencies to install. I might have to try the third one, because for some reason CTB only output the top two layer of terrain tiles for some of my input files. Thank you for the information.

@lilithgrigoryan
Copy link

Same problem occurred. As I understand, newer vesions of gdal do not export this function to gdallibrary but it is still in source files.

One thing you can try is to install older gdal versions (not sure which specific version, but most probably 2.4.0 and older). I got some problems here and didn't manage to solve them. Other thing that actually worked for me was downloading GDAL sources and copying everything from gdaloverviewdataset.cpp file into cesium-terrain-builder source files. This worked fine.

@enzozyx
Copy link

enzozyx commented Feb 4, 2024

check your gdal version, gdal version > 3.4, you can not found this method GDALCreateOverviewDataset. I switch the version from 3.8 to 3.4, it`s ok.

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

4 participants