Is "/usr/local/lib" still searched before "/usr/lib" by GCC by default? If not, is there a way to force GCC to search /usr/local/lib first? GCC does search /usr/local/lib before /usr/lib (you can use gcc -print-search-dirs to see the exact details for your configuration) when linking, but your dynamic loader might not (which is what ldd calls, and what is used when you run the program). I think just modifying /etc/ld.so.conf and putting /lib before /usr/local/lib (or adding them in that order) should do the trick for you. Don't forget to run ldconfig after modifying ld.so.conf.