3

I'm currently trying to install the lib++.1.dylib on my mac. I followed the instructions here http://libcxx.llvm.org/ and downloaded the source. When I tried to ./buildit I encountered a clang++: command not found error.

So I went here http://clang.llvm.org/get_started.html and installed clang. Unfortunately now when I went back to installing libcxx, I still got the clang++ error. Clang itself works as clang --help brings up the help menu.

Installing Xcode isn't an option as I am runnning 10.6.8.

How do I proceed i.e. get the clang++ command to work?

rwolst
  • 12,904
  • 16
  • 54
  • 75

2 Answers2

1

There is an instruction for build libc++ on 10.6 in github https://github.com/llvm-mirror/libcxx/tree/apple

To build on Mac OS X 10.6, you need a helper library and header found here. cp cxxabi.h to /usr/include, and cp libc++abi.dylib to /usr/lib.

Next:

cd libcxx/lib

export TRIPLE=-apple-

./buildit

That should result in a libc++.1.dylib. To install it I like to use links instead of copying, but either should work:

cd /usr/lib

sudo ln -sf path-to-libcxx/lib/libc++.1.dylib libc++.1.dylib

sudo ln -sf libc++.1.dylib libc++.dylib

cd /usr/include/c++

sudo ln -sf path-to-libcxx/include v1

Link in instruction not work. The libcppabi for 10.6 You can download on this link http://www.mediafire.com/download/2aq37hc97n4f47c/libcppabi.zip

ERET1K
  • 131
  • 2
  • Please explain your answer – adao7000 Jul 31 '15 at 12:12
  • 2
    I'd be wary of downloading from random sites like Mediafire where anyone can upload anything. – RJHunter Jul 31 '15 at 12:16
  • 1
    Per @RJHunter, the libcppabi from Apple's own Open Source repository for Mac OS X may be a better choice than MediaFire: http://www.opensource.apple.com/tarballs/libcppabi/libcppabi-14.tar.gz Other versions can be found by traversing from the top-level of that site: http://www.opensource.apple.com/ – mormegil Sep 08 '15 at 19:00
-1

It is a fairly complex process to build libc++ on Mac 10.6, as it needs libc++abi to be present, which didn't ship with 10.6. So the working steps are as follow:

  • Build Clang.
  • Use this Clang to build libc++abi.
    • You have to make sure libc++abi and its header are properly placed so that in the next step in can be found.
  • Then use this Clang to build libc++ and link to this libc++abi.

Also note if you are using Clang 3.3 instead of the latest development trunk, you will also need this patch (http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?r1=172666&r2=189535&view=patch) to unwind.h so that libc++abi can be built properly.

I have tested a working process and updated the homebrew-version formula so it works in homebrew out-of-the-box. You can check the details at https://github.com/Homebrew/homebrew-versions/blob/master/llvm33.rb. Hope this helps.

manphiz
  • 191
  • 3
  • 8