7

The answer to this question How to compile/link Boost with clang++/libc++? states to build Boost with clang++ and libc++, the following should do:

./b2 clean
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++"

I tested the above tip on a Scientific Linux 6.4 x86_64 host and it works "mostly" building the full Boost 1_53_0 distribution, with clang++ 3.3sv and libc++ 3.3svn. I said mostly, as I really like to remove all libstdc++ dependency.

Nevertheless, the following:

  • libboost_graph
  • libboost_locale
  • libboost_regex

still shows libstdc++ dependencies (the ldd output makes it quite obvious). I would like to know a good way to remove such and would appreciate any hint.

Community
  • 1
  • 1
user183394
  • 1,033
  • 1
  • 11
  • 20
  • are you basically looking to statically link libstdc++? Or something else? – alrikai Apr 04 '13 at 19:30
  • 3
    On Linux you may be linking to libstdc++ to get the low level libsupc++ support, but I am not sure of that theory. There exist non-GPL replacements for this, search for libc++abi or libcxxabi. – Howard Hinnant Apr 04 '13 at 20:08
  • @alrikai, Actually what I would like to do is to statically link libc++ so that I can run software implemented in C++11 on systems running older Linux, e.g. RHEL 5.x, 6.x. – user183394 Apr 04 '13 at 21:58
  • @Howard Hinnant, Thanks for chipping in. I read about that on the libc++ Web site, but thought that I could skip it. OK, I will give it a try. – user183394 Apr 04 '13 at 21:59
  • I took a closer look of `boost_1_53_0/libs/regex/build` a while ago while taking a short break from my daily work. I saw a bunch `*.mak` files. One of them is called `generic.mak`, the rest have names that have explicit association with specific compilers. OK. I will tinker with the `generic.mak` a bit and see what I can come up with. – user183394 Apr 04 '13 at 22:07
  • @user183394, C++ code without the exact C++ libraries (and others) just won't work. Recompile for the environment where it will run, anything else is just screaming for trouble. – vonbrand Apr 04 '13 at 23:04
  • How can we get MacPorts to do this? – smci Oct 04 '13 at 09:30

1 Answers1

-4

I found out how to do it. Thanks to @Howard Hinnant for his mentioning of libc++abi. After RTFM http://libcxx.llvm.org/, it's trivial to build the entire boost libraries free of any libstdc++ dependencies. Yes, all I had to do is to RTFM!

user183394
  • 1,033
  • 1
  • 11
  • 20
  • 12
    Well, we are glad you found the solution, but a general answer of the kind of "RTFM" isn't actually helping those who need a little bit more help than others. Do you want to at least point in the right direction (specific, not general, link, a section to look at, etc)? – csotiriou Sep 28 '13 at 09:09
  • Yes, useless answer, -1 – paulm Nov 03 '16 at 11:29