Compile libspeex for iOS using Xcode5.1 error

情到浓时终转凉″ 提交于 2019-12-08 05:30:34

问题


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?!


回答1:


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?!

It references /Users/Smeegol/Desktop/Speex/libogg-built/i386, and yet in the previous step ...

lipo -create $INPUT -output $DESTDIR/universal/lib/libogg.a

... I see universal in the path name, for one.

Your output directory for the libogg install should look something like this:

${OGGDIR}/lib/libogg.a
${OGGDIR}/include/<include files here>

And finally, you have a similar error to your other question:

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

... you are missing a "\" after the --prefix line.




回答2:


You can refer to https://github.com/firstfan/libspeex-iOS

It compiles OK with latest SDK and latest speex code

It works out-of-box.



来源:https://stackoverflow.com/questions/23104759/compile-libspeex-for-ios-using-xcode5-1-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!