Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 752399 - sci-libs/gdal-3.0.4-r1[java] needs to install libgdalalljni.so
Summary: sci-libs/gdal-3.0.4-r1[java] needs to install libgdalalljni.so
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sci-geo Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-03 00:30 UTC by Khumba
Modified: 2020-11-05 03:20 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.txt,6.54 KB, text/plain)
2020-11-03 00:30 UTC, Khumba
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Khumba 2020-11-03 00:30:33 UTC
GDAL uses SWIG to generate its Java bindings, and there are two parts outputs from this: gdal.jar, and the native libgdalalljni.so that the JAR references.  The ebuild installs gdal.jar but not the .so, and trying to run a Java project that uses GDAL results in:

    Native library load failed.
    java.lang.UnsatisfiedLinkError: no gdalalljni in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]

I think this is a simple oversight.  These files exist in the work directory:

# (cd /var/tmp/portage/sci-libs/gdal-3.0.4-r1 && ls -l $(find -iname '*gdalalljni*'))
-rw-r--r-- 1 portage portage   1693 Nov  2 15:21 ./work/gdal-3.0.4/swig/java/libgdalalljni.la
-rwxr-xr-x 1 portage portage 686328 Nov  2 15:21 ./work/gdal-3.0.4/swig/java/libgdalalljni.so
lrwxrwxrwx 1 portage portage     19 Nov  2 15:21 ./work/gdal-3.0.4/swig/java/.libs/libgdalalljni.la -> ../libgdalalljni.la
-rw-r--r-- 1 portage portage   1188 Nov  2 15:21 ./work/gdal-3.0.4/swig/java/.libs/libgdalalljni.lai
lrwxrwxrwx 1 portage portage     23 Nov  2 15:21 ./work/gdal-3.0.4/swig/java/.libs/libgdalalljni.so -> libgdalalljni.so.26.0.4
lrwxrwxrwx 1 portage portage     23 Nov  2 15:21 ./work/gdal-3.0.4/swig/java/.libs/libgdalalljni.so.26 -> libgdalalljni.so.26.0.4
-rwxr-xr-x 1 portage portage 686328 Nov  2 15:21 ./work/gdal-3.0.4/swig/java/.libs/libgdalalljni.so.26.0.4

I can confirm that adding

    dolib.so "${S}"/swig/java/.libs/libgdalalljni.so{,.26,.26.0.4}

into the "use java" conditional in src_install fixes the problem and lets Java load gdal.jar successfully.  (The .../java/libgdalalljni.so file is just a copy of the .so in .libs, this can be seen in the build log.)
Comment 1 Khumba 2020-11-03 00:30:46 UTC
Created attachment 669809 [details]
emerge --info
Comment 2 Khumba 2020-11-05 03:20:05 UTC
Also, a heads up that if GDAL is built with USE=-threads and used from Java, it issues this warning:

WARNING: GDAL should be compiled with thread support for safe execution in Java.

Rebuilding with USE=threads fixes it.  I'm not sure if this warrants a REQUIRED_USE entry or if this should be left as a soft warning.  There's an FAQ item relating to GDAL thread-safety:

https://trac.osgeo.org/gdal/wiki/FAQMiscellaneous#IstheGDALlibrarythread-safe