[gdal-dev] Problems with TIFF internal symbols

Emmanuel Christophe emmanuel.christophe at gmail.com
Fri Nov 20 01:46:45 EST 2009

On Fri, Nov 20, 2009 at 2:24 PM, Francesco P. Lovergine
<frankie at debian.org> wrote:
> On Fri, Nov 20, 2009 at 11:17:51AM +0800, Emmanuel Christophe wrote:
>> Hi,
>> I took a bit more time to investigate this and came out with a minimal
>> test case to reproduce that (using only gdal). The context is a
>> project using gdal AND some specific geotiff methods thus requiring
>> both for linking.
>> Since gdal 1.6 on Debian, the option with-hide-internal-symbols is
>> used which appears to cause segmentation fault when reading geotiff
>> files.
>> The test program (also attached):
>> #include "gdal.h"
>> int main(int argc, char * argv[])
>> {
>>   GDALAllRegister();
>>   GDALOpen(argv[1], GA_ReadOnly );
>> }
>> It is compiled using cmake with the following CMakeLists.txt:
>> FIND_PATH(GDAL_INCLUDE_DIR gdal.h /usr/include/gdal)
>> ADD_EXECUTABLE(gdalHideSymbols gdalHideSymbols.cxx)
>> I'm trying that using an updated debian testing with the official
>> packages for tiff, geotiff, gdal. Just 'cmake .', then 'make'
>> The segfault can be reproduced using a geotiff image, for example:
>> http://hg.orfeo-toolbox.org/OTB-Data/raw-file/51234ada686c/Input/ROI_QB_MUL_4.tif
>> It doesn't happen when the link to the geotiff library is removed.
>> Emmanuel
> Linking order does matter, I suspect. I wonder if gdal should use
> versioned symbols at linking time on Debian to avoid such breakages
> at all.
> --
> Francesco P. Lovergine

Yes, I can confirm that the order matters:

gcc -c gdalHideSymbols.cxx -I/usr/include/gdal
gcc gdalHideSymbols.o -lgeotiff -lgdal1.6.0 -o gdalHideSymbols-gtiffgdal
gcc gdalHideSymbols.o -lgdal1.6.0 -lgeotiff -o gdalHideSymbols-gdalgtiff
./gdalHideSymbols-gtiffgdal IMAGERY_ortho.tif
Segmentation fault
./gdalHideSymbols-gdalgtiff IMAGERY_ortho.tif

However, any order was working with the debian package for gdal 1.5

In a big project with a lot of dependencies, it's tricky to make sure
that the order is correct.


More information about the gdal-dev mailing list