Skip to content

Instantly share code, notes, and snippets.

@krestenkrab
Created September 23, 2011 14:40
Show Gist options
  • Save krestenkrab/1237521 to your computer and use it in GitHub Desktop.
Save krestenkrab/1237521 to your computer and use it in GitHub Desktop.
Configure protobuf library for iphone
export ARCH=i686-apple-darwin11
export ARCH_PREFIX=${ARCH}-
export PLATFORM=iPhoneSimulator
export SDKVER=4.3
export DEVROOT=/Developer/Platforms/${PLATFORM}.platform/Developer
export SDKROOT="$DEVROOT/SDKs/${PLATFORM}$SDKVER.sdk"
export PKG_CONFIG_PATH="$SDKROOT/usr/lib/pkgconfig:$DEVROOT/usr/lib/pkgconfig"
export AS="$DEVROOT/usr/bin/as"
export ASCPP="$DEVROOT/usr/bin/as"
export AR="$DEVROOT/usr/bin/ar"
export RANLIB="$DEVROOT/usr/bin/ranlib"
export CPP="$DEVROOT/usr/bin/cpp"
export CXXCPP="$DEVROOT/usr/bin/cpp"
export CC="$DEVROOT/usr/bin/${ARCH_PREFIX}llvm-gcc-4.2"
export CXX="$DEVROOT/usr/bin/${ARCH_PREFIX}llvm-g++-4.2"
export LD="$DEVROOT/usr/bin/ld"
export STRIP="$DEVROOT/usr/bin/strip"
export CPPFLAGS="-pipe -no-cpp-precomp -I$SDKROOT/usr/lib/gcc/${ARCH}/4.2.1/include -I$SDKROOT/usr/include -I$DEVROOT/usr/include"
export CFLAGS="-fmessage-length=0 -pipe -fpascal-strings -no-cpp-precomp -miphoneos-version-min=3.1.3 --sysroot='$SDKROOT' -isystem $SDKROOT/usr/lib/gcc/${ARCH}/4.2.1/include -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include"
export CXXFLAGS="$CFLAGS -I$SDKROOT/usr/include/c++/4.2.1/${ARCH}/v6"
export LDFLAGS="--sysroot='$SDKROOT' -L$SDKROOT/usr/lib -L$SDKROOT/usr/lib/system -L$DEVROOT/usr/lib"
./configure --with-protoc=protoc --enable-static --disable-shared
@fei17
Copy link

fei17 commented Oct 15, 2011

Hi,

I want to use Google protocol buffer in my App. This shell code is very helpful for me.
But I can't build success for iphone os.(I have change the ARCH=arm-apple-darwin10 and change the PLATFORM=iPhoneOS)

Can you help me?

Thx.

@fei17
Copy link

fei17 commented Oct 15, 2011

I'm success. Change
./configure --with-protoc=protoc --enable-static --disable-shared
go
./configure --host=${ARCH} --with-protoc=protoc --enable-static --disable-shared

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment