Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 305403 - media-libs/sdl-image-1.2.10 fails to open jpg images w/ media-libs/jpeg-8
Summary: media-libs/sdl-image-1.2.10 fails to open jpg images w/ media-libs/jpeg-8
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
: 291858 305735 307087 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-02-16 15:56 UTC by Petr Zima
Modified: 2010-03-17 20:20 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Zima 2010-02-16 15:56:48 UTC
After upgrading media-libs/jpeg from version 7 to 8 and reinstalling media-libs/sdl-image-1.2.10, programs using sdl-image (e.g. showimage executable supplied with sdl-image itself) fail to open jpg files.

Reproducible: Always

Steps to Reproduce:
1. Upgrade media-libs/jpeg from version 7 to 8
2. Rebuild media-libs/sdl-image-1.2.10
3. Run "showimage file.jpg"

Actual Results:  
showimage fails with error:
"JPEG loading error"

Expected Results:  
open and show the jpg file

The upgrade of jpeg-7 to jpeg-8 intentionally preserves libjpeg.so.7 and warns user to run revdep-rebuild and after that erase the older version manually. Unfortunately when reinstalling sdl-image after the upgrade of jpeg, this confuses sdl-image's configure which still finds the old libjpeg.so.7 and remembers it. Namely sdl-image does not actually link against libjpeg.so.7, it uses on demand dynamic loading of the library it has remembered.

Now if I erase the old libjpeg.so.7 sdl-image of course stops working. But this is not the problem. Even if I *do not erase* the old libjpeg.so.7, the freshly reinstalled sdl-image for unknown reason does not load libjpeg.so.7! It feels really weird because after the upgrade of jpeg but before the reinstall of sdl-image, loading of jpegs worked fine. Simply put, the reinstall of sdl-image (which should normally fix it) broke it. It is probably caused by messing with some dynamic loading ?libtool/dlopen? stuff but I am not expert.

An easy fix is to reinstall sdl-image *after* erasing the old libjpeg.so.7. Then configure finds the new libjpeg.so.8 and everything works fine.

This bug should be fixed at the very least by modifying the warning message after the upgrade of jpeg and recommending to revdep-rebuild before *and after* erasing the old library. Of course someone could actually solve the weird issue. After all I would personally prefer not to preserve the old library for jpeg at all. It is common that things break between system update and revdep-rebuild and jpeg is not system critical to deserve such special (and IMHO ugly) trickery.
Comment 1 Rafał Mużyło 2010-02-16 18:54:35 UTC
That's probably a CANTFIX.
revdep-rebuild works (on libs) by analyzing ldd output.
If a lib is dlopen'ed, it can't be detected that way.

Comment 2 Mr. Bones. (RETIRED) gentoo-dev 2010-02-17 08:33:00 UTC
Doesn't sound like a bug in sdl-image to me.
Comment 3 Petr Zima 2010-02-17 13:02:45 UTC
I have done some debugging and the problem is an API/ABI mismatch. When there is jpeg-8 installed with the preserved libjpeg.so.7 then sdl-image rebuild uses headers of version 8 but the old .so of version 7. The old .so is dynamically loaded fine (no problem in dlopen/libtool/ldconfig as I suggested), but the exported functions of libjpeg explicitly check version (and also struct sizes etc.) passed by the caller and immediately fail since 80 != 70.

Hence it is a kind of bug in sdl-image's configure, which should preferably find the right version of libjpeg.so which is compatible with the headers. Or at least the newer version would be imho a better guess than the older one.

I stil dislike the idea of preserving the old .so.7 in jpeg-8 at all. However this problem might appear also for slotted versions of jpeg which is perfectly legimate configuration and so should be fixed.
Comment 4 Rafał Mużyło 2010-02-17 16:18:16 UTC
The problem here is that sdl-image determines jpeg library
to link to by "ls /usr/lib/libjpeg.so.[0-9] | sort | sed 's/.*\/\(.*\)/\1/; q'"

As long as libjpeg.so.7 is still there, it will be the result of this query.

Only after it's removed can sdl-image be rebuilt correctly.
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2010-02-18 09:02:31 UTC
Sounds like a bug in sdl-image to me, bad logic, likely only designed for systems with one libjpeg.so.X installed while it's perfectly valid to have old ABI available too
Comment 6 Samuli Suominen (RETIRED) gentoo-dev 2010-02-18 09:42:40 UTC
If it's really doing

ls /usr/lib/libjpeg.so.[0-9] | sort | sed 's/.*\/\(.*\)/\1/; q'

Then maybe it should be reversed to

ls /usr/lib/libjpeg.so.[0-9] | sort -r | sed 's/.*\/\(.*\)/\1/; q'

The -r switch being the key here
Comment 7 SpanKY gentoo-dev 2010-02-18 09:48:56 UTC
i vaguely recall that just about all the main SDL projects have similar brain dead libjpeg.so lookups.  i never cared in the past because it looked like libjpeg.so.62 (jpeg-6b) was going to be the last version ever ...
Comment 8 Nikolaus Polak 2010-02-18 13:42:11 UTC
*** Bug 305735 has been marked as a duplicate of this bug. ***
Comment 9 Mr. Bones. (RETIRED) gentoo-dev 2010-02-18 18:08:20 UTC
gives me chills but I put the sort -r hack in there for sdl-image-1.2.10-r1.ebuild.  It works as expected but the whole find_lib function in configure looks pretty evil to me.
Comment 10 Samuli Suominen (RETIRED) gentoo-dev 2010-02-27 16:42:53 UTC
*** Bug 307087 has been marked as a duplicate of this bug. ***
Comment 11 Mr. Bones. (RETIRED) gentoo-dev 2010-03-02 22:23:05 UTC
*** Bug 291858 has been marked as a duplicate of this bug. ***
Comment 12 INODE64 Sistemas 2010-03-02 23:25:55 UTC
in games-action/wop show this error

INFO: Theme background is '(null)'
ERROR: Video::loadImage: Couldn't load image '/usr/share/games/wop/images/mapstuff/background/dark_earth.jpg'


after update sdl-image-1.2.10-r1 solve this problem
Comment 13 Mr. Bones. (RETIRED) gentoo-dev 2010-03-17 20:20:34 UTC
Latest revs of all the core sdl libraries link against the libraries instead of using dlopen with the interesting configure-time library-finding shell code.
Should work better over time now.