title: How to make ld prefer a static library over a dynamic library on macOS?
body: <p>I am using macOS 10.13.2 and have Xcode Command Line Tools installed. There are <code>librocksdb.a</code> and <code>librocksdb.dylib</code> in <code>/usr/local/lib</code>. I want to link against <code>librocksdb.a</code>. But <code>g++ -lrocksdb</code> links against <code>librocksdb.dylib</code>. Here <code>g++</code> is not from GNU gcc. It is from  Xcode Command Line Tools. I know that I can use <code>g++ /usr/local/lib/librocksdb.a</code> to make <code>ld</code> link against <code>librocksdb.a</code>. Is it possile to make <code>ld</code> prefer <code>librocksdb.a</code> over <code>librocksdb.dylib</code> with <code>-l</code> option?</p>