gpt4 book ai didi

ios - 使用 Xcode5.1 错误为 iOS 编译 libogg

转载 作者:行者123 更新时间:2023-11-28 22:10:17 25 4
gpt4 key购买 nike

环境:Mac OS X 10.9.2、Xcode 5.1。构建 shell 脚本如下:

#!/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”?它已经被创建。

已更新:新的和正确的 shell 脚本如下:

#!/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

您可能遇到了相对路径问题。使用安装根目录的完整路径通常更好(如果不是更容易的话)。

如果这是问题所在,您可以尝试的一件事是扩展路径并重试......例如

export INSTALL_ROOT=$(cd ../libogg-built/i386; pwd)
./configure ...
...
--prefix="${INSTALL_ROOT}"

如果有帮助,请告诉我们!配置脚本可能非常挑剔。

更新:没关系,在这种情况下我在第一次点击提交后才意识到要简单得多:

    CXX="xcrun --sdk iphonesimulator clang++ -arch $ARCH $IOSMV" \
./configure \
#--host=x86_64-apple-darwin \
--prefix=../$DESTDIR/$ARCH
;;

...当您在多行上继续执行命令时,您不能使用#-to-end-of-line 注释。只需删除 #--host=x86_64-apple-darwin\ 即可设置。

关于ios - 使用 Xcode5.1 错误为 iOS 编译 libogg,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23089404/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com