[gdal-dev] ESRI Shapefile API missing

Even Rouault even.rouault at spatialys.com
Wed Jun 21 01:34:51 PDT 2023


Derek,

This is intended. GDAL build shouldn't leak/expose internal 
implementation details such as its embedded shapelib copy, which doesn't 
belong to the GDAL API. Either you use the OGR Shapefile driver through 
OGR API, or you link against external shapelib if you want to use 
shapelib directly

Note that https://github.com/OSGeo/gdal/pull/7973 is pending to fix the 
isolation of the embedded shapelib copy

Even

Le 21/06/2023 à 03:01, Derek Newhall a écrit :
> Hi all,
>
> We've just migrated from GDAL 3.5.1 to 3.7.0 which we build with 
> (almost) all external dependencies as static libraries. However, we've 
> noticed that when we try to compile our app against the resulting 
> library the ESRI Shapefile API isn't available.
>
> Severity Code Description
> Error LNK2001 unresolved external symbol DBFClose
> Error LNK2001 unresolved external symbol SHPOpen
> <snip>
> Error LNK2001 unresolved external symbol SHPCreateObject
> Error LNK2001 unresolved external symbol SHPClose
>
> Looking at the .libs' symbols:
>
> DUMPBIN /linkermember D:\gdal-3.5.1\build\gdal_i.lib | sls DBF
>
>    1ED958 DBFOpen
>    1ED958 __imp_DBFOpen
>    1ED9BC DBFOpenLL
>    1ED9BC __imp_DBFOpenLL
>    1ED3D0 DBFCreate
>    1ED3D0 __imp_DBFCreate
>    1ED436 DBFCreateEx
>    1ED436 __imp_DBFCreateEx
> <snip 50+ lines>
>      1257 __imp_DBFWriteNULLAttribute
>      1256 __imp_DBFWriteStringAttribute
>      125B __imp_DBFWriteTuple
>
> DUMPBIN /linkermember D:\gdal-3.7.0\build\gdal.lib | sls DBF
>
>       DBF OSRGetAxesCount
>       DBF __imp_OSRGetAxesCount
>
> We build the DLL and apps with the following command in a .bat script 
> (all library paths are valid and it compiles):
>
> cmake -G "Visual Studio 16 2019" -DBUILD_APPS=ON -DBUILD_SHARED_LIBS=ON ^
> -DCMAKE_BUILD_TYPE=RelWithDebInfo 
> -DCMAKE_PREFIX_PATH=D:\gdal-3.7.0-build ^
> -DCMAKE_CXX_FLAGS="-DCURL_STATICLIB -DXML_STATIC" 
> -DGDAL_USE_EXTERNAL_LIBS=OFF ^
> -DOGR_BUILD_OPTIONAL_DRIVERS=ON ^
> -DPROJ_INCLUDE_DIR="%~dp0proj-6.3.1\src" ^
> -DPROJ_LIBRARY_RELEASE="%~dp0proj-6.3.1\build_VS2017_x64\lib\RelWithDebInfo\proj.lib" 
> ^
> -DGDAL_USE_CURL=ON -DCURL_INCLUDE_DIR="%~dp0libcurl\include" 
> -DCURL_LIBRARY_RELEASE="%~dp0libcurl\lib\libcurl.lib" ^
> -DGDAL_USE_ECW=ON -DECW_INCLUDE_DIR="%~dp0ERDAS ECW JPEG 2000 SDK 
> 5.5.0\Desktop Read-Only\include" -DECW_LIBRARY="%~dp0ERDAS ECW JPEG 
> 2000 SDK 5.5.0\Desktop Read-Only\lib\vc141\x64\NCSEcw.lib" ^
> -DGDAL_USE_ODBC=ON ^
> -DGDAL_USE_OPENSSL=ON -DOPENSSL_ROOT_DIR="%~dp0openssl-1.1.0f-vs2017" 
> -DOPENSSL_USE_STATIC_LIBS=TRUE -DOPENSSL_MSVC_STATIC_RT=TRUE ^
> -DGDAL_ENABLE_DRIVER_PDF_PLUGIN=ON ^
> -DGDAL_USE_PDFIUM=ON 
> -DPDFIUM_INCLUDE_DIR="%~dp0ExtractPDFium\install\include\pdfium" 
>  -DPDFIUM_LIBRARY="%~dp0ExtractPDFium\install\lib\pdfium.lib" ^
> -DGDAL_USE_SQLITE3=ON 
> -DSQLite3_INCLUDE_DIR="%~dp0sqlite-amalgamation-3370200" 
>  -DSQLite3_LIBRARY="%~dp0sqlite-amalgamation-3370200\sqlite3.lib" ^
> -DGDAL_USE_XERCESC=ON -DXercesC_INCLUDE_DIR="%~dp0xerces-c-3.2.4\src" 
> -DXercesC_LIBRARY="%~dp0xerces-c-3.2.4\build\src\Release\xerces-c_3.lib" ^
> -DGDAL_USE_EXPAT=ON -DEXPAT_INCLUDE_DIR="%~dp0Expat\lib" 
> -DEXPAT_LIBRARY="%~dp0Expat\RelWithDebInfo\libexpat.lib" ^
> ..
>
> The build documentation at 
> https://gdal.org/development/building_from_source.html says the ESRI 
> Shapefile API cannot be disabled, so I'm wondering what's going on.  
> Is this a bug, or did we just misconfigure something? This is our 
> first time semi-successfully building with the new CMake system.
>
> Derek Newhall
>
>
> *Disclaimer*
>
> The information contained in this communication from the sender is 
> confidential. It is intended solely for use by the recipient and 
> others authorized to receive it. If you are not the recipient, you are 
> hereby notified that any disclosure, copying, distribution or taking 
> action in relation of the contents of this information is strictly 
> prohibited and may be unlawful.
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230621/f9a6b07c/attachment.htm>


More information about the gdal-dev mailing list