Having trouble building an ARM binary for iOS

  • From: Scott Graham <sgraham@xxxxxxxxx>
  • To: luajit <luajit@xxxxxxxxxxxxx>
  • Date: Mon, 25 Jun 2012 21:58:56 -0700

Hi,

I'm trying to build libluajit.a for an iOS device build, but I keep
getting a non-ARM library. When linking against it, I get:

ld: warning: ignoring file /Users/sgraham/luajit-2.0/src/libluajit.a,
file was built for archive which is not the architecture being linked
(armv7)

I tried to follow doc/install.html updated for 5.1 instead of 4.3, but
I'm not sure what I've done wrong. I tried both b10 and git HEAD.
Below are the only changes from git HEAD. Without -m32, buildvm
complained that there was a pointer size mismatch.

---
[master]sgraham@randall:~/luajit-2.0$ git diff
diff --git a/src/Makefile b/src/Makefile
index 6e0c746..6613f0a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -28,7 +28,7 @@ NODOTABIVER= 51
 CC= gcc
 #
 # Use this if you want to force a 32 bit build on a 64 bit multilib OS.
-#CC= gcc -m32
+CC= clang -m32
 #
 # Since the assembler part does NOT maintain a frame pointer, it's pointless
 # to slow down the C part by not omitting it. Debugging, tracebacks and
---

And, building with the following script:
---
[master]sgraham@randall:~/luajit-2.0$ cat iosbuild
#!/bin/bash

make clean

ISDK=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
\
ISDKVER=iPhoneOS5.1.sdk \
ISDKP=$ISDK/usr/bin/ \
ISDKF="-arch armv7 -m32 -isysroot $ISDK/SDKs/$ISDKVER" \
make HOST_CC="clang -m32 -arch i386" CROSS=$ISDKP
TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS amalg
---

I tried both clang and gcc also.

I'm sure there's something obvious I'm doing wrong here... if anyone
could point it out I would be grateful!

Thanks,
scott

Other related posts: