使用Xcode5.1错误为iOS编译libogg [英] Compile libogg for iOS using Xcode5.1 error
问题描述
环境:Mac OS X 10.9.2,Xcode 5.1.构建shell脚本,如下所示:
Environment: Mac OS X 10.9.2, Xcode 5.1. Build shell scripts as below:
#!/bin/sh
set -xe
VERSION="1.3.1"
DESTDIR="libogg-built"
#ARCHS="i386 x86_64 armv7 armv7s arm64"
rm -rf $DESTDIR
mkdir $DESTDIR
if [ ! -e "libogg-$VERSION.zip" ]; then
curl -LO http://downloads.xiph.org/releases/ogg/libogg-$VERSION.zip
fi
unzip -oq libogg-$VERSION.zip
cd libogg-$VERSION
./configure
for ARCH in $ARCHS;
do
mkdir -p ../$DESTDIR/$ARCH
IOSMV="-miphoneos-version-min=4.3"
case $ARCH in
arm*)
if [ $ARCH == "arm64" ]; then
IOSMV="-miphoneos-version-min=7.0"
fi
PATH=`xcodebuild -version -sdk iphoneos PlatformPath`"/Developer/usr/bin:$PATH" \
SDK=`xcodebuild -version -sdk iphoneos Path` \
CC="xcrun --sdk iphoneos clang -arch $ARCH $IOSMV --sysroot=$SDK -isystem $SDK/usr/include" \
CXX="xcrun --sdk iphoneos clang++ -arch $ARCH $IOSMV --sysroot=$SDK -isystem $SDK/usr/include" \
LDFLAGS="-Wl,-syslibroot,$SDK" \
./configure \
#--host=arm-apple-darwin \
--prefix=../$DESTDIR/$ARCH
;;
*)
PATH=`xcodebuild -version -sdk iphonesimulator PlatformPath`"/Developer/usr/bin:$PATH" \
#SDK=`xcodebuild -version -sdk iphonesimulator Path` \
CC="xcrun --sdk iphonesimulator clang -arch $ARCH $IOSMV" \
CXX="xcrun --sdk iphonesimulator clang++ -arch $ARCH $IOSMV" \
./configure \
#--host=x86_64-apple-darwin \
--prefix=../$DESTDIR/$ARCH
;;
esac
make
make install
make clean
done
cd ..
mkdir -p ${DESTDIR}/universal/lib
INPUT=""
for ARCH in $ARCHS;
do
INPUT="$INPUT $DESTDIR/$ARCH/lib/libogg.a"
done
lipo -create $INPUT -output $DESTDIR/universal/lib/libogg.a
但是终端会记录:
+ VERSION=1.3.1
+ DESTDIR=libogg-built
+ ARCHS=i386
+ rm -rf libogg-built
+ mkdir libogg-built
+ '[' '!' -e libogg-1.3.1.zip ']'
+ unzip -oq libogg-1.3.1.zip
+ cd libogg-1.3.1
+ ./configure
+ for ARCH in '$ARCHS'
+ mkdir -p ../libogg-built/i386
+ IOSMV=-miphoneos-version-min=4.3
+ case $ARCH in
++ xcodebuild -version -sdk iphonesimulator PlatformPath
+ PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/opt/local/bin:/opt/local/sbin:/Users/Smeegol/.rbenv/shims:/Users/Smeegol/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
+ CC='xcrun --sdk iphonesimulator clang -arch i386 -miphoneos-version-min=4.3'
+ CXX='xcrun --sdk iphonesimulator clang++ -arch i386 -miphoneos-version-min=4.3'
+ ./configure
+ --prefix=../libogg-built/i386
./build-libogg2.sh: line 55: --prefix=../libogg-built/i386: No such file or directory
为什么"--prefix=../libogg-built/i386: No such file or directory
"?它已经被创建.
Why "--prefix=../libogg-built/i386: No such file or directory
"? It already have been created.
已更新:以下是新的正确的Shell脚本:
Updated: New and correct shell script as below:
#!/bin/sh
set -xe
VERSION="1.3.1"
DESTDIR="libogg-built"
ARCHS="i386 x86_64 armv7 armv7s arm64"
rm -rf $DESTDIR
mkdir $DESTDIR
if [ ! -e "libogg-$VERSION.zip" ]; then
curl -LO http://downloads.xiph.org/releases/ogg/libogg-$VERSION.zip
fi
unzip -oq libogg-$VERSION.zip
cd libogg-$VERSION
./configure
for ARCH in $ARCHS;
do
mkdir -p ../$DESTDIR/$ARCH
IOSMV="-miphoneos-version-min=4.3"
case $ARCH in
arm*)
if [ $ARCH == "arm64" ]; then
IOSMV="-miphoneos-version-min=7.0"
fi
PATH=`xcodebuild -version -sdk iphoneos PlatformPath`"/Developer/usr/bin:$PATH" \
SDK=`xcodebuild -version -sdk iphoneos Path` \
CC="xcrun --sdk iphoneos clang -arch $ARCH $IOSMV --sysroot=$SDK -isystem $SDK/usr/include" \
CXX="xcrun --sdk iphoneos clang++ -arch $ARCH $IOSMV --sysroot=$SDK -isystem $SDK/usr/include" \
LDFLAGS="-Wl,-syslibroot,$SDK" \
./configure \
--host=arm-apple-darwin \
--prefix=../$DESTDIR/$ARCH
;;
*)
PATH=`xcodebuild -version -sdk iphonesimulator PlatformPath`"/Developer/usr/bin:$PATH" \
CC="xcrun --sdk iphonesimulator clang -arch $ARCH $IOSMV" \
CXX="xcrun --sdk iphonesimulator clang++ -arch $ARCH $IOSMV" \
./configure \
--prefix=../$DESTDIR/$ARCH
;;
esac
make
make install
make clean
done
cd ..
mkdir -p $DESTDIR/universal/lib
INPUT=""
for ARCH in $ARCHS;
do
INPUT="$INPUT $DESTDIR/$ARCH/lib/libogg.a"
done
lipo -create $INPUT -output $DESTDIR/universal/lib/libogg.a
推荐答案
--prefix=../$DESTDIR/$ARCH
您可能相对路径有问题.通常,最好使用(如果不是更简单的话)使用安装根目录的完整路径.
You are likely having an issue with the relative path. It's generally better (if not easier) to use the full path to your install root.
如果这是问题所在,您可以尝试的一件事是扩展路径并重试...例如.
One thing you can try, if this is the issue, is to expand the path and try again ... for e.g.
export INSTALL_ROOT=$(cd ../libogg-built/i386; pwd)
./configure ...
...
--prefix="${INSTALL_ROOT}"
让我们知道是否有帮助!配置脚本可能非常挑剔.
Let us know if that helps! Configure scripts can be very finicky.
更新:没关系,在这种情况下,我在第一次点击提交"后才意识到这一点要简单得多:
Update: Nevermind, it's much more simpler in this case I just realized after hitting submit the first time:
CXX="xcrun --sdk iphonesimulator clang++ -arch $ARCH $IOSMV" \
./configure \
#--host=x86_64-apple-darwin \
--prefix=../$DESTDIR/$ARCH
;;
...当您在多行上继续执行命令时,不能在行尾添加#注释.只需删除#--host=x86_64-apple-darwin \
,就应该设置好了.
... you cannot have an #-to-end-of-line comment when you are continuing a command onto multiple lines. Just remove #--host=x86_64-apple-darwin \
and you should be set.
这篇关于使用Xcode5.1错误为iOS编译libogg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!