[Liblas-devel] Using CMake with gdal and GeoTIFF -> Visual Studio Build Error

Howard Butler hobu.inc at gmail.com
Wed Mar 10 12:52:57 EST 2010


On Mar 10, 2010, at 10:46 AM, Bellinski, Dan wrote:

> Hey Mateusz,
>  
> I am using your CMake build with the latest libLAS code and running into a build error. I am linking libLAS with gdal 1.7.1 trunk and GeoTIFF 1.2.5 (linked with libTIFF 3.9.2). I have successfully built all the components (other than libLAS) and used the CMake files to create Visual Studio 2009 project files. All went well in the CMake generation with no error or warning. When I go to build from the generated VS project files, Las2ogr and las_c.dll are failing to build. The problematic output is listed below.
>  
> I am unsure where to go with troubleshooting.. do you have any idea what the problem may be? I made sure my libraries were correct in CMake but maybe I am missing something? I have the following library/include variables set up and building in release mode:
>  
> GDAL_INCLUDE_DIR: C:/gdal-1.7.1/port;C:/gdal-1.7.1/frmts/gtiff/libgeotiff;C:/gdal-1.7.1/frmts/gtiff/libtiff;C:/gdal-1.7.1/ogr;C:/gdal-1.7.1/gcore;C:/usr/include
> GDAL_LIBRARY: C:/gdal-1.7.1/gdal_i.lib
> GEOTIFF_INCLUDE_DIR: C:/usr/include
> GEOTIFF_LIBRARY: C:/usr/lib/geotiff_i.lib
>  
> Any assistance you could lend would be very appreciated. Thanks a lot for your help!
> 
> 4>Linking...
> 4>   Creating library C:\liblas-Built\bin\Release\Release\las2ogr.lib and object C:\liblas-Built\bin\Release\Release\las2ogr.exp
> 4>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFGetField referenced in function _GTIFWktFromMemBuf
> 4>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFWriteDirectory referenced in function _GTIFMemBufFromWkt
> 4>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFWriteCheck referenced in function _GTIFMemBufFromWkt
> 4>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFIsTiled referenced in function _GTIFMemBufFromWkt
> 4>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFWriteEncodedStrip referenced in function _GTIFMemBufFromWkt
> 4>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFSetField referenced in function _GTIFMemBufFromWkt
> 4>las.lib(tifvsi.obj) : error LNK2019: unresolved external symbol _TIFFError referenced in function "struct tiff * __cdecl VSI_TIFFOpen(char const *,char const *)" (?VSI_TIFFOpen@@YAPAUtiff@@PBD0 at Z)
> 4>C:\liblas-Built\bin\Release\Release\las2ogr.exe : fatal error LNK1120: 7 unresolved externals
> 4>Build log was saved at "file://c:\liblas-Built\apps\las2ogr.dir\Release\BuildLog.htm"
> 4>las2ogr - 8 error(s), 0 warning(s)
> 3>Linking...
> 3>   Creating library C:\liblas-Built\bin\Release\Release\las_c.lib and object C:\liblas-Built\bin\Release\Release\las_c.exp
> 3>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol __imp__stricmp referenced in function "void __cdecl WKTMassageDatum(char * *)" (?WKTMassageDatum@@YAXPAPAD at Z)
> 3>las.lib(gt_citation.obj) : error LNK2001: unresolved external symbol __imp__stricmp
> 3>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol __imp__strnicmp referenced in function _GTIFGetOGISDefn
> 3>las.lib(gt_citation.obj) : error LNK2001: unresolved external symbol __imp__strnicmp
> 3>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFGetField referenced in function _GTIFWktFromMemBuf
> 3>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFWriteDirectory referenced in function _GTIFMemBufFromWkt
> 3>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFWriteCheck referenced in function _GTIFMemBufFromWkt
> 3>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFIsTiled referenced in function _GTIFMemBufFromWkt
> 3>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFWriteEncodedStrip referenced in function _GTIFMemBufFromWkt
> 3>las.lib(gt_wkt_srs.obj) : error LNK2019: unresolved external symbol _TIFFSetField referenced in function _GTIFMemBufFromWkt
> 3>las.lib(tifvsi.obj) : error LNK2019: unresolved external symbol _TIFFError referenced in function "struct tiff * __cdecl VSI_TIFFOpen(char const *,char const *)" (?VSI_TIFFOpen@@YAPAUtiff@@PBD0 at Z)
> 3>C:\liblas-Built\bin\Release\Release\las_c.dll : fatal error LNK1120: 9 unresolved externals
> 3>Build log was saved at "file://c:\liblas-Built\src\las_c.dir\Release\BuildLog.htm"
> 3>las_c - 12 error(s), 7 warning(s)

Dan,

I believe this is a liblas cmake configuration issue where libtiff must be included as a library to link if GDAL is also linked.  GDAL unfortunately has the ability to internally or externally link libtiff, but there is no way to tell which it did as an outside user.  In your case (MapServer buildkit, right?), I think the linkage is external, so we need to have -ltiff included in the libs as well.  Hopefully, Mateusz can give us the bits of cmake script that would do that.  

Howard



More information about the Liblas-devel mailing list