Last active
May 3, 2023 16:58
-
-
Save azk-mochi/a36a53c9eb9a63bb5b70cfe4e288b560 to your computer and use it in GitHub Desktop.
Cross-Compile to iOS (ARM64, iOS11)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#以下の設定でbison, nkf, sl, nyancatがビルドできた | |
#bison, nkf, sl, nyancat were successfully built with following settings: | |
export SDKROOT=$(xcrun --sdk iphoneos --show-sdk-path) | |
export VER_MIN=11.2 | |
export CC=$(xcrun --sdk iphoneos --find clang) | |
export CXX=$(xcrun --sdk iphoneos --find clang++) | |
export LD=$(xcrun --sdk iphoneos --find ld) | |
export AR=$(xcrun --sdk iphoneos --find ar) | |
export CPP="$(xcrun --sdk iphoneos -f clang) -E -D __arm__=1" | |
export CXXCPP="$(xcrun --sdk iphoneos -f clang++) -E -D __arm__=1" | |
export RANLIB=$(xcrun --sdk iphoneos --find ranlib) | |
export LIBTOOL=$(xcrun --sdk iphoneos --find libtool) | |
export STRIP=$(xcrun --sdk iphoneos --find strip) | |
export CFLAGS="-arch arm64 -isysroot $SDKROOT -miphoneos-version-min=$VER_MIN" | |
export CXXFLAGS=$CFLAGS | |
export LDFLAGS="-arch arm64 -isysroot $SDKROOT" | |
#なお,コンパイラはAppleClangである必要はない。普通のClangでも,オプションをちゃんと設定してやれば,クロスコンパイルできる。 | |
#その場合には,次の設定を使う。 | |
#ちゃんとAppleClangでないコンパイラをPATHに登録すること。PATHに刺しても,刺し方によっては優先順位が下になり,AppleClangが呼ばれてしまう場合がある。 | |
export SDKROOT=$(xcrun --sdk iphoneos --show-sdk-path) | |
export VER_MIN=11.2 | |
export CC=$(which clang) | |
export CXX=$(which clang++) | |
export LD=$(which ld) | |
export AR=$(which ar) | |
export CPP="$(which clang) -E -D __arm__=1" | |
export CXXCPP="$(which clang++) -E -D __arm__=1" | |
export RANLIB=$(which ranlib) | |
export LIBTOOL=$(which libtool) | |
export STRIP=$(which strip) | |
export CFLAGS="-arch arm64 -isysroot $SDKROOT -miphoneos-version-min=$VER_MIN" | |
export CXXFLAGS=$CFLAGS | |
export LDFLAGS="-arch arm64 -isysroot $SDKROOT" | |
../configure \ | |
--host=arm-apple-darwin \ | |
--target=arm-apple-darwin \ | |
--build=x86_64-apple-darwin17.7.0 \ | |
--prefix=$(pwd)/installdir | |
make -j8 | |
make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment