Unable to compile LAME for iOS

I am trying to compile lame mp3 encoder as a static library for iOS. I would like to support all architectures including i686, armv6, armv7, armv7s and arm64. Here is my build script:

#!/bin/bash
DEVELOPER=`xcode-select -print-path`
SDK_VERSION="7.1"
mkdir build
function build_lame()
{
    make distclean
    ./configure \
    CFLAGS="-isysroot ${DEVELOPER}/Platforms/${SDK}.platform/Developer/SDKs/${SDK}${SDK_VERSION}.sdk" \
    CC="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch ${PLATFORM} -miphoneos-version-min=7.0 " \
    --prefix=/Users/mcrute/Desktop/lame \
    --host="arm-apple-darwin9" \
    --disable-shared \
    --enable-static \
    --disable-decoder \
    --disable-frontend

make -j4
cp "libmp3lame/.libs/libmp3lame.a" "build/libmp3lame-${PLATFORM}.a"
}
SDK="iPhoneSimulator"
PLATFORM="i686"
build_lame
SDK="iPhoneOS"
PLATFORM="armv6"
build_lame
PLATFORM="armv7"
build_lame
PLATFORM="armv7s"
build_lame
PLATFORM="arm64"
build_lame
lipo -create build/* -output build/libmp3lame.a

      

So the error looks like this:

configure: error: in `/Users/ivan/Desktop/lame-3.99.5':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
make: *** No targets specified and no makefile found.  Stop.
cp: libmp3lame/.libs/libmp3lame.a: No such file or directory

      

Here is my config.log. | tried to remove arm64 from build targets but the script also failed with the same error. Google said I don't have gcc, but I have .. Looking for any suggestion!

+3


source to share


2 answers


The problem was solved by adding the CPP = "*" variable inside the configure function. CPP was missing in my env. The edited assembly script should look like this:



#!/bin/bash

DEVELOPER=`xcode-select -print-path`

SDK_VERSION="7.1"

mkdir build

function build_lame()
{
    make distclean

    ./configure \
    CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cpp" \
    CFLAGS="-isysroot ${DEVELOPER}/Platforms/${SDK}.platform/Developer/SDKs/${SDK}${SDK_VERSION}.sdk" \
    CC="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch ${PLATFORM} -miphoneos-version-min=7.0 " \
    --prefix=/Users/ivan/Desktop/lame-3.99.5 \
    --host="arm-apple-darwin9" \
    --disable-shared \
    --enable-static \
    --disable-decoder \
    --disable-frontend

    make -j4
    cp "libmp3lame/.libs/libmp3lame.a" "build/libmp3lame-${PLATFORM}.a"
}

PLATFORM="i686"
SDK="iPhoneSimulator"
build_lame

PLATFORM="armv6"
SDK="iPhoneOS"
build_lame

PLATFORM="armv7"
build_lame

PLATFORM="armv7s"
build_lame

PLATFORM="arm64"
build_lame

lipo -create build/* -output build/libmp3lame.a

      

+1


source


From comment to answer.

For some reason

CPP

a very strange value is being given for some reason.



You manually set CC

in the config line to the path inside XcodeDefault

.

Try setting CPP

in the configure call for the appropriate binary CPP

inside XcodeDefault

.

0


source







All Articles