5

In my attempt to answer my own question Clang linker reports "symbol not found", despite 'nm -m' revealing that the name exists in a library that is being linked against, I have discovered links that indicate that I must build Boost on OS X so that it explicitly uses Clang and links to libc++ here, here, and here.

Following the steps indicated (with the help of additional googling to assist with/confirm the process of editing user-config.jam, placing it in my home directory, and other necessary steps), I have added the following lines to my ~/user-config.jam file:

using clanglibcpp : 11
    : "/usr/bin/clang++"
    : <cxxflags>"-std=c++11 -stdlib=libc++" <linkflags>"-stdlib=libc++"
    ;

I have then run ./b2 from the $BOOST_ROOT directory:

./b2 toolset=clanglibcpp-11 --with-filesystem variant=release link=static threading=multi

Unfortunately, no matter what I do, I receive the following error:

ERROR: rule "clanglibcpp.init" unknown in module "toolset"

I have confirmed that /usr/bin/clang++ exists at the path indicated (it does). I have also tried adding the above lines to $BOOST_ROOT/tools/build/v2/user-config.jam (no luck). I have also tried running ./bootstrap.sh from the boost root directory, as well as running ./b2 --clean. No luck.

What am I supposed to do to actually get the toolset in user-config.jam to take effect for my Boost build on OS X?

Community
  • 1
  • 1
Dan Nissenbaum
  • 13,558
  • 21
  • 105
  • 181
  • I'm not sure, and sadly I can't check right now, but can you try using: `using clang : libcpp11 : "/usr/bin/clang++" : "-std=c++11 -stdlib=libc++" "-stdlib=libc++" ;` and then invoking b2 like this: `./b2 toolset=clang-libcpp11 --with-filesystem variant=release link=static threading=multi` – llonesmiz Dec 16 '13 at 15:42
  • It worked! Why does this make a difference? I thought that this entry in `user-config.jam` **DEFINES** the toolset; but the fact that this change worked implies that the toolset name (`clang`) must already exist, and the entry here just adds a different variant of that toolset. In any case, please post this as an answer so that I can accept it. Thanks. – Dan Nissenbaum Dec 16 '13 at 15:50
  • @cv_and_he I forgot to tag you in my comment... see comment above. – Dan Nissenbaum Dec 16 '13 at 15:58
  • Glad it helped, but I don't know enough to put an answer. Hopefully someone more experienced will be able to give an explanation. – llonesmiz Dec 16 '13 at 16:04
  • 1
    @cv_and_he hmmm - I understand. But, it actually answers the question. If you don't put it as the answer, I will (just so it's noted for future users that the question *is* answered) - and I'd rather give you the credit. Thanks again! – Dan Nissenbaum Dec 16 '13 at 16:10
  • 2
    @DanNissenbaum according to Boost.Build reference, the first identifier is a "tool" name, so one can only select one of the [built-in tools](http://www.boost.org/boost-build2/doc/html/bbv2/extending/tools.html) (or provide support [for a new one](http://www.boost.org/boost-build2/doc/html/bbv2/extending/tools.html)). – Igor R. Dec 16 '13 at 17:52

1 Answers1

1

@llonesmiz answer that worked to @Dan Nissenbaum:

I'm not sure, and sadly I can't check right now, but can you try using:

using clang : libcpp11 
    : "/usr/bin/clang++"
    : <cxxflags>"-std=c++11 -stdlib=libc++" <linkflags>"-stdlib=libc++"
    ;

and then invoking b2 like this:

./b2 toolset=clang-libcpp11 --with-filesystem variant=release link=static threading=multi