17

I need to use libclang in an iOS app (for diagnostics and syntax highlighting) but I can't seem to figure out how to build it as is, let alone for iOS. Using CMake I generated an Xcode project for LLVM, but Xcode ran out of memory and disk space for swap (a combined 25GB!) and crashed while opening the project. I need to get a static library out of it, and then I can manually import the headers, which shouldn't be a problem. What configure/make/cmake command [combinations] would I need to run?

Note: I only need the functions in the Index.h file if it makes any difference.

Thanks in advance.

Josh The Geek
  • 1,203
  • 12
  • 24

2 Answers2

6

I have created a series of articles for building clang.

You'll have some additional challenges building for iOS, but this would be a starting point.

Stuart Carnie
  • 5,458
  • 1
  • 29
  • 27
  • @corristo When compiling with the flags below and in this answer, I get the error `/Users/josh/Documents/xcode/iCode/libclang/build/llvm-build-make/include/llvm/Support/DataTypes.h:36:10: fatal error: 'cmath' file not found` when building LLVM with make. Any suggestions? I'm lost as to why. Some Google-ing says that [it goes away after building a few times](http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-March/020366.html), but that didn't work for me. – Josh The Geek Aug 01 '12 at 22:35
  • looks like DataTypes.h included in non-c++ file so it can't find c++-specific include =\ Strange, does it build ok for OS X? – Nikolay Kasyanov Aug 07 '12 at 07:53
  • @JoshTheGeek Since you accepted this answer, did these instructions help you do successfully compile Clang for armv7? –  Aug 10 '12 at 16:31
  • I'm trying to do pretty the same, but i'm having strange behaviour: http://stackoverflow.com/questions/24045633/dyld-library-not-loaded-error Were you able to do it finally? – 4ntoine Jun 18 '14 at 11:55
2

generate simple makefiles instead os Xcode project and then build using make?

Use this one to configure cmake/make build to build for iOS: How can I make Cmake use specific compiler and flags when final compilation stage instead of detection?

Community
  • 1
  • 1
Nikolay Kasyanov
  • 897
  • 5
  • 14