<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 04/10/2024 à 18:06, Andrew Plowright
      a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOHs3k1bY1bcHHtAJo9RWEAMUihymSNFFSLOS9jRjJKShLQ_Uw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>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. <br>
        </div>
        <div><br>
        </div>
        <div>Even: can I confirm that, in the third option you suggested
          (the "less ugly alternative"), this would involve:</div>
        <div><br>
        </div>
        <div>1. Installing QGIS using Software Manager (or any other
          way, just not necessarily building it from source)</div>
        <div>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.<br>
        </div>
        <div>3. This second instance of GDAL is given its own secluded
          /opt/gdal_3_8_4 folder to keep it separate from /usr</div>
        <div>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?</div>
        <div><br>
        </div>
        <div>Did I get all that correct?<br>
        </div>
      </div>
    </blockquote>
    yes<br>
    <blockquote type="cite"
cite="mid:CAOHs3k1bY1bcHHtAJo9RWEAMUihymSNFFSLOS9jRjJKShLQ_Uw@mail.gmail.com"><br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sat, Sep 28, 2024 at
          10:33 AM Even Rouault <<a
            href="mailto:even.rouault@spatialys.com"
            moz-do-not-send="true" class="moz-txt-link-freetext">even.rouault@spatialys.com</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">
          <div>
            <p>Andrew,<br>
            </p>
            <br>
            <blockquote type="cite">
              <div dir="ltr">
                <div>
                  <div>
                    <div>
                      <div>
                        <div style="margin-left:40px">$ ldd
                          /bin/qgis.bin | grep gdal<br>
                        </div>
                      </div>
                      <div><br>
                        <div style="margin-left:40px">libgdal.so.34
                          => /lib/x86_64-linux-gnu/libgdal.so.34
                          (0x00007a0581a00000)<br>
                        </div>
                        <br>
                      </div>
                      But I'm not sure what to do with that information.<br>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
            <p> /lib/x86_64-linux-gnu/libgdal.so.34 is the version of
              GDAL that comes with package manager, so 3.8.4 here</p>
            <p>I'm not sure how you are familiar with the dynamic
              linking concepts and tools, but if you're not, reading
              <a
href="https://opensource.com/article/22/5/dynamic-linking-modular-libraries-linux"
                target="_blank" moz-do-not-send="true"
                class="moz-txt-link-freetext">https://opensource.com/article/22/5/dynamic-linking-modular-libraries-linux</a>
              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</p>
            <p>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:<br>
            </p>
            <p>sudo ln -s /usr/lib/libgdal.so.35 /usr/lib/libgdal.so.34 
                    # i'm already hating myself</p>
            <p>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... <br>
            </p>
            <p>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...</p>
            <p>OK, I believe you've been sufficienly warned this is
              *not* the normal way of proceeding, just a quick&dirty
              workaround<br>
            </p>
            <p>To undo the above mess:</p>
            <p>sudo mv /lib/x86_64-linux-gnu/libgdal.so.34.disabled
              /lib/x86_64-linux-gnu/libgdal.so.34</p>
            <p>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 ...)<br>
            </p>
            <p>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.</p>
            <p><br>
            </p>
            <p>Another less ugly alternative would be that you download
              <a
href="http://download.osgeo.org/gdal/3.8.4/gdal-3.8.4.tar.gz"
                target="_blank" moz-do-not-send="true"
                class="moz-txt-link-freetext">http://download.osgeo.org/gdal/3.8.4/gdal-3.8.4.tar.gz</a>,
              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.</p>
            <p>Actually that might not be terribly harder to do than my
              above hacks, so I'm definitely encouraging you to explore
              that way</p>
            <p>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...</p>
            <p>/me taking a passport to an undisclosed country without
              extradition <span lang="en"><span><span>agreement.</span></span></span></p>
            Even
            <pre cols="72">-- 
<a href="http://www.spatialys.com" target="_blank"
            moz-do-not-send="true" class="moz-txt-link-freetext">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>