Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 528086 - games-misc/katawa-shoujo-1.2: portage reports existing preserved libs when media-libs/sdl-mixer and media-libs/sdl-ttf are not installed
Summary: games-misc/katawa-shoujo-1.2: portage reports existing preserved libs when me...
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Julian Ospald
URL: http://thread.gmane.org/gmane.linux.g...
Whiteboard:
Keywords: InVCS, PATCH
Depends on:
Blocks:
 
Reported: 2014-11-03 08:58 UTC by Pavel Volkov
Modified: 2014-11-07 23:00 UTC (History)
3 users (show)

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


Attachments
patch for katawa-shoujo-1.2.ebuild to use patchelf --set-rpath (katawa-shoujo-1.2.ebuild.patch,803 bytes, patch)
2014-11-03 22:56 UTC, Zac Medico
Details | Diff
/var/db/pkg/games-misc/katawa-shoujo-1.2-r1/NEEDED.ELF.2 (NEEDED.ELF.2,10.35 KB, text/plain)
2014-11-06 20:05 UTC, Pavel Volkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Volkov 2014-11-03 08:58:24 UTC
Probably deps should be added on sdl-mixer and sdl-ttf.

Reproducible: Always
Comment 1 Julian Ospald 2014-11-03 14:28:34 UTC
(In reply to Pavel Volkov from comment #0)
> Probably deps should be added on sdl-mixer and sdl-ttf.
> 

No. Those are bundled.

If you don't want bundled libs, use the experimental system-renpy USE flag.

Since I don't use portage I cannot test it's misfeatures.
Comment 2 Zac Medico gentoo-dev 2014-11-03 21:43:18 UTC
(In reply to Julian Ospald (hasufell) from comment #1)
> No. Those are bundled.

The the ebuild should use chrpath on the binaries in order to force them to use the bundled libs. For example, see the chrpath usage in the googleearth (bug 265372) and spideroak-bin (bug 467896) ebuilds.
Comment 3 Zac Medico gentoo-dev 2014-11-03 21:44:26 UTC
Pardon, I meant to say patchelf --set-rpath, not chrpath.
Comment 4 Julian Ospald 2014-11-03 21:59:43 UTC
(In reply to Zac Medico from comment #3)
> Pardon, I meant to say patchelf --set-rpath, not chrpath.

Then someone should provide a patch. I cannot test if it's correct.
Comment 5 Zac Medico gentoo-dev 2014-11-03 22:02:27 UTC
(In reply to Julian Ospald (hasufell) from comment #4)
> (In reply to Zac Medico from comment #3)
> > Pardon, I meant to say patchelf --set-rpath, not chrpath.
> 
> Then someone should provide a patch. I cannot test if it's correct.

I'll look into writing a patch, but you can use ldd to test it yourself. If ldd reports that your binaries are linking the bundled libraries instead of the system libraries, then it proves that patchelf --set-rpath has been used correctly.
Comment 6 Zac Medico gentoo-dev 2014-11-03 22:56:28 UTC
Created attachment 388480 [details, diff]
patch for katawa-shoujo-1.2.ebuild to use patchelf --set-rpath

I have not tested this patch. If ldd reports that the program binaries link to the bundled libs, then it proves that the patch works.
Comment 7 Julian Ospald 2014-11-06 01:34:34 UTC
+*katawa-shoujo-1.2-r1 (06 Nov 2014)
+
+  06 Nov 2014; Julian Ospald <hasufell@gentoo.org> +katawa-shoujo-1.2-r1.ebuild:
+  maybe fix bug #528086
Comment 8 Pavel Volkov 2014-11-06 11:01:54 UTC
Sorry, still bad linking:

!!! existing preserved libs:
>>> package: media-libs/sdl-mixer-1.2.12-r4
 *  - /usr/lib32/libSDL_mixer-1.2.so.0
 *  - /usr/lib32/libSDL_mixer-1.2.so.0.12.0
 *      used by /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/mixer.so (games-misc/katawa-shoujo-1.2-r1)
>>> package: media-libs/sdl-ttf-2.0.11-r1
 *  - /usr/lib32/libSDL_ttf-2.0.so.0
 *  - /usr/lib32/libSDL_ttf-2.0.so.0.10.1
 *      used by /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/font.so (games-misc/katawa-shoujo-1.2-r1)
Comment 9 Julian Ospald 2014-11-06 13:45:18 UTC
(In reply to Pavel Volkov from comment #8)
> Sorry, still bad linking:
> 

Provide a patch. As I said: I cannot and will not test this portage feature.
Comment 10 Zac Medico gentoo-dev 2014-11-06 18:37:49 UTC
(In reply to Pavel Volkov from comment #8)
> Sorry, still bad linking:
> 
> !!! existing preserved libs:
> >>> package: media-libs/sdl-mixer-1.2.12-r4
>  *  - /usr/lib32/libSDL_mixer-1.2.so.0
>  *  - /usr/lib32/libSDL_mixer-1.2.so.0.12.0
>  *      used by
> /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/mixer.so
> (games-misc/katawa-shoujo-1.2-r1)
> >>> package: media-libs/sdl-ttf-2.0.11-r1
>  *  - /usr/lib32/libSDL_ttf-2.0.so.0
>  *  - /usr/lib32/libSDL_ttf-2.0.so.0.10.1
>  *      used by
> /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/font.so
> (games-misc/katawa-shoujo-1.2-r1)


Where does katawa-shoujo install the bundled libs? The attached patch assumes that the bundled libs are installed in /opt/katawa-shoujo/lib/.
Comment 11 Julian Ospald 2014-11-06 18:46:22 UTC
(In reply to Zac Medico from comment #10)
> 
> Where does katawa-shoujo install the bundled libs? The attached patch
> assumes that the bundled libs are installed in /opt/katawa-shoujo/lib/.

Yes, that's the only place where libs are.
Comment 12 Zac Medico gentoo-dev 2014-11-06 19:06:18 UTC
(In reply to Julian Ospald (hasufell) from comment #11)
> (In reply to Zac Medico from comment #10)
> > 
> > Where does katawa-shoujo install the bundled libs? The attached patch
> > assumes that the bundled libs are installed in /opt/katawa-shoujo/lib/.
> 
> Yes, that's the only place where libs are.

Okay, then the patch seems correct.

@Pavel: Please check with ldd to see how it resolves the dependencies of those bundled pygame libs:

ldd /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/mixer.so \
    /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/font.so
Comment 13 Pavel Volkov 2014-11-06 19:44:45 UTC
It seems that setting rpath with patchelf is not enough.
patchelf succeeds:

# patchelf --print-rpath /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/font.so
/opt/katawa-shoujo/lib

However:

# ldd /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/font.so | grep SDL
ldd: warning: you do not have execution permission for `/opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/font.so'
        libSDL-1.2.so.0 => /usr/lib32/libSDL-1.2.so.0 (0xf76e9000)
        libSDL_ttf-2.0.so.0 => /usr/lib32/libSDL_ttf-2.0.so.0 (0xf76c6000)

If it's relevant, my arch is am64.
Comment 14 Zac Medico gentoo-dev 2014-11-06 19:57:48 UTC
There may be something about the bundled libraries that prevents ldd and preserve-libs from using them to resolve the dependencies. Please attach /var/db/pkg/games-misc/katawa-shoujo-1.2-r1/NEEDED.ELF.2 which contains essential details about the bundled libraries.
Comment 15 Pavel Volkov 2014-11-06 20:05:11 UTC
Created attachment 388682 [details]
/var/db/pkg/games-misc/katawa-shoujo-1.2-r1/NEEDED.ELF.2

Attaching the requested file
Comment 16 Zac Medico gentoo-dev 2014-11-06 21:00:13 UTC
(In reply to Pavel Volkov from comment #15)
> Created attachment 388682 [details]
> /var/db/pkg/games-misc/katawa-shoujo-1.2-r1/NEEDED.ELF.2
> 
> Attaching the requested file

Everything there seems correct. If you temporarily rename /usr/lib32/libSDL_mixer-1.2.so* and /usr/lib32/libSDL_ttf-2.0.so.0*, then does ldd correctly resolve the links to the bundled libraries?

If ldd still doesn't resolve the libraries correctly, then run ldconfig and try ldd again, in case the ld.so cache needs to be rebuilt for the changes to be recognized.
Comment 17 Pavel Volkov 2014-11-06 23:32:21 UTC
If I rename the system libs, ldd reports:
1. libSDL_ttf-2.0.so.0 as "not found".
2. libSDL_mixer-1.2.so.0 as "not found"
3. other libraries are found under /usr

If I then create the file /etc/ld.so.conf.d/99katawa.conf containing "/opt/katawa-shoujo/lib/linux-x86/lib" and re-run ldconfig, ldd reports:
1. libSDL_ttf-2.0.so.0 is found in /opt
2. libSDL_mixer-1.2.so.0 as "not found" (there's no such file in /opt really)
3. other libraries are found under /usr

ldconfig also outputs these messages:
ldconfig: file /opt/katawa-shoujo/lib/linux-x86/lib/libSDL-1.2.so.0 is truncated
ldconfig: file /opt/katawa-shoujo/lib/linux-x86/lib/libXau.so.6 is truncated
ldconfig: file /opt/katawa-shoujo/lib/linux-x86/lib/libavcodec.so.52 is truncated
ldconfig: file /opt/katawa-shoujo/lib/linux-x86/lib/libavutil.so.49 is truncated
ldconfig: file /opt/katawa-shoujo/lib/linux-x86/lib/libpython2.5.so.1.0 is truncated
ldconfig: /opt/katawa-shoujo/lib/linux-x86/lib/ is not a symbolic link

libpython2.5.so.1.0 is also reported as "not found" by ldd
Comment 18 Zac Medico gentoo-dev 2014-11-07 00:00:08 UTC
When looking at NEEDED.ELF.2 earlier, I failed to notice that the libs were installed in /opt/katawa-shoujo/lib/linux-x86/lib. So, I've fixed the rpath setting in the ebuild in cvs as follows:

@@ -39,8 +39,8 @@
 		# Use \x7fELF header to separate ELF executables and libraries
 		[[ $(od -t x1 -N 4 "${x}") == *"7f 45 4c 46"* ]] || continue
 		patchelf --set-rpath \
-			"${EPREFIX}${GAMES_PREFIX_OPT}/${PN}/lib" "${x}" || \
-			die "patchelf failed on ${x}"
+			"${EPREFIX}${GAMES_PREFIX_OPT}/${PN}/lib/linux-x86/lib" \
+			"${x}" || die "patchelf failed on ${x}"
 	done < <(find . -type f)
 }
Comment 19 Pavel Volkov 2014-11-07 06:59:11 UTC
libSDL_ttf-2.0.so.0 is now found in /opt, alright

libSDL_mixer-1.2.so.0.12.0 is still preserved by portage in /usr — there's no such file in /opt/katawa-shoujo
It is used by /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/mixer.so
Comment 20 Zac Medico gentoo-dev 2014-11-07 07:15:37 UTC
(In reply to Pavel Volkov from comment #19)
> libSDL_ttf-2.0.so.0 is now found in /opt, alright

Excellent. Thanks for testing.

> libSDL_mixer-1.2.so.0.12.0 is still preserved by portage in /usr — there's
> no such file in /opt/katawa-shoujo
> It is used by /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/mixer.so

Yeah, NEEDED.ELF.2 confirms that.

@Julian: How do you handle libSDL_mixer-1.2.so.0 missing from the bundled libraries? I suppose you could add a dependency on media-libs/sdl-mixer, but maybe you'd prefer to bundle it in somehow.
Comment 21 Julian Ospald 2014-11-07 13:44:11 UTC
(In reply to Zac Medico from comment #20)
> Yeah, NEEDED.ELF.2 confirms that.
> 
> @Julian: How do you handle libSDL_mixer-1.2.so.0 missing from the bundled
> libraries? I suppose you could add a dependency on media-libs/sdl-mixer, but
> maybe you'd prefer to bundle it in somehow.

It starts fine here with all libSDL_mixer system libraries removed, so I don't see a reason to bundle it or even add a dependency.
Comment 22 Diego Elio Pettenò (RETIRED) gentoo-dev 2014-11-07 19:19:22 UTC
What about you unbundle pygame instead? You know, proper packaging and all.
Comment 23 Julian Ospald 2014-11-07 20:26:36 UTC
(In reply to Diego Elio Pettenò from comment #22)
> What about you unbundle pygame instead? You know, proper packaging and all.

This is totally unrelated to pygame.

This is a renpy game. renpy is an engine and is already packaged. The engine breaks games with each new slot/release. The first thing I did was contacting upstream of katawa-shoujo to fix these issues. They didn't care.

So I had to add the "system-renpy" USE flag which is equivalent to "nothing is bundled" and also to "may randomly crash".

The initial ebuild did not have that USE flag until users reported problems, see
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/games-misc/katawa-shoujo/katawa-shoujo-1.0.ebuild?hideattic=0&revision=1.1&view=markup&sortby=log
https://bugs.gentoo.org/show_bug.cgi?id=459742
Comment 24 Diego Elio Pettenò (RETIRED) gentoo-dev 2014-11-07 21:14:48 UTC
/opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/font.so

This looks like it's coming from pygame. And it seems like either those versions are not being used (as a missing library from NEEDED means the file won't load, ever), or they are completely broken.

Even this:

386;/opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/mixer.so;;/opt/katawa-shoujo/lib;libSDL-1.2.so.0,libpthread.so.0,libSDL_mixer-1.2.so.0,libpython2.5.so.1.0,libc.so.6

either pygame mixer is never imported (just remove the .so) or it's loading the pygame mixer from the base OS (broken ABI).
Comment 25 Julian Ospald 2014-11-07 21:23:21 UTC
(In reply to Diego Elio Pettenò from comment #24)
> /opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/font.so
> 
> This looks like it's coming from pygame. And it seems like either those
> versions are not being used (as a missing library from NEEDED means the file
> won't load, ever), or they are completely broken.
> 
> Even this:
> 
> 386;/opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/mixer.so;;/opt/
> katawa-shoujo/lib;libSDL-1.2.so.0,libpthread.so.0,libSDL_mixer-1.2.so.0,
> libpython2.5.so.1.0,libc.so.6
> 
> either pygame mixer is never imported (just remove the .so) or it's loading
> the pygame mixer from the base OS (broken ABI).

Removing '/opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/mixer.so' seems to have no side effects afais.

Should I commit it with that one removed?
Comment 26 Zac Medico gentoo-dev 2014-11-07 22:42:30 UTC
(In reply to Julian Ospald (hasufell) from comment #25)
> Removing '/opt/katawa-shoujo/lib/linux-x86/lib/python2.5/pygame/mixer.so'
> seems to have no side effects afais.
> 
> Should I commit it with that one removed?

+1

From the point of view of portage users, that will solve the problem with preserve-libs.
Comment 27 Julian Ospald 2014-11-07 23:00:36 UTC
+*katawa-shoujo-1.2-r2 (07 Nov 2014)
+
+  07 Nov 2014; Julian Ospald <hasufell@gentoo.org>
+  -katawa-shoujo-1.2-r1.ebuild, +katawa-shoujo-1.2-r2.ebuild:
+  rm unused lib and fix bug #528086