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) > FIND_LIBRARY(GDAL_LIBRARY NAMES gdal) > FIND_LIBRARY(TIFF_LIBRARY NAMES tiff) > FIND_LIBRARY(GEOTIFF_LIBRARY NAMES geotiff) > > INCLUDE_DIRECTORIES(${GDAL_INCLUDE_DIR}) > > ADD_EXECUTABLE(gdalHideSymbols gdalHideSymbols.cxx) > TARGET_LINK_LIBRARIES(gdalHideSymbols ${TIFF_LIBRARY} > ${GEOTIFF_LIBRARY} ${GDAL_LIBRARY}) > > 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 _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev