OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.84k stars 2.53k forks source link

building with ECW SDK 5.5 fails with undefined references #2657

Closed chrisgraf closed 4 years ago

chrisgraf commented 4 years ago

Expected behavior and actual behavior.

I expect the build system to build GDAL or inform about missing or incompatible libraries but I get (after a sucessful ./configure) the following error messages during make:

make[1]: Leaving directory '/home/graf/landscapelab/gdal/gdal'
(cd apps; make)
make[1]: Entering directory '/home/graf/landscapelab/gdal/gdal/apps'
/bin/bash /home/graf/landscapelab/gdal/gdal/libtool --mode=link --silent g++  gdalinfo_bin.lo  /home/graf/landscapelab/gdal/gdal/libgdal.la  -o gdalinfo
/usr/bin/ld: /home/graf/landscapelab/gdal/gdal/.libs/libgdal.so: undefined reference to `NCS::CString::utf8_str(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const'
/usr/bin/ld: /home/graf/landscapelab/gdal/gdal/.libs/libgdal.so: undefined reference to `NCS::CIOStream::GetStreamCounters[abi:cxx11]()'
/usr/bin/ld: /home/graf/landscapelab/gdal/gdal/.libs/libgdal.so: undefined reference to `NCS::CString::Utf8Encode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)'
/usr/bin/ld: /home/graf/landscapelab/gdal/gdal/.libs/libgdal.so: undefined reference to `NCS::CView::SetTransformList(int, std::__cxx11::list<NCS::API::ITransform*, std::allocator<NCS::API::ITransform*> >&)'
/usr/bin/ld: /home/graf/landscapelab/gdal/gdal/.libs/libgdal.so: undefined reference to `NCS::CString::Utf8Decode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
make[1]: *** [GNUmakefile:90: gdalinfo] Error 1
make[1]: Leaving directory '/home/graf/landscapelab/gdal/gdal/apps'
make: *** [GNUmakefile:123: apps-target] Error 2

Steps to reproduce the problem.

$ ./configure --with-ecw=/<path>/<to>/ERDAS-ECW_JPEG_2000_SDK-5.5.0 --with-libtiff=internal --with-geotiff=internal
$ make

Operating system

Ubuntu 20.04 64 bit

GDAL version and provenance

latest sources from github (https://github.com/OSGeo/gdal/commit/3554675bbce8dc00030bac33c99d92764d0f3844)

rouault commented 4 years ago

I strongly suspect this is another symptom of https://github.com/OSGeo/gdal/issues/2394 , related to ECW SDK including a libstdc++ not compatible of the compiler you use

chrisgraf commented 4 years ago

thanks for your answer! What is the latest GDAL-Version and ECW SDK Version combination which is known to work?

rouault commented 4 years ago

This is not a matter of GDAL version, but more of operating system version / compiler you use. I don't know exactly. Perhaps @jbowman-hexagon would know

chrisgraf commented 4 years ago

i see. I have Ubuntu 20.04 (kernel: 5.6.15-050615-generic #202005271638 SMP Wed May 27 16:42:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux) with gcc/g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0 .. would be great if anybody can help me with finding a working setup!

rouault commented 4 years ago

Works well for me on Ubuntu 16.04 with gcc 5.5

jbowman-hexagon commented 4 years ago

Hi all, I have a working Ubuntu 18.04 VM with kernel: 4.15.0-106-generic #107-Ubuntu SMP and gcc 7.5.0 (7.5.0-3ubuntu1~18.04). GDAL 3.2.0-dev with ECW SDK 5.5. I am investigating #2394, and may be able to look at this as well. @chrisgraf Currently building with your configure options (on Ubuntu 18) and will try to spin up an Ubuntu 20.04 vm and compile with that overnight.

jbowman-hexagon commented 4 years ago

@chrisgraf what was the GDAL and PROJ version (or commit) you are trying to use? Perhaps I'm doing something wrong but if I try to ./configure with PROJ latest the script exits with 'error: proj.h not found' at the checking for PROJ >= 6 step. As mentioned I am spinning up an Ubuntu 20 VM and will see what happens

rouault commented 4 years ago

what was the GDAL and PROJ version (or commit) you are trying to use?

From my initial analysis, this is likely not relevant. GDAL >= 3 indeed needs PROJ >= 6. Ubuntu 20.04 has PROJ 6.3.1 available.

chrisgraf commented 4 years ago

@jbowman-hexagon PROJ Rel. 6.3.1, February 10th, 2020 and GDAL was master with the last commit 3554675bbce8dc00030bac33c99d92764d0f3844

jbowman-hexagon commented 4 years ago

@chrisgraf This may be related to the older/newer C++ ABI. As it appears you are not explicitly selecting either, GCC 9 would (I'm assuming) default to the new ABI. In that case, have a look in the ECW SDK directory for the 'lib' dir. If you can see two subdirectories, 'cpp11abi' and 'x64' - Try renaming x64 to something else (this is the old ABI, we won't be using it here), and moving/copying/symlink the x64 directory UNDER the cpp11abi dir, to be directly inside the top-level 'lib' dir. Under x64 there should be debug and release dirs, keep this structure otherwise as-is.

jbowman-hexagon commented 4 years ago

I'd forgotten that I needed to do this under Ubuntu 18. Currently building on Ubuntu 20, but it seems to have fixed the compilation/linking issue. ECWSDK LIBDIR LINK OLDNEWABI

chrisgraf commented 4 years ago

@jbowman-hexagon I tried to apply your change and build gdal from scratch but I get the same error messages :/

jbowman-hexagon commented 4 years ago

@chrisgraf Yes, I discovered later that day I was incorrect. Apologies. Unfortunately I don't foresee having enough available time to look further into this in the immediate future, but I could suggest a couple of other things you might like to try, and I think have a chance to resolve things.

Apologies I cannot assist much further at least for now, I have a few bugs to track down including one Even mentioned above. If he proves to be correct in suspecting a link between that one and this, however, I'll post any extra relevant information I discover.

Also ECW SDK 5.5 Update 2 will be released in a month or so (roughly), this may or may not improve the situation.

jmckenna commented 4 years ago

I also hit these many 5.5 SDK issues a few months ago: solved with falling back to SDK 5.4

jbowman-hexagon commented 4 years ago

Thanks for comment @jmckenna . That seems slightly odd to me as I've been building and using 5.5SDK with multiple OSes , compilers and options. My only thought (at least off the top of my head) is that it then may be dependent on ./configure options and/or Unicode-related issue(s)

jbowman-hexagon commented 4 years ago

Or possibly as @rouault suggests, a compiler and/or OS related issue. If we can compile (no pun intended) information here I can at the very least refer to it in future if the priority somehow were to increase, or possibly relating to other issues. Sadly we cannot hunt all bugs all the time, and have not see this enough at this point in time to justify putting it ahead of others. Definitely appreciate the input, however.

rduivenvoorde commented 3 years ago

For reference, I hit this (building gdal 3.1 (because that is what ecw lib 5.5.0 mentions), gcc 10.2 on Debian Testing.

And after the 'move x64 dir, and link to cpp11abi/x64 dir'-trick mentioned above all succeeded \o/

eusoubrasileiro commented 1 year ago

@rduivenvoorde thanks a lot!!! After struggling here a lot.

I can confirm just made it work using the SDK 5.5.0 after hitting the same Ubuntu 22.04. Following you after @jbowman-hexagon suggestion the cpp11abi folder is the solution since we need the library for the newer C++ ABI

In make case I had to export LD_LIBRARY_PATH=/your-hexagon-sdk-path/lib/cpp11abi/x64/release:$LD_LIBRARY_PATH before make -j$(nproc). Everything working perfectly!!!

slaicha commented 3 months ago

I'm facing the same errors as those above. I downloaded ECW SDK 5.5. I wanted to try 5.4 but couldn't find it online. For GDAL, I tried the latest version 3.9, and two others 3.5.3 and 3.1.3. I couldn't compile the first one. For, the last two versions, I got the same errors as above. Any thoughts on how I can troubleshoot this?

Operating System: Ubuntu 22.04.4 LTS