Thanks Even, that helped track it down. Turns out we were calling GDALAllRegister() before calling CPLSetConfigOption(), I think that was causing the internal CPLFindeInit call, looks fixed now.
Cheers! On Tue, Aug 24, 2021 at 2:26 PM Even Rouault <even.roua...@spatialys.com> wrote: > Christopher, > > CPLFindFile() calls CPLFinderInit() which issues CPLGetConfigOption( > "GDAL_DATA", nullptr). But CPLFinderInit() runs once per-thread. So a > potential theory for what you observe would be that something runs > CPLFindFile() before you call CPLSetConfigOption("GDAL_DATA", ...). Setting > breakpoint on CPLFinderInit and CPLSetConfigOption should confirm if this > is what actually happens > > Even > Le 24/08/2021 à 23:17, Christopher Corbell a écrit : > > I'm tracking down a bug with WFS data import in our app and it seems like > the cause is a call to CPLFindFile returning NULL, looking for a > gmlasconf.xml file that should be in the gdal share directory. > > This is a Mac universal binary app that embeds GDAL as a dylib and also > includes the share files, so we use CPLSetConfigOption("GDAL_DATA", ...) to > configure the CPL. So we don't rely on any absolute install/build paths or > on the end-user installing their own GDAL. This worked previously but we > recently updated to GDAL 3.3.1. > > The WFS import fails when CPLFindFile returns NULL on attempt to read that > config file, but the bug does not occur on my workstation, where this copy > of GDAL was built. It turns out this is because CPLFindFile will return the > original location of the GDAL build/install share directory (which still > exists on my system). > > Can anyone offer a theory why CPLFindFile might ignore the gdal data path > and only look in the absolute install path set when GDAL was built? Here's > some debugger output showing how these functions point to two different > directories at runtime: > > (lldb) po (const char*) CPLGetConfigOption("GDAL_DATA") > "/Users/ccorbell/Development/working/ccorbell_27x_MBP/IP > Source/Plug-ins/Common/Data/GIS/gdal/" > > (lldb) po (const char*) CPLFindFile("gdal", "gmlasconf.xml") > "/Users/ccorbell/Development/working/ccorbell_27x_MBP/AppSource/ThirdPartySource/GDAL/config/gdal-3.3.1-x86_64/share/gdal/gmlasconf.xml" > > > Thanks, > Christopher > > _______________________________________________ > gdal-dev mailing > listgdal-dev@lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/gdal-dev > > -- http://www.spatialys.com > My software is free, but my time generally not. > > _______________________________________________ > 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