[Qgis-user] Unable to open MrSID file in QGIS even if gdalinfo can read it
Andrew Plowright
plowright.andrew at gmail.com
Fri Oct 4 09:06:43 PDT 2024
Thanks again Even and Fernando, you've both provided a lot of helpful
information that has turned this into a very instructive Linux learning
opportunity.
Even: can I confirm that, in the third option you suggested (the "less ugly
alternative"), this would involve:
1. Installing QGIS using Software Manager (or any other way, just not
necessarily building it from source)
2. Building a second instance of GDAL from source which has the same
version as whatevever GDAL version is created by the QGIS installation
(ex.: 3.8.4) and which is built with the Mr Sid driver.
3. This second instance of GDAL is given its own secluded /opt/gdal_3_8_4
folder to keep it separate from /usr
4. Setting GDAL_DRIVER_PATH will make GDAL search
/opt/gdal_3_8_4/lib/gdalplugins for additional plugins, such as the MrSid
driver. This should affect any instance of GDAL, whether I'm running it
through QGIS or through the command line?
Did I get all that correct?
On Sat, Sep 28, 2024 at 10:33 AM Even Rouault <even.rouault at spatialys.com>
wrote:
> Andrew,
>
> $ ldd /bin/qgis.bin | grep gdal
>
> libgdal.so.34 => /lib/x86_64-linux-gnu/libgdal.so.34 (0x00007a0581a00000)
>
> But I'm not sure what to do with that information.
>
> /lib/x86_64-linux-gnu/libgdal.so.34 is the version of GDAL that comes with
> package manager, so 3.8.4 here
>
> I'm not sure how you are familiar with the dynamic linking concepts and
> tools, but if you're not, reading
> https://opensource.com/article/22/5/dynamic-linking-modular-libraries-linux
> or related resources on dynamic linking might help you understand why those
> seemlingly "weird" behaviors are totally explainable. Takes time, and even
> with experience, mixing up several versions of a library on a system and
> being confused is not uncommon
>
> I'm going to hate myself for the below suggestion, and you probably too
> when it will hit you back in the face (so forget I've told you about it
> ;-), ... but ... to quickly workaround your issue, you can do:
>
> sudo ln -s /usr/lib/libgdal.so.35 /usr/lib/libgdal.so.34 # i'm
> already hating myself
>
> sudo mv /lib/x86_64-linux-gnu/libgdal.so.34
> /lib/x86_64-linux-gnu/libgdal.so.34.disabled # I'm hating myself even
> more...
>
> And now launch QGIS.... As GDAL keeps a backwards compatible C ABI, this
> ugly substitution of the expected GDAL 3.8.4 version at build time is
> supposed to (mostly) work. That said, you might run in occasional bugs,
> where QGIS tries to workaround GDAL specific bug, based on the version of
> GDAL QGIS was built against...
>
> OK, I believe you've been sufficienly warned this is *not* the normal way
> of proceeding, just a quick&dirty workaround
>
> To undo the above mess:
>
> sudo mv /lib/x86_64-linux-gnu/libgdal.so.34.disabled
> /lib/x86_64-linux-gnu/libgdal.so.34
>
> sudo mv /usr/lib/libgdal.so.34 /usr/lib/libgdal.so.34.disabled (i'm
> always nervous doing a rm in /usr territory, so I tend to just rename ...)
>
> The clean solution would be that you rebuild QGIS against your installed
> GDAL, but that would be for another episode. Another friendly advice would
> be that when doing a custom build you don't do CMAKE_INSTALL_PREFIX=/opt ,
> but here something like CMAKE_INSTALL_PREFIX=/opt/gdal_3_10_master to avoid
> messing with /usr which should be only the territory of your package
> manager tool.
>
>
> Another less ugly alternative would be that you download
> http://download.osgeo.org/gdal/3.8.4/gdal-3.8.4.tar.gz, build it with
> support of the MrSID driver as a plugin, with
> -DGDAL_ENABLE_DRIVER_MRSID_PLUGIN=ON, install it in /opt/gdal_3_8_4, and
> then just set the GDAL_DRIVER_PATH=/opt/gdal_3_8_4/lib/gdalplugins
> environment variable. That way you would use the system GDAL library with
> just the addition of the MrSID driver.
>
> Actually that might not be terribly harder to do than my above hacks, so
> I'm definitely encouraging you to explore that way
>
> And ... you should know that the company behind the MrSID SDK has declared
> they won't ever release any new binary version of it. This means that at
> most in a few years, this SDK will likely be totally unusable on modern
> systems. So everyone using SID files had better convert them to something
> else, like COG, when they still have a chance...
>
> /me taking a passport to an undisclosed country without extradition
> agreement.
> Even
>
> -- 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/qgis-user/attachments/20241004/a8a6f130/attachment.htm>
More information about the QGIS-User
mailing list