<div dir="ltr">Interesting. Thank you for that.<div><br></div><div>Note that it was OpenJPEG that I added fPIC to, not GDAL itself. I am building OpenJPEG with SHARED_LIBS off, as we only need the static version for GDAL. GDAL itself builds default (SHARED_LIBS on) as we need static for our main product build, but also DSOs for the GDAL command-line apps. We don't need to link GDAL statically into any higher-level shared libs, just the main monolithic executable.</div><div><br></div><div>I will certainly change to use the idiomatic option for the OpenJPEG build, though.</div><div><br></div><div>My main concern remains the need to hack the configure script to get the GDAL build to agree that OpenJPEG is usable, but since my hack only affects the configure test and not the actual GDAL build itself, I guess it's fine.</div><div><br></div><div>Perhaps it was just a bug, although it seems unlikely that nobody hit it. I believe the behavior to be fine in CMake-based builds, but obv that's not an option for now on 3.4.1.</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 14, 2023 at 10:25 PM Mateusz Loskot <<a href="mailto:mateusz@loskot.net">mateusz@loskot.net</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">On Wed, 15 Feb 2023 at 01:34, Simon Eves <<a href="mailto:simon.eves@heavy.ai" target="_blank">simon.eves@heavy.ai</a>> wrote:<br>
><br>
> I tried adding  -DCMAKE_CPP_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC" to the OpenJPEG build CMake invocation, but that made no difference.<br>
><br>
<br>
More CMake-idiomatic way is to use -DCMAKE_POSITION_INDEPENDENT_CODE=ON instead.<br>
<br>
It used to be there<br>
<a href="https://github.com/OSGeo/gdal/commit/a0128debca5dd77a64188cc7ac3ba60866a70e89" rel="noreferrer" target="_blank">https://github.com/OSGeo/gdal/commit/a0128debca5dd77a64188cc7ac3ba60866a70e89</a><br>
until <a href="https://github.com/OSGeo/gdal/issues/5649" rel="noreferrer" target="_blank">https://github.com/OSGeo/gdal/issues/5649</a><br>
<br>
and there is GDAL-specific variable now<br>
-DGDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE=ON<br>
<a href="https://github.com/OSGeo/gdal/blob/master/gdal.cmake#L42-L43" rel="noreferrer" target="_blank">https://github.com/OSGeo/gdal/blob/master/gdal.cmake#L42-L43</a><br>
<br>
Best regards,<br>
-- <br>
Mateusz Loskot, <a href="http://mateusz.loskot.net" rel="noreferrer" target="_blank">http://mateusz.loskot.net</a><br>
_______________________________________________<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>