How to build fat libclang

837 Views Asked by At

I am able to build llvm and clang on my OSX following this tutorial: http://clang.llvm.org/docs/LibASTMatchersTutorial.html
I use cmake with ninja for this.

then I can find my libclang.3.6.dylib under
<path_to_llvm>/build/lib/libclang.3.6.dylib. The problem is that library is not fat. I mean that it built for x86_64 only. I can verify this with:
lipo -info libclang.3.6.dylib

This produces:
Non-fat file: lib/libclang.3.6.dylib is architecture: x86_64

But I also need i386

I have a few questions:

  • How to build fat (x86_64 + i386) libclang.dylib and libclang.a ?
  • Is it possible to build just these libraries without rebuilding whole llvm, clang, tools etc (whole build takes a few hours on my machine) ?
1

There are 1 best solutions below

0
On

Additional argument to cmake "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" did the trick. I guess this works only for OSX.

Now if I run lipo, I will receive desired output.
lipo -info lib/libclang.3.6.dylib Architectures in the fat file: lib/libclang.3.6.dylib are: x86_64 i386

But I still have to recompile whole llvm/clang project (takes a few hours)