luajit2.1 iOS compilation 64bit and general purpose libraries

Source: Internet
Author: User

Apple requires the old app to support 64-bit after June, and the new app must support 64bit from 2.1 onwards. Since we used Luajit, the luajit2.0.x version only supports 32bit. 64bit has been supported in version 2.1, but it is now alpha version only. the following Luajit libraries support ARM64,ARMV7 and emulators after compilation. That is, a library supports all CPUs compiled by 64bit, and does not require special treatment for the new and old iphone.

Download Luajitdownload Luajit code from git
git clone http://repo.or.cz/luajit-2.0.git
go to luajit download code catalog Check out branch v2.1
git checkout v2.1

Compiling ScriptsRun on the previous level of the luajit-2.0 directory
Luajit=./luajit-2.1devdir= ' Xcode-select-print-path '/platformsiosver=iphoneos8.1.sdksimver= iphonesimulator.sdkiosdir= $DEVDIR/iphoneos.platform/developersimdir= $DEVDIR/iphonesimulator.platform/ Developeriosbin= $DEVDIR/.. /usr/bin/simbin= $SIMDIR/usr/bin/build_dir= $LUAJIT/buildrm-rf $BUILD _dirmkdir-p $BUILD _dirrm *.a 1>/dev/null 2 >/dev/nullecho =================================================echo ARMV7 architectureisdkf= "-arch armv7- Isysroot $IOSDIR/sdks/$IOSVER "Make-j-C $LUAJIT host_cc=" Gcc-m32 "cross= $IOSBIN target_flags=" $ISDKF "Target=armv7 TAR  Get_sys=ios Cleanmake-j-C $LUAJIT host_cc= "Gcc-m32" cross= $IOSBIN target_flags= "$ISDKF" Target=armv7 target_sys=ios MV $LUAJIT/src/libluajit.a $BUILD _dir/libluajita7.aecho =================================================echo ARM64 architectureisdkf= "-arch arm64-isysroot $IOSDIR/sdks/$IOSVER" Make-j-C $LUAJIT host_cc= "gcc" cross= $IOSBIN target_ flags= "$ISDKF" target=arm64 target_sys=ios cleanmake-j-C $LUAJIT host_cc= "GCC" CRoss= $IOSBIN target_flags= "$ISDKF" target=arm64 target_sys=ios mv $LUAJIT/src/libluajit.a $BUILD _dir/ Libluajit64bit.aecho =================================================echo IOS Simulator architectureisdkf= "-arch X86_64-isysroot $SIMDIR/sdks/$SIMVER-miphoneos-version-min=7.0 "Make-j-C $LUAJIT host_cflags="-arch x86_64 "HOST_ ldflags= "-arch x86_64" Target_sys=ios target=x86_64 cleanmake-j-C $LUAJIT host_cflags= "-arch x86_64" HOST_LDFLAGS= "- Arch x86_64 "Target_sys=ios target=x86_64 amalg cross= $SIMBIN target_flags=" $ISDKF "mv $LUAJIT/src/libluajit.a $BUILD _ Dir/libluajitx86_64.alibtool-o $BUILD _dir/libluajit21.a $BUILD _dir/*.a 2>/dev/nullmkdir-p $BUILD _DIR/HEADERSCP $ Luajit/src/lua.h $BUILD _dir/headerscp $LUAJIT/src/lauxlib.h $BUILD _dir/headerscp $LUAJIT/src/lualib.h $BUILD _dir/ HEADERSCP $LUAJIT/src/luajit.h $BUILD _dir/headerscp $LUAJIT/src/lua.hpp $BUILD _dir/headerscp $LUAJIT/src/luaconf.h $ BUILD_DIR/HEADERSMV $BUILD _dir/libluajit21.a. /lib/ios


Note When compiling the emulator library: isdkf= "-arch x86_64-isysroot $SIMDIR/sdks/$SIMVER-miphoneos-version-min=7.0"
Above the Red Font section, this section is mainly used to compile the emulator's Luajit library. Because of the changes after xcode5.0, it must be specified in this way to compile to the emulator library, otherwise it is compiled by default to MacOS. I've been tossing around here for a long time.
Integrated
link the libluajit21.a in the Luajit/build directory to the project.

because iphone5s above virtual machines need x86_64 support, Luajit in order to support this mode requires the Other linker flags Add parameters in

-pagezero_size 10000-image_base 100000000

Possible traps

1: Currently Luajit 2.1 is Alpha version, there is no big bug unclear

2: in the arm64 platform under the Luajit bytecode with the earlier bytecode has the difference cannot directly under the Mac compiles after the Arm64 platform uses. It uses the latest LJ_GC64 and LJ_FR2. So LUA code compiled directly from MacOS cannot run on iOS. Need to upload source code to compile under iOS



luajit2.1 iOS compilation 64bit and common libraries

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.