How Does gcc on Solaris Find Its Libraries?
Question
I'm trying to install 'quadrupel', a library that relies on ffmpeg on Solaris x86.
I managed to build ffmpeg and its libraries live in /opt/gnu/lib and the includes are in /opt/gnu/include but when I try to build quadrupel, it can't find the ffmpeg headers.
What flags/configuration is required to include those two directories in the proper search paths for libraries and includes? I'm not much of a Makefile hacker.
Solution
You can override the path by setting the environmental variable LD_LIBRARY_PATH. However I would suggest changing the system paths as well so you don't have to change the library path for all users. This can be done using crel.
crle -l -c /var/ld/ld.config -l /usr/lib:/usr/local/lib:/opt/gnu/lib
For the includes just add -I/opt/gnu/include to your CFLAGS variable.
OTHER TIPS
I believe you need to add the following to the Makefile:
CFLAGS += -I/opt/gnu/include
LDFLAGS += -L/opt/gnu/lib -R/opt/gnu/lib
The -I argument tell gcc where to find the include files. The -L flag tells ld where to find the libraries while linking. The -R flag writes /opt/gnu/lib into the library search path in the quadrupel binary, so it can find its libraries when it starts.