<div dir="ltr"><div>I finally solved this, I have added some notes inline to my original post to explain how and some misconceptions I had that have now been cleaned up. Although I now have a working solution, I would be interested in understanding cleaner approaches, if there are any (e.g. ways to rebuild the debian package).<br><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 6, 2020 at 11:55 AM Jon Seymour <<a href="mailto:jon@upowr.com.au">jon@upowr.com.au</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 dir="ltr">Hello all,<div><br></div><div>I have been using gdal-2.4.0 on debian buster for some time now. I ran across an issue with the vsis3 driver and its interplay with the vrt driver (AWS container credentials were expiring after 6 hours). This issue is fixed in 2.4.2 so I wanted to upgrade my system to gdal-2.4.2 so I could take advantage of the fix.<br><br>What I am looking for is a sketch of the most correct and efficient way for me to do this. </div><div><br></div><div>What I have tried is the following:</div><div><br></div><div>I downloaded 2.4.2 from source and rebuilt it with the --with-python=/usr/bin/python3 configuration option </div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>This resulted in an installation in /usr/local. I noticed that another dependency (the .deb package python-opencv) installs gdal-2.4.0 in /usr/lib. I updated the symbolic link in /usr/lib to refer to the version of libgdal.so.20 in /usr/local/lib and this worked for gdalinfo, it didn't work for my larger program:<br><br></div></div></blockquote><div> </div><div>In the end, for the functionality I wanted, I needed to install libcurl4-openssl-dev libproj-dev into my build environment, and then run ./configure with --prefix=/usr --with-python=/usr/bin/python3<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 dir="ltr"><div>ERROR 6: Unable to load PROJ.4 library (libproj.so), creation of OGRCoordinateTransformation failed.<br></div></div></blockquote><div><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 dir="ltr"><div><br>Presumably this resulted from having a mix of 2.4.0 and 2.4.2 artefacts in the same path.<br><br></div></div></blockquote><div><br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div></div></blockquote><div>This problem was actually caused by not installing libproj-dev prior to the gdal build.<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 dir="ltr"><div></div></div></blockquote> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I am now in the process of rebuilding the source with a prefix of /usr so that I can at least replace the /usr version of the binary with my locally built versions, but I don't know yet if that will work better.<br><br>I also experimented with rebuilding the 2.4.2 .deb package from the 2.4.2 tag of  <a href="https://salsa.debian.org/debian-gis-team/gdal" target="_blank">https://salsa.debian.org/debian-gis-team/gdal</a> but ran into problems with an unresolved dependency (libodgi) which I wasn't able to resolve trivially so I abandoned that attempt.<br><br></div></div></blockquote><div><br>I didn't try this, but I wondered later if I should have considered adding the debian experimental repo to the build image in order to resolve the libogdi-dev dependency.<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 dir="ltr"><div>What is the best way for me to upgrade gdal from 2.4.0 to 2.4.2 on a debian buster system?<br><br></div></div></blockquote><div><br>Ultimately, I built gdal-2.4.2 with this Dockerfile:<br><br>ARG BASE_IMAGE=debian:buster<br>FROM ${BASE_IMAGE}<br>ARG GDAL_VERSION=2.4.2<br>ENV GDAL_VERSION=${GDAL_VERSION}<br>RUN apt-get update && apt-get install -y \<br>                wget \<br>                build-essential \<br>                cmake \<br>                cython3 \<br>                libavcodec-dev \<br>                libavdevice-dev \<br>                libavfilter-dev \<br>                libavformat-dev \<br>                libblosc-dev \<br>                libbz2-dev \<br>                libjpeg62-turbo-dev \<br>                libjxr-dev \<br>                liblcms2-dev \<br>                liblz4-dev \<br>                liblzma-dev \<br>                libpng-dev \<br>                libswscale-dev \<br>                libtiff-dev \<br>                libwebp-dev \<br>                libz-dev \<br>                pkg-config \<br>                python-opencv \<br>                python3 \<br>                python3-dev \<br>                python3-numpy \<br>                python3-pip \<br>                python3-pip \<br>                python3-pytest \<br>                python3-pytest-cov \<br>                python3-setuptools \<br>                python3-virtualenv \<br>                python3-wheel \<br>                libcurl4-openssl-dev \<br>                libjpeg-dev \<br>                libopenjp2-7-dev \<br>                libproj-dev \<br>                libzstd-dev<br>RUN mkdir -p /usr/src && \<br>        cd /usr/src && \<br>        wget <a href="https://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz">https://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz</a> && \<br>        tar xzf gdal-${GDAL_VERSION}.tar.gz && \<br>        cd gdal-${GDAL_VERSION} && \<br>        ./configure --prefix=/usr --with-python=/usr/bin/python3 && \<br>        make && \<br>        make install<br>RUN pip3 install cython jupyter GDAL==${GDAL_VERSION}<br> <br>Feel free to let me know if there is a better way to skin this cat. <br><br></div><div>jon.</div></div></div>