error compiling llvm 2.9/3.2 from source on macosx (possibly stdlibc++ issue)


I’ve some exceptions which I would like to solve to build LLVM+Clang from source on MacOSX 10.8+.

e[0me[1m/Users/travis/build/vpmedia/crossbridge/llvm-2.9/lib/Transforms/Utils/CodeExtractor.cpp:728:28: e[0me[0;1;31m
error: e[0me[1m no matching constructor for initialization of 'std::vector<BasicBlock >'e[0m std::vector<BasicBlock> Succs(succ_begin(codeReplacer),

I understand that it is some kind of C++ library issue (stdlibc++ vs. c++v1) but not exactly how to solve it. (Passing -stdlib=libstdc++ as CXX flag does not solve this).

You can check out a related github ticket here:

Also a Travis CI build:
I’ve googled for solution but I’ve only found partial informations regarding this. Any tips what should I do to easily fix these problems without modifying the LLVM source code? Thanks! Andrew

I'm stuck on 10.8.5 and got around it by:

1. Building the most recent stable branch of libc++. I got a couple of errors in the regression tests, but they looked like something obscure enough to net affect the compiler and so far, that is panning out.

2. I ran configure as follows:

../llvm/configure CXXFLAGS="-stdlib=libc++ -I/Programming/llvm/libcxx34/test/support -I/Programming/llvm/libcxx34/include" LDFLAGS="-L/Programming/llvm/libcxx34/lib"

I don't remember what the libcxx34/test/support dir is about. I probably cut and pasted the search paths from one of the LLVM docs. Or maybe it's only need to run the tests. It takes a long time to build, you do want to use the -j option with make.

I believe this completely avoids using anything from GCC (except maybe the assembler).

I used the stable 3.4 branch and the regression tests all appear to pass (there is a lot of output; so, I could have missed something).

Caveat: Outside of running the regressions, I haven't executed any code, yet. I'm actually porting LLVM to the Stratus VOS operating system (in my spare time, this isn't an official project). I won't really start testing things until I get some basic ABI tweaks done.

According to the online docs, you can also get it to work by installing a recent GCC compiler suite. That seemed like a lot more work for me. Especially because that would probably be a nightmare on the new OS, because the GCC that's ported over there is way to old to build LLVM and there is no practical way to upgrade it.

Thank You for the answer!

I must stick to LLVM 2.9 + LLVM-GCC for now, because I want to publish a maintenance release from a relatively old software which is based on that (Adobe FlashCC - targeting ActionScriptVirtualMacine2) - so I cannot upgrade LLVM to 3.4 without refactoring a huge part of the codebase. (I can compile it using GCC 4.8.2 on Windows - Cygwin)

I’ve only access to virtual machine resources but I’ll give a try recompiling libcxx after updating/maybe downgrading itself… Thanks for the tip again.