See also: Compile libogg for iOS using Xcode5.1 error
Environment: Mac OS X 10.9.2, Xcode 5.1.
There are two shell scripts to build libogg and libspeex, where locates in the same directory. The libogg build scripts is as below:
#!/bin/sh
set -xe
VERSION="1.3.1"
BUILDDIR=`pwd`
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
make distclean
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=$BUILDDIR/$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=$BUILDDIR/$DESTDIR/$ARCH
;;
esac
make
make install
done
make distclean
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
Run scripts in the terminal, and libogg was successfully compiled. Then Run the libspeex scripts as below:
#!/bin/sh
set -xe
VERSION="1.2rc1"
BUILDDIR=`pwd`
OGGDIR="libogg-built"
DESTDIR="libspeex-built"
LIBS="libspeex.a libspeexdsp.a"
ARCHS="i386 x86_64 armv7 armv7s arm64"
rm -rf $DESTDIR
mkdir $DESTDIR
if [ ! -e "speex-$VERSION.tar.gz" ]; then
curl -LO http://downloads.xiph.org/releases/speex/speex-$VERSION.tar.gz
fi
tar zxf speex-$VERSION.tar.gz
cd speex-$VERSION
./configure
for ARCH in $ARCHS;
do
mkdir -p ../$DESTDIR/$ARCH
make distclean
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=$BUILDDIR/$DESTDIR/$ARCH \
--with-ogg=$BUILDDIR/$OGGDIR/$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=$BUILDDIR/$DESTDIR/$ARCH \
--with-ogg=$BUILDDIR/$OGGDIR/$ARCH
;;
esac
make
make install
done
make distclean
cd ..
mkdir -p $DESTDIR/universal/lib
for LIB in $LIBS;
do
INPUT=""
for ARCH in $ARCHS;
do
INPUT="$INPUT $DESTDIR/$ARCH/lib/$LIB"
done
lipo -create $INPUT -output $DESTDIR/universal/lib/$LIB
done
It says that ./build-libspeex.sh: line 55: --with-ogg=/Users/Smeegol/Desktop/Speex/libogg-built/i386: No such file or directory
, why i386 cannot be located, it has been created at the previous step?!