4

My project is trying to incorporate SOCI for easy MySQL database access from C++. One of my teammates created a running SOCI test program in linux using the MySQL backend with only this link in his CMake file:

target_link_libraries(MyExecutable ${SOCI_LIBRARY})

Under Mac, however, when I try to run the program it errors out on the session creation line:

session sql("mysql", "service...")

with this error:

Error: Failed to find shared library for backend mysql

I definitely have MySQL installed and I definitely built SOCI with MySQL support, the make for SOCI even says it found MySQL libraries.

Should a CMake project using SOCI with a MySQL backend also link against MySQL or the SOCI MySQL plugin? I have tried going down that route but end up getting different runtime errors, like:

dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: MyExecutable
Reason: image not found

Any help would be greatly appreciated, I can provide our test program if needed, thanks!

kelano
  • 293
  • 3
  • 14

0 Answers0