[bug#76736] gnu: gdal: Update to 3.10.2 and fix rpaths.

Message ID fffb140b1a12f443b6766cd5dbdd22e4cdfc77b8.1741072961.git.lars.bilke@ufz.de
State New
Headers
Series [bug#76736] gnu: gdal: Update to 3.10.2 and fix rpaths. |

Commit Message

Lars Bilke March 4, 2025, 7:22 a.m. UTC
  * gnu/packages/geo.scm (gdal): Update to 3.10.2.
* gnu/packages/geo.scm (gdal): Add fix-rpath phase from https://issues.guix.gnu.org/68606

Change-Id: I973e04af737d757329adfbfa37d255386143a21c
---
 gnu/packages/geo.scm | 124 ++++++++++++++++++++++++-------------------
 1 file changed, 68 insertions(+), 56 deletions(-)


base-commit: f203028ef869945b3d44f0f2f7b16d61d064190c
  

Comments

Sharlatan Hellseher March 5, 2025, 8:21 p.m. UTC | #1
Hi Lars,

Thank you for the patch!

Gdal is currently fails to build on master but after this patch is applied
I could build it.

There are some review points if you can cover to make it ready for apply.

- I see you keep "frmts/zlib" in snippet, may you describe the reason
please?

- Please organize your commit message with more details in style like,
look for example in currently applied commits:
--8<---------------cut here---------------start------------->8---
* <path> (<package-name>): <short summury of changes>.
[field] <sub-field>: Describe change
--8<---------------cut here---------------end--------------->8---

e.g.
--8<---------------cut here---------------start------------->8---
* gnu/packages/geo.scm (gdal): Update to 3.10.2. Use G-Expressions.
[source]: Snippet, do not remove "frmts/zlib" (why?)
[arguments] <phases>: Add 'fix-rpath.
--8<---------------cut here---------------end--------------->8---

- You may preserve the [inputs], [native-inputs] and [propagated-inputs]
indentations.

- You may simplify this:
--8<---------------cut here---------------start------------->8---
+              (let ((libdir (string-append (assoc-ref outputs "out") "/lib")))
--8<---------------cut here---------------end--------------->8---
to this
--8<---------------cut here---------------start------------->8---
+              (let ((libdir (string-append #$output "/lib")))
--8<---------------cut here---------------end--------------->8---

Looking forward for v2!

---
Oleg
  
Sharlatan Hellseher March 6, 2025, 2:28 p.m. UTC | #2
Hi,

It looks like Ricardo has pushed update alread in
f2229c2afdb32ddba46bce6f37aba812af39eec5 commit.

CC him, if we need to act on this issue as it's updating to 3.10.2.

--8<---------------cut here---------------start------------->8---
gnu: gdal: Update to 3.8.2.HEAD master
* gnu/packages/geo.scm (gdal): Update to 3.8.2.
[source]: Adjust snippet to retain infback9.
[arguments]: Add phase 'swap-files to install files with modified RPATH.
[inputs]: Add shapelib.

Change-Id: Ia2b13a2da5e951d9d5a70f81b3aa0f099556929b
--8<---------------cut here---------------end--------------->8---

--
Oleg
  
Ricardo Wurmus March 6, 2025, 2:57 p.m. UTC | #3
Sharlatan Hellseher <sharlatanus@gmail.com> writes:

> It looks like Ricardo has pushed update alread in
> f2229c2afdb32ddba46bce6f37aba812af39eec5 commit.

Oh, I'm sorry I missed this.

I only updated to 3.8.2 because I didn't want to risk breaking too 
many
dependents.  My goal was to fix python-geopandas ASAP when I 
attempted
to fix this at the same time as Lars sent the patch.

The 'fix-rpath phase is unnecessary, because gdal's build system 
already
takes care of building files with the correct RPATH --- they just 
don't
get installed for unknown reasons.

Lars, ff the dependents of gdal build fine after the upgrade to 
3.10.2
I'd be happy to push an edited version of this patch.
  
Lars Bilke March 7, 2025, 12:22 p.m. UTC | #4
Hi Ricardo,

ah thanks for 3.8.2 patch! That's all I need (I also wanted python-geopandas), so this issue can be closed (I do not know how to do that).

Thanks!
Lars

On 6 Mar 2025, at 15:57, Ricardo Wurmus wrote:

> Sharlatan Hellseher <sharlatanus@gmail.com> writes:
>
>> It looks like Ricardo has pushed update alread in
>> f2229c2afdb32ddba46bce6f37aba812af39eec5 commit.
>
> Oh, I'm sorry I missed this.
>
> I only updated to 3.8.2 because I didn't want to risk breaking too many
> dependents.  My goal was to fix python-geopandas ASAP when I attempted
> to fix this at the same time as Lars sent the patch.
>
> The 'fix-rpath phase is unnecessary, because gdal's build system already
> takes care of building files with the correct RPATH --- they just don't
> get installed for unknown reasons.
>
> Lars, ff the dependents of gdal build fine after the upgrade to 3.10.2
> I'd be happy to push an edited version of this patch.
>
> -- 
> Ricardo
  
Sharlatan Hellseher March 7, 2025, 8:50 p.m. UTC | #5
Hi,

I've checked issues for the same reason python-geopandas was broken for
me.

Closing as no longer required.

--
Oleg
  

Patch

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 251ef5ced9..943de4586f 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -1408,68 +1408,80 @@  (define-public pdal
 (define-public gdal
   (package
     (name "gdal")
-    (version "3.6.1")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                     "http://download.osgeo.org/gdal/" version "/gdal-"
-                     version ".tar.gz"))
-              (sha256
-               (base32
-                "1qckwnygszxkkq40bf87s3m1sab6jj9jyakdvskh0qf7dq8zjarf"))
-              (modules '((guix build utils)))
-              (snippet
-                `(begin
+    (version "3.10.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://download.osgeo.org/gdal/" version "/gdal-"
+                           version ".tar.gz"))
+       (sha256
+        (base32 "1nmh92vbcrp9qnld98vkxsvaw0mrska06kxxbn7n6kgbh6mhlwfa"))
+       (modules '((guix build utils)))
+       (snippet `(begin
                    ;; TODO: frmts contains a lot more bundled code.
                    (for-each delete-file-recursively
-                     ;; bundled code
-                     '("frmts/png/libpng"
-                       "frmts/gif/giflib"
-                       "frmts/jpeg/libjpeg"
-                       "frmts/jpeg/libjpeg12"
-                       "frmts/gtiff/libtiff"
-                       "frmts/gtiff/libgeotiff"
-                       "frmts/zlib"
-                       "ogr/ogrsf_frmts/geojson/libjson"))))))
+                             ;; bundled code
+                             '("frmts/png/libpng" "frmts/gif/giflib"
+                               "frmts/jpeg/libjpeg"
+                               "frmts/jpeg/libjpeg12"
+                               "frmts/gtiff/libtiff"
+                               "frmts/gtiff/libgeotiff"
+                               "ogr/ogrsf_frmts/geojson/libjson"))))))
     (build-system cmake-build-system)
     (arguments
-     `(#:tests? #f
-       #:configure-flags
-       (list "-DGDAL_USE_INTERNAL_LIBS=WHEN_NO_EXTERNAL"
-             "-DGDAL_USE_JPEG12_INTERNAL=OFF")))
-    (inputs
-     (list curl
-           expat
-           freexl
-           geos
-           giflib
-           json-c
-           libgeotiff
-           libjpeg-turbo
-           libjxl
-           libpng
-           libtiff
-           libwebp
-           lz4
-           netcdf
-           openssl
-           openjpeg
-           pcre2
-           postgresql ; libpq
-           proj
-           qhull
-           sqlite
-           swig
-           zlib
-           zstd))
-    (native-inputs
-     (list pkg-config
-           python))
-    (propagated-inputs
-     (list python-numpy))
+     (list
+      #:tests? #f
+      #:configure-flags
+      #~(list "-DGDAL_USE_INTERNAL_LIBS=WHEN_NO_EXTERNAL"
+              "-DGDAL_USE_JPEG12_INTERNAL=OFF")
+      #:modules '((guix build cmake-build-system)
+                  (guix build utils)
+                  (ice-9 rdelim)
+                  (ice-9 popen))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'fix-rpath
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((libdir (string-append (assoc-ref outputs "out") "/lib")))
+                (for-each (lambda (file)
+                            (let* ((pipe (open-pipe* OPEN_READ "patchelf"
+                                                     "--print-rpath" file))
+                                   (line (read-line pipe)))
+                              (and (zero? (close-pipe pipe))
+                                   (invoke "patchelf" "--set-rpath"
+                                           (string-append libdir ":" line)
+                                           file))))
+                          (find-files libdir ".*\\.so$"))))))))
+    (inputs (list curl
+                  expat
+                  freexl
+                  geos
+                  giflib
+                  json-c
+                  libgeotiff
+                  libjpeg-turbo
+                  libjxl
+                  libpng
+                  libtiff
+                  libwebp
+                  lz4
+                  netcdf
+                  openssl
+                  openjpeg
+                  pcre2
+                  postgresql ;libpq
+                  proj
+                  qhull
+                  sqlite
+                  swig
+                  zlib
+                  zstd))
+    (native-inputs (list patchelf pkg-config python))
+    (propagated-inputs (list python-numpy))
     (home-page "https://gdal.org/")
     (synopsis "Raster and vector geospatial data format library")
-    (description "GDAL is a translator library for raster and vector geospatial
+    (description
+     "GDAL is a translator library for raster and vector geospatial
 data formats.  As a library, it presents a single raster abstract data model
 and single vector abstract data model to the calling application for all
 supported formats.  It also comes with a variety of useful command line