Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 933387 - media-libs/libpulse cannot be normally linked with on prefix? (was: games-emulation/mednafen compile fails in prefix environment: libpulsecommon-17.0.so not found)
Summary: media-libs/libpulse cannot be normally linked with on prefix? (was: games-emu...
Status: CONFIRMED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-02 02:41 UTC by Esme Povirk
Modified: 2024-06-02 14:43 UTC (History)
6 users (show)

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


Attachments
output of `emerge --info '=games-emulation/mednafen-1.32.1::gentoo'` (emerge-info,5.66 KB, text/plain)
2024-06-02 02:43 UTC, Esme Povirk
Details
output of `emerge -pqv '=games-emulation/mednafen-1.32.1::gentoo'` (emerge-pqv,262 bytes, text/plain)
2024-06-02 02:44 UTC, Esme Povirk
Details
build log (build.log,353.32 KB, text/plain)
2024-06-02 02:45 UTC, Esme Povirk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Esme Povirk 2024-06-02 02:41:58 UTC
Compiling mednafen in a prefix eventually fails to link.

Reproducible: Always

Steps to Reproduce:
Run "emerge mednafen" in prefixed environment.
Actual Results:  
Link error.

Expected Results:  
Successful build.

I think this is the relevant part of the error:
/home/deck/gentoo/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: warning: libpulsecommon-17.0.so, needed by /home/deck/gentoo/usr/lib64/libpulse.so.0, not found (try using -rpath or -rpath-link)

Running ldd -d on libpulse.so.0 in the prefixed environment finds /home/deck/gentoo/usr/lib64/pulseaudio/libpulsecommon-17.0.so and reports no errors.
Comment 1 Esme Povirk 2024-06-02 02:43:52 UTC
Created attachment 894895 [details]
output of `emerge --info '=games-emulation/mednafen-1.32.1::gentoo'`
Comment 2 Esme Povirk 2024-06-02 02:44:49 UTC
Created attachment 894896 [details]
output of `emerge -pqv '=games-emulation/mednafen-1.32.1::gentoo'`
Comment 3 Esme Povirk 2024-06-02 02:45:06 UTC
Created attachment 894897 [details]
build log
Comment 4 Esme Povirk 2024-06-02 02:53:13 UTC
Setting LD_LIBRARY_PATH to the directory containing libpulsecommon-17.0.so works around this.
Comment 5 Ionen Wolkens gentoo-dev 2024-06-02 09:52:16 UTC
mednafen does not use libpulse* at all, but it does link with libsdl2 that can be indirectly using it if USE=pulseaudio and could trigger a build failure.

Not sure why, but it seems(?) to be either libpulse itself that's broken or something with the toolchain/prefix. Aka, forget mednafen, cannot link a simple program with libpulse:

    $ gcc -o test -x c $(pkgconf --cflags --libs libpulse) - <<<'int main(void) { return 0; }'
    /home/ionen/prefix/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: warning: libpulsecommon-17.0.so, needed by 
    /home/ionen/prefix/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/libpulse.so, not found (try using -rpath or -rpath-link)

Not quite sure why it's happening at a glance, it *should* know where to find it:

    $ readelf -d /home/evan/prefix/usr/lib64/libpulse.so.0.24.3  | grep RUNPATH
     0x000000000000001d (RUNPATH)            Library runpath: [/home/ionen/prefix/usr/lib64/pulseaudio]

$ lddtree prefix/usr/lib64/libpulse.so | grep common    
    libpulsecommon-17.0.so => 
    /home/ionen/prefix/usr/lib64/pulseaudio/libpulsecommon-17.0.so

(file does exist and seems valid)

Guess I'll assign to libpulse+prefix for now (maybe someone else has an idea, I don't mess with prefix much), but not convinced that the issue is really libpulse. Either way I don't think it's mednafen.
Comment 6 James Le Cuirot gentoo-dev 2024-06-02 14:43:33 UTC
I believe this is another instance of bug #913489, which happens on RAP prefix when a library in a non-standard directory is pulled in, e.g. /usr/lib/pulseaudio/libpulsecommon-17.0.so. It's a long-standing issue that is partly my fault in my efforts to fix other issues, but I just haven't had time to address it. One way around it is to any linker other than bfd. I recommend mold.