I'm trying to build some software on MacOS that uses boost (specifically boost_system). It all appears to configure and build ok, but when it goes to link it gives the error:
ld: library 'boost_system' not found
Looking at the boost libraries that MacPorts installed, they all appear to have a -mt suffix -- I find /opt/local/lib/libboost_system-mt.dylib. If I change the Makefile.am file to use -lboost_system-mt instead, then everything works, but of course that is both very painful and would break any other build.
Anyone know what is going on here? Where does this -mt suffix come from? Is this a problem with MacPorts or something else?
The
-mtsuffix in your Boost library filenames stands for "multithreaded" (as illustrated in this thread). That naming convention is used by some package managers, including MacPorts, to distinguish between single-threaded and multithreaded versions of the Boost libraries.First option: Instead of editing
Makefile.amdirectly, you might be able to pass the correct library name to your build configuration script. That is often done via flags likeLDFLAGSorLIBS.Or: create a symlink from
libboost_system.dylibtolibboost_system-mt.dylib. That way, your software can link againstlibboost_systemwhile actually using the multithreaded variant.