Typically on Debian when you install things from the repository, they just work. It sets up things just fine and life is good. This is great for things that are up to date in the repository.
I am building some tools that I would like to manually update from github or mercurial.
using cmake or the configure script to build the code is fine, I also add my own prefix path so that I can easily remove or update the packages if need be.
I just build SDL2 from mercurial and installed it into /opt/SDL2 and added that to my path. I had to do that to be able to build SDL_image
which gave me this output after finishing it's process.
Libraries have been installed in:
/opt/SDL_IMAGE/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
This output above says a lot and I am not really sure how to parse it. In the past I used a mac which simplified a lot of this stuff but on linux I am having some trouble.
My understanding from reading that above code is that I should add something like this to my bashrc file.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/SDL_IMAGE/lib
export LD_RUN_PATH=$LD_RUN_PATH:/opt/SDL_IMAGE/lib
to my bashrc, so that when I am linking against sdl image headers it'll find it? I've skimmed the man pages for ld but honestly I don't get it and that's why I am asking.
Especially this line: use the `-Wl,-rpath -Wl,LIBDIR' linker flag