0

I have a project that include some asio header files, I have boost_system linked statically already, but ASIO keeps adding -lboost_system to the linker so the resulting binary depends on the dynamic version of boost_system, I have -DBOOST_ALL_NO_LIB (in "other link flags") to prevent autolinking but it seems to be ignored.

Im using XCode 4 with clang and c++11

there any other way to prevent autolinking?

Sam Miller
  • 23,808
  • 4
  • 67
  • 87
alter
  • 333
  • 4
  • 14
  • You should put `BOOST_ALL_NO_LIB` in "preprocessor macros" rather than putting `-DBOOST_ALL_NO_LIB` "other link flags". That said, I'm not sure that will make a difference. – Mankarse Apr 19 '13 at 00:54
  • no luck putting that macro in "preprocessor macros" – alter Apr 19 '13 at 01:13

1 Answers1

0

it result that when i added the .a file to my project, I needed to change the "file type" to Match-O object code, ( as this answer pointed https://stackoverflow.com/a/6124806/520221 notes), even if you add the file to the "link files to executable" in the build phase tab.

So i think that ASIO in some way knows if the library was already included (statically or dynamically). because of the of the "file type" it never gets linked , so asio include the -lboost_system flag.

another tip, you have to build boost and your project with libstdc++, it does not work with libc++, I don't know why. see this How I do compile a application against a static library compiled with libc++ in xcode/clang/macos? , i think its a bug or something

Community
  • 1
  • 1
alter
  • 333
  • 4
  • 14