rafael2k / darkice

DarkIce is a live audio streamer. It records audio from an audio interface (e.g. sound card), encodes it and sends it to a streaming server. This is the official development repository of Darkice.
http://www.darkice.org
198 stars 46 forks source link

darkice: error while loading shared libraries #128

Open BillGoldsmith opened 6 years ago

BillGoldsmith commented 6 years ago

I've compiled darkice-1.3 on a Centos7 system. It configures with lame, vorbis & jack support (those are the ones I need) & compiles with no errors.

However, when I run it I get:

darkice: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory

But the file is there: #ls -l /usr/lib/libmp3lame.so.0 lrwxrwxrwx. 1 root root 19 Oct 21 13:59 /usr/lib/libmp3lame.so.0 -> libmp3lame.so.0.0.0

Well, OK that's the symlink. So: # ls -l /usr/lib/libmp3lame.so.0.0.0 -rwxr-xr-x. 1 root root 437863 Oct 21 13:59 /usr/lib/libmp3lame.so.0.0.0

I'm stumped. Any ideas on a next step?

DanielEckl commented 6 years ago

You may ask your "list dynamic dependencies" tool (ldd) which library darkice wants and where the dynamic linker would find it. For me this looks like that:

ldd /path/to/darkice |grep libmp3lame
        libmp3lame.so.0 => /usr/lib/x86_64-linux-gnu/libmp3lame.so.0 (0x00007f6fd8e9f000)

I guess for you it will tell libmp3lame.so.0 => not found

Now to find out where your dynamic linker is searching for libs you could watch it while running with strace like this:

strace -f darkice 2>&1 |grep mp3lame

I suppose you will see a lot of "openat" calls to libmp3lame.so.0 in different locations, which all result in "ENOENT (No such file or directory)", but this way you can see in which paths it is searching for it. Watch closely if this includes "/usr/lib". For me, it does. If not, there is somethign wrong with your dynamic library configuration. The main config file should be /etc/ld.conf. Sometimes this just incudes other config files in some directory, which you can inspect then.

I cannot support you in debugging your ld config, tho, but I hope this will lead you to the solution.

EDIT: As a workaround when your ld config is broken, you may try to manually add /usr/lib to the LD search path with export LD_LIBRARY_PATH="/usr/lib/" before running darkice in the same shell.

paraenggu commented 6 years ago

Although, it won't directly address your linking problem, there's a pre-compiled darkice RPM available for CentOS 7 from one of our OBS projects home:radiorabe:streambox.

Feel free to use it if you like, it also contains a systemd service unit which allows you to run darkice under an unprivileged user.

BillGoldsmith commented 6 years ago

Thank you very much for the pointer @DanielEckl - correcting the ld config solved the issue.

And thanks also @paraenggu -- I've check out the darkice rpm the next time I'm building an enocder.