<html><head><style type="text/css">.style1 {font-family: "Times New Roman";}</style></head><body><div dir="ltr">Michael,<div><br></div><div>I noticed you said the following:</div><div><br></div><div>"<span style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px">I am linking statically to GDAL built as a static library with vcpkg (which builds without error)."</span></div><div><span style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px">I may be interpreting this incorrectly, but it sounds like you intend to link the NCSEcw library. However, I believe your </span>ECW_LIBRARY variable references the dynamic NCSEcw.lib import library. If you are trying to link this library statically, I believe you need to use the following library:</div><div><br></div><div>ERDAS_ECW_JPEG_2000_SDK_5.5.0.zip\Desktop_Read-Only\lib\vc141\Win32\NCSEcwS.lib</div><div><br></div><div>or for an x64 build:</div><div><br></div><div>ERDAS_ECW_JPEG_2000_SDK_5.5.0.zip\Desktop_Read-Only\lib\vc141\x64\NCSEcwS.lib</div><div><br></div><div>I apologize if I've misinterpreted you here or if I'm giving you incorrect information (I am somewhat new to this as well).</div><div><br></div><div>As far as linking this library statically, I have not successfully done this when building using vcpkg. I have been able to build with dynamic linking which is okay for our purposes (though not ideal). If you get static linking working, I'd love to hear how you did it. Thank you,</div><div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, Feb 22, 2025 at 2:15 AM Kai Pastor, DG0YT via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<div>IMO you ask for trouble when you
manually inject <span>-DFRMT_mrsid=ON into CFLAGS and CXXFLAGS.
This is CMake input ("ON"!). Let the configuration do that for
you. Did configuration successfully detect the dependency? Check
the config logs.<br>
</span></div>
<div><span><br>
</span></div>
<div><span>Kai<br>
</span></div>
<div><br>
</div>
<div>Am 22.02.25 um 05:15 schrieb Michael
Katz via gdal-dev:<br>
</div>
<blockquote type="cite">
<div>
<div dir="ltr">I am getting the following
link errors when building my application in MSVC++:</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">
<div>
<div>1>gdal.lib(gdalallregister.cpp.obj) : error LNK2019:
unresolved external symbol _GDALRegister_ECW referenced in
function _GDALAllRegister@0</div>
<div>1>gdal.lib(gdalallregister.cpp.obj) : error LNK2019:
unresolved external symbol _GDALRegister_JP2ECW referenced
in function _GDALAllRegister@0</div>
<div>1>gdal.lib(gdalallregister.cpp.obj) : error LNK2019:
unresolved external symbol _GDALRegister_MrSID referenced
in function _GDALAllRegister@0</div>
<div><br>
</div>
</div>
I am linking statically to GDAL built as a static library with
vcpkg (which builds without error). I am using a custom
x86-windows.cmake file with vcpkg, customized mainly to
include MrSID and ECW functionality in GDAL. I have pasted the
cmake text at the bottom of this email.</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">From what I can see in the
GDAL code, it's behaving as if
<div>
<div dir="ltr">gdal/frmts/mrsid/mrsiddataset.cpp
(which contains the function <span><span>GDALRegister_MrSID)</span></span>
wasn't compiled into the library, yet the following code
in <span>frmts/gdalallregister.cpp was compiled.</span></div>
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">
<div>
<div>#ifdef FRMT_mrsid</div>
<div> GDALRegister_MrSID();</div>
<div>#endif</div>
<div><br>
</div>
</div>
<div dir="ltr">Can you help me
understand how this could happen? What actually controls
whether <span>gdal/frmts/mrsid/mrsiddataset.cpp gets
compiled into the library?</span></div>
<br>
</div>
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">---</div>
<div dir="ltr"><span><span>x86-windows.cmake:</span></span><br>
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">
<div>
<div>
<div><span>set</span>(VCPKG_TARGET_ARCHITECTURE x86)</div>
<div><span>set</span>(VCPKG_CRT_LINKAGE static)</div>
<div><span>set</span>(VCPKG_LIBRARY_LINKAGE static)</div>
<div><span>set</span>(VCPKG_BUILD_TYPE release)</div>
<div><span>set</span>(ENV{CMAKE_WINDOWS_KITS_10_DIR} <span>"C:</span><span>\\</span><span>Program
Files (x86)</span><span>\\</span><span>Windows Kits</span><span>\\</span><span>10"</span>)</div>
<div><span>set</span>(VCPKG_CMAKE_CONFIGURE_OPTIONS <span>"-DCMAKE_WINDOWS_KITS_10_DIR=C:</span><span>\\</span><span>Program
Files (x86)</span><span>\\</span><span>Windows Kits</span><span>\\</span><span>10"</span>)</div>
<div><span>set</span>(VCPKG_ENV_PASSTHROUGH
CMAKE_WINDOWS_KITS_10_DIR)</div>
<br>
<div><span># CMAKE_CURRENT_LIST_DIR is the triplets
directory</span></div>
<div><span># such as
C:/Users/michael.katz/Documents/vcpkg/triplets</span></div>
<div><span>message</span>( STATUS <span>"</span><span>\n\n</span><span>-----------------------CMAKE_CURRENT_LIST_DIR
= ${CMAKE_CURRENT_LIST_DIR}</span><span>\n\n</span><span>"</span>
)</div>
<br>
<div><span>if</span> (PORT <span>MATCHES</span> <span>"gdal"</span>)</div>
<div><span> string</span>(</div>
<div> CONCAT x</div>
<div> <span>" </span><span>\"</span><span>-DMRSID_INCLUDE_DIR=${CMAKE_CURRENT_LIST_DIR}/../sdk/MrSID_DSDK-9.5.5.5244-win32-vc17/Raster_DSDK/include</span><span>\"</span><span>"</span></div>
<div> <span>" </span><span>\"</span><span>-DMRSID_LIBRARY=${CMAKE_CURRENT_LIST_DIR}/../sdk/MrSID_DSDK-9.5.5.5244-win32-vc17/Raster_DSDK/lib/lti_dsdk.lib</span><span>\"</span><span>"</span></div>
<div> <span>" </span><span>\"</span><span>-DGDAL_USE_MRSID=ON</span><span>\"</span><span>"</span></div>
<div> <span>" </span><span>\"</span><span>-DFRMT_mrsid=ON</span><span>\"</span><span>"</span></div>
<div> <span>" </span><span>\"</span><span>-DECW_INCLUDE_DIR=${CMAKE_CURRENT_LIST_DIR}/../sdk/ecw/Hexagon/ERDAS_ECW_JPEG_2000_SDK_5.5.0/Desktop_Read-Only/include</span><span>\"</span><span>"</span></div>
<div> <span>" </span><span>\"</span><span>-DECW_LIBRARY=${CMAKE_CURRENT_LIST_DIR}/../sdk/ecw/Hexagon/ERDAS_ECW_JPEG_2000_SDK_5.5.0/Desktop_Read-Only/lib/vc141/Win32/NCSEcw.lib</span><span>\"</span><span>"</span></div>
<div> <span>" </span><span>\"</span><span>-DGDAL_USE_ECW=ON</span><span>\"</span><span>"</span></div>
<div> <span>" </span><span>\"</span><span>-DFRMT_ecw=ON</span><span>\"</span><span>"</span></div>
<div> )</div>
<div><span> set</span>(VCPKG_CMAKE_CONFIGURE_OPTIONS <span>"${VCPKG_CMAKE_CONFIGURE_OPTIONS}
${x}"</span> )</div>
<div><span> set</span>(VCPKG_CXX_FLAGS <span>"${VCPKG_CXX_FLAGS}
-DFRMT_mrsid=ON"</span>)</div>
<div><span> set</span>(VCPKG_C_FLAGS <span>"${VCPKG_C_FLAGS}
-DFRMT_mrsid=ON"</span>)</div>
<div><span> set</span>(VCPKG_CXX_FLAGS <span>"${VCPKG_CXX_FLAGS}
-DFRMT_ecw=ON"</span>)</div>
<div><span> set</span>(VCPKG_C_FLAGS <span>"${VCPKG_C_FLAGS}
-DFRMT_ecw=ON"</span>)</div>
<div><span>endif</span>()</div>
<br>
<div><span>message</span>( STATUS <span>"</span><span>\n\n</span><span>-----------------------VCPKG_CMAKE_CONFIGURE_OPTIONS
= ${VCPKG_CMAKE_CONFIGURE_OPTIONS}</span><span>\n\n</span><span>"</span>
)</div>
<br>
<div><span>message</span>( STATUS <span>"</span><span>\n\n</span><span>-----------------------FEATURES
= ${FEATURES}</span><span>\n\n</span><span>"</span> )</div>
<br>
</div>
</div>
<br>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<p><br>
</p>
</div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">David Klaus<div>Carlson Software</div></div></div>
<br><br><p style="font-family: Verdana; font-size:10pt; color:#777777;"><b>Disclaimer</b></p><p style="font-family: Verdana; font-size:8pt; color:#777777;">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.</p></body></html>