[cfe-dev] static fat libclang library for iOS (device & simulator)

Robert Vojta robert at tapmates.com
Wed Jul 18 07:06:12 PDT 2012


Hallo all,  

I'm trying to build libclang as a fat static library for iOS (device & simulator), but I'm still facing several problems. Here's my build script under development:

http://dl.dropbox.com/u/13929547/apple/build.sh

1. iPhone Simulator

I managed to build static libclang for iPhone Simulator (i386-apple-darwin). But even when I use --enable-shared=no it produces libclang.a, which depends on other llvm:: … functions. Temporary solution was to add all produced .a libraries to my project (better solution later). But when I call clang_parseTranslationUnit it stops working, because it shows a warning that some symbols are not available on iPhone Simulator (didn't tell me which one).

2. iOS Device

Here I'm not able to compile it for armv7-apple-darwin and it always produces x86_64 builds. It always switches target to i686-apple-darwin11.

Is there anyone who managed to build static fat libclang library for iOS without any other dependencies (= everything needed is inside this library) and this library is suitable for both i386 & armv7.

Why I'm doing this? We're working on editor for iPad and we do want to use libclang for syntax highlighting only. We just want to test how it behaves on iPad, how fast it is, etc.

I can fix iPhone Simulator issues I've got by myself, but this cross compilation is kind of hell with this beast.

Many thanks in advance for any help to get this library ready,
R.

Here's the configure log output, which says that it's going to use i686, thus not cross compiling …

## ----------- ##
## Core tests. ##
## ----------- ##

configure:1973: checking for armv7-apple-darwin-clang
configure:2000: result: /Applications/Xcode45-DP3.app/Contents/Developer/usr/bin/llvm-gcc
configure:2080: checking for C compiler version
configure:2087: /Applications/Xcode45-DP3.app/Contents/Developer/usr/bin/llvm-gcc --version >&5
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2090: $? = 0
configure:2097: /Applications/Xcode45-DP3.app/Contents/Developer/usr/bin/llvm-gcc -v >&5
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~36/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc
,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~36/dst-llvmCore/Developer/usr/lo
cal --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
configure:2100: $? = 0
configure:2107: /Applications/Xcode45-DP3.app/Contents/Developer/usr/bin/llvm-gcc -V >&5
llvm-gcc-4.2: argument to `-V' is missing
configure:2110: $? = 1
configure:2133: checking for C compiler default output file name
configure:2160: /Applications/Xcode45-DP3.app/Contents/Developer/usr/bin/llvm-gcc    conftest.c  >&5
configure:2163: $? = 0
configure:2209: result: a.out
configure:2214: checking whether the C compiler works
configure:2224: ./a.out
configure:2227: $? = 0
configure:2244: result: yes
configure:2251: checking whether we are cross compiling
configure:2253: result: no

...

--  
Robert Vojta
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120718/049ac3b0/attachment.html>


More information about the cfe-dev mailing list