Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open JPEG compressed GeoTiff in Ubuntu 22.04 #444

Open
frapa opened this issue Sep 30, 2023 · 4 comments
Open

Unable to open JPEG compressed GeoTiff in Ubuntu 22.04 #444

frapa opened this issue Sep 30, 2023 · 4 comments

Comments

@frapa
Copy link

frapa commented Sep 30, 2023

Hi,

I have written a program that uses the gdal crate to read some parts of a GeoTiff file. The file is RGB data and uses JPEG compression. With any other compressions (I tested none and LZW) everything works as expected, but with JPEG on Ubuntu 22.04 the program fails to load the libjpeg shared lib:

ERROR 1: JPEGLib:Wrong JPEG library version: library is 62, caller expects 80
tif_jpeg.c:1021: JPEGSetupDecode: Assertion `sp->cinfo.comm.is_decompressor' failed.

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

Note that my installed version of libjpeg is 8, I do not have version 6.2 on the system:

$ apt list --installed | grep jpeg
libjpeg-turbo8-dbg/jammy,now 2.1.2-0ubuntu1 amd64 [installed,automatic]
libjpeg-turbo8-dev/jammy,now 2.1.2-0ubuntu1 amd64 [installed]
libjpeg-turbo8/jammy,now 2.1.2-0ubuntu1 amd64 [installed,automatic]
libjpeg-turbo8/jammy,now 2.1.2-0ubuntu1 i386 [installed,automatic]
libjpeg8-dbg/jammy,now 8c-2ubuntu10 amd64 [installed]
libjpeg8-dev/jammy,now 8c-2ubuntu10 amd64 [installed]
libjpeg8/jammy,now 8c-2ubuntu10 amd64 [installed]
libjpeg8/jammy,now 8c-2ubuntu10 i386 [installed,automatic]

$ ls /usr/lib/x86_64-linux-gnu/libjpeg* -l
-rw-r--r-- 1 root root 820348 feb 21  2022 /usr/lib/x86_64-linux-gnu/libjpeg.a
lrwxrwxrwx 1 root root     12 feb 21  2022 /usr/lib/x86_64-linux-gnu/libjpeg.so -> libjpeg.so.8
lrwxrwxrwx 1 root root     16 ago  7 18:45 /usr/lib/x86_64-linux-gnu/libjpeg.so.8 -> libjpeg.so.8.2.2
-rw-r--r-- 1 root root 522960 feb 21  2022 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.2.2
lrwxrwxrwx 1 root root     16 gen 28  2022 /usr/lib/x86_64-linux-gnu/libjpegxr.so.0 -> libjpegxr.so.1.2
-rw-r--r-- 1 root root 223592 gen 28  2022 /usr/lib/x86_64-linux-gnu/libjpegxr.so.1.2

The interesting thing is that using my installed GDAL for instance with gdal_translate or QGIS works as expected (reading JPEG compressed tiffs just fine), it's just rust programs using this library and dynamically linking to GDAL which fails to load.

I have tried on 3 different systems, all with Ubuntu 22.04, and none of them seems to work. I used apt to install GDAL (version 3.4).

@lnicola
Copy link
Member

lnicola commented Sep 30, 2023

I'm also inclined to think this is a version mismatch. How did you build your program, was it on this computer or somewhere else? Can you try building and running it in a container to isolate it from the rest of your system?

And does a simple program that just reads the three bands (for example) have the same issue?

@metasim
Copy link
Contributor

metasim commented Oct 2, 2023

@frapa Do you by chance use conda or some other Python environment management system? I've had problems with it polluting the link environment during builds. I agree with @lnicola that this is a library version problem (gdal build against one jpeg library, but loading a different library at runtime.

@metasim
Copy link
Contributor

metasim commented Oct 2, 2023

@frapa Also could you paste the output of this?

gdalinfo --formats | grep -i jpeg
gdalinfo --formats | grep -i tif

(may or may not be helpful, but can compare to what's in our CI environment)

@lnicola
Copy link
Member

lnicola commented Nov 16, 2023

@frapa are you still having this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants