On Mon, Jun 25, 2012 at 10:33 PM, Dimiter 'malkia' Stanev <malkia@xxxxxxxxx> wrote: > On 6/25/2012 9:58 PM, Scott Graham wrote: > > 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 > > Can you try this one: > > DEVDIR=`xcode-select -print-path`/Platforms > IOSVER=iPhoneOS5.1.sdk > SIMVER=iPhoneSimulator5.1.sdk > IOSDIR=$DEVDIR/iPhoneOS > .platfor > m/Developer > SIMDIR=$DEVDIR/iPhoneSimulator.platform/Developer > IOSBIN=$IOSDIR/usr/bin/ > SIMBIN=$SIMDIR/usr/bin/ > > make -j -C $LUAJIT BUILDMODE=static HOST_CFLAGS="-arch i386" > HOST_LDFLAGS="-arch i386" TARGET_SYS=iOS LUAJIT_SO=libluajit.dylib > TARGET=arm amalg CROSS=$IOSBIN TARGET_FLAGS="-isysroot $IOSDIR/SDKs/$IOSVER > -arch armv7" > Ah, oops! I "helpfully" put continuation characters at the end of the lines, I'm not sure why I did that. Much closer now! I'm getting some missing symbols now: Undefined symbols for architecture armv7: "___aeabi_cdcmple", referenced from: _lj_BC_ISLT in libluajit.a(lj_vm.o) _lj_BC_ISGE in libluajit.a(lj_vm.o) ... "___aeabi_ddiv", referenced from: ... "___aeabi_dsub", referenced from: _lj_BC_SUBVN in libluajit.a(lj_vm.o) _lj_BC_SUBNV in libluajit.a(lj_vm.o) _lj_BC_SUBVV in libluajit.a(lj_vm.o) _lj_vm_foldarith in libluajit.a(lj_vm.o) "___aeabi_i2d", referenced from: and similar. Looks like those are in libgcc, so I guess my clang-link isn't including that. Linking against a random copy of libgcc.a seems to work... is there a better solution for that? Thanks for your help. scott