I recommend removing all library instances from everywhere and starting from scratch to make sure there is ONE instance of the library binary in single preferred format (static one, I think) you are linking to, not several different ones in different folders.
Also your previous reply ( https://www.libraw.org/comment/6846#comment-6846 ) lists both .a and .dylib files in /usr/local/lib while you're refering ./lib folder in your last reply.
I recommend removing all library instances from everywhere and starting from scratch to make sure there is ONE instance of the library binary in single preferred format (static one, I think) you are linking to, not several different ones in different folders.