Interesting. Thank you for that.

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.

I will certainly change to use the idiomatic option for the OpenJPEG build,
though.

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.

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.




On Tue, Feb 14, 2023 at 10:25 PM Mateusz Loskot <mate...@loskot.net> wrote:

> On Wed, 15 Feb 2023 at 01:34, Simon Eves <simon.e...@heavy.ai> wrote:
> >
> > I tried adding  -DCMAKE_CPP_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC" to
> the OpenJPEG build CMake invocation, but that made no difference.
> >
>
> More CMake-idiomatic way is to use -DCMAKE_POSITION_INDEPENDENT_CODE=ON
> instead.
>
> It used to be there
>
> https://github.com/OSGeo/gdal/commit/a0128debca5dd77a64188cc7ac3ba60866a70e89
> until https://github.com/OSGeo/gdal/issues/5649
>
> and there is GDAL-specific variable now
> -DGDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE=ON
> https://github.com/OSGeo/gdal/blob/master/gdal.cmake#L42-L43
>
> Best regards,
> --
> Mateusz Loskot, http://mateusz.loskot.net
> _______________________________________________
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to