Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Compiling flac on Linux (Read 5696 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Compiling flac on Linux

FIXED - It seems moving the files in /usr/local/lib/ to /usr/lib/ fixes this 

I am getting inconsistant result when compiling flac-1.2.1 on Linux. I am running Linux v2.6.29.1-unRAID. I am able to compile with no errors.

./configure
make
make install

I have installed the following libraries to build the project:

binutils-2.18.50.0.9-i1486.tgz
cxxlibs-6.0.8-i486-4.tgz
gcc-4.2.4-i486-1.tgz
gcc-g++-4.2.4-i486-1.tgz
glibc-2.7-i486-17.tgz
kernel-headers-2.6.27.7_smp-x86-1.tgz
make-3.81-i486-1.tgz

I see the following files added to
/usr/local/share/aclocal/
libFLAC++.m4
libFLAC.m4

/usr/local/bin/
flac
metaflac

/usr/local/lib/
libFLAC++.a
libFLAC++.la
libFLAC++.so
libFLAC++.so.6
libFLAC++.so.6.2.0
libFLAC.la
libFLAC.so
libFLAC.so.8
libFLAC.so.8.2.0

/usr/local/lib/pkgconfig/
FLAC++.pc
FLAC.pc

when I evoke type /usr/local/bin/flac sometimes I get the usage text (and I know it works) and sometimes I get the following error...

"flac: error while loading shared libraries: libFLAC.so.8: cannot open shared object file: No such file or directory."

I haven't been able to consistently make it work. I've searched and searched. Was some symbolic link not set properly?

Compiling flac on Linux

Reply #1
Try typing ldconfig and try again.

Compiling flac on Linux

Reply #2
Try typing ldconfig and try again.


To the OP: if this don't work, make sure /usr/local/lib is in your /etc/ld.so.conf before doing ldconfig. IIRC, from playing around with different distros, some of them don't have this as a default anymore.


Compiling flac on Linux

Reply #3
Try typing ldconfig and try again.


To the OP: if this don't work, make sure /usr/local/lib is in your /etc/ld.so.conf before doing ldconfig. IIRC, from playing around with different distros, some of them don't have this as a default anymore.


Thanks all. Here is my results? What does this mean?

root@unraid:/etc# more ld.so.conf
/usr/local/lib
/usr/i486-slackware-linux/lib
root@unraid:/etc# ldconfig
ldconfig: /usr/lib/libFLAC++.so.6 is not a symbolic link

ldconfig: /usr/lib/libFLAC.so.8 is not a symbolic link

ldconfig: /usr/lib/libfaad.so.2 is not a symbolic link

ldconfig: /usr/lib/libmp3lame.so.0 is not a symbolic link

root@unraid:/etc#

Compiling flac on Linux

Reply #4
FIXED - It seems moving the files in /usr/local/lib/ to /usr/lib/ fixes this 

This is an unwise thing to do. You are moving 3rd party software (often written by teenagers in their bedrooms learning to program) into your system libraries. The result over time will be an unreliable system and what is often known in the Microsoft world as DLL hell as the versions of the various shared libraries used by the software screws up.

If you are using a stable Linux system like RHEL/SL/Centos the third party libraries and binary will not be in your path. A quick way to add binaries as a test is to append/prepend the relevant directories to the PATH environment variable. Similarly for the dynamic libraries, append/prepend the relevant directories to the LD_LIBRARY_PATH environment variable.

A simple (but not wholly satisfactory) permanent solution is to simply add the PATH and LD_LIBRARY_PATH modifications to the startup file/s for whatever command shell you are using (e.g. .bashrc, .profile, .cshrc,...). A better solution is to use a custom environment for each 3rd party program to ensure they always use the correct version of shared libraries and can find all the extra supporting programs without name clashes. To do this requires investing a modest amount of time to learn a little bit about how things work.

when I evoke type /usr/local/bin/flac sometimes I get the usage text (and I know it works) and sometimes I get the following error...

"flac: error while loading shared libraries: libFLAC.so.8: cannot open shared object file: No such file or directory."

I haven't been able to consistently make it work. I've searched and searched. Was some symbolic link not set properly?

This simply means the directory containing libFLAC.so.8 is not in the list of directories for dynamic libraries that is searched when you run a program. The solution is to add the relevant directory to the list.

Compiling flac on Linux

Reply #5
root@unraid:/etc# more ld.so.conf


For your future reference, "less" is a much more powerful pager in the GNU tool chain.

/usr/local/lib


This means /usr/local/lib is already in your /etc/ld.so.conf. For your reference, when you run ldconfig, it updates a cache file called /etc/ld.so.cache to facilitate the linker in finding the dynamic libraries.

root@unraid:/etc# ldconfig
ldconfig: /usr/lib/libFLAC++.so.6 is not a symbolic link

ldconfig: /usr/lib/libFLAC.so.8 is not a symbolic link

ldconfig: /usr/lib/libfaad.so.2 is not a symbolic link

ldconfig: /usr/lib/libmp3lame.so.0 is not a symbolic link


Your have multiple versions of these library installed. Also, these files mentioned in the output should be symlinks, like this:

Code: [Select]
hoor@MagnusOpus:/usr/lib> ls -l libFLAC*&&ls -l libmp3*&&ls -l libfaad*
lrwxrwxrwx 1 root root     18 2008-12-22 12:28 libFLAC++.so -> libFLAC++.so.6.2.0
lrwxrwxrwx 1 root root     18 2008-12-22 07:12 libFLAC++.so.6 -> libFLAC++.so.6.2.0
-rwxr-xr-x 1 root root 100632 2008-12-09 14:21 libFLAC++.so.6.2.0
lrwxrwxrwx 1 root root     16 2008-12-22 12:28 libFLAC.so -> libFLAC.so.8.2.0
lrwxrwxrwx 1 root root     16 2008-12-22 07:12 libFLAC.so.8 -> libFLAC.so.8.2.0
-rwxr-xr-x 1 root root 347576 2008-12-09 14:21 libFLAC.so.8.2.0
-rw-r--r-- 1 root root 329366 2008-10-09 16:29 libmp3lame.a
-rwxr-xr-x 1 root root    938 2008-10-09 16:29 libmp3lame.la
lrwxrwxrwx 1 root root     19 2008-12-22 12:25 libmp3lame.so -> libmp3lame.so.0.0.0
lrwxrwxrwx 1 root root     19 2008-12-22 09:09 libmp3lame.so.0 -> libmp3lame.so.0.0.0
-rwxr-xr-x 1 root root 276036 2008-10-09 16:29 libmp3lame.so.0.0.0
-rw-r--r-- 1 root root 298962 2008-10-10 05:57 libfaad.a
-rwxr-xr-x 1 root root    917 2008-10-10 05:57 libfaad.la
lrwxrwxrwx 1 root root     16 2008-12-22 12:30 libfaad.so -> libfaad.so.0.0.0
lrwxrwxrwx 1 root root     16 2008-12-22 09:30 libfaad.so.0 -> libfaad.so.0.0.0
-rwxr-xr-x 1 root root 255792 2008-10-10 05:57 libfaad.so.0.0.0
lrwxrwxrwx 1 root root     16 2009-07-04 16:53 libfaad.so.2 -> libfaad.so.2.0.0
-rwxr-xr-x 1 root root 264000 2009-02-10 17:28 libfaad.so.2.0.0


The ones with the "->" are symlinks. You should clean up your /usr/local/lib directory (at the minimum delete those files mentioned in your output) and rerun ldconfig. You will also need to recompile and install lame and faad judging from your output.

Compiling flac on Linux

Reply #6
FIXED - It seems moving the files in /usr/local/lib/ to /usr/lib/ fixes this 

This is an unwise thing to do. You are moving 3rd party software (often written by teenagers in their bedrooms learning to program) into your system libraries. The result over time will be an unreliable system and what is often known in the Microsoft world as DLL hell as the versions of the various shared libraries used by the software screws up.


I second this. Self compiled software should go into the /usr/local hierarchy and optionally use something like checkinstall to put it into the package database for easy removal.