On 1 Nov, 16:39, Marcus Better <mar...@better.se> wrote:
> I wonder if anyone has built libprotobuf-lite for the iOS, and if
> there are any special pitfalls?

Yes I have, and of course I will share my findings with the world for
the benefit of mankind.

I also have a follow-up question: the libprotobuf-lite.a static
library is about 500 kB which seems a little heavy. Is this normal?
I've tried to strip the symbol information but maybe that didn't
succeed.

We're using iOS SDK 4.0 with the PLBlocks compiler. The script needs
some adjustments if you are not using PLBlocks.

This produces the ARM library:

-----------------------------------------
export ARCH=arm-apple-darwin10
export ARCH_PREFIX=$ARCH-
export PLATFORM=iPhoneOS

export SDKVER="4.0"
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/arm-apple-darwin10-llvm-gcc-4.2"
PLBLOCKS="/Developer/Library/PLBlocks/Compilers/gcc42-iphoneos3.2"
export CC="$PLBLOCKS/usr/bin/${ARCH_PREFIX}gcc-4.2.1"
#export CXX="$DEVROOT/usr/bin/arm-apple-darwin10-llvm-g++-4.2"
export CXX="$PLBLOCKS/usr/bin/${ARCH_PREFIX}g++-4.2.1"
#export LD="$DEVROOT/usr/bin/ld"
export LD="$PLBLOCKS/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$DEVROOT/usr/
lib"

./configure --host=${ARCH} --with-protoc=protoc --enable-static --
disable-shared
------------------------------

And the i386 version for the simulator:
---------------------------------------
export ARCH=i686-apple-darwin10
export ARCH_PREFIX=${ARCH}-
export PLATFORM=iPhoneSimulator

export SDKVER="4.0"
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/arm-apple-darwin10-llvm-gcc-4.2"
PLBLOCKS="/Developer/Library/PLBlocks/Compilers/gcc42-macosx10.6"
export CC="$PLBLOCKS/usr/bin/${ARCH_PREFIX}gcc-4.2.1"
#export CXX="$DEVROOT/usr/bin/arm-apple-darwin10-llvm-g++-4.2"
export CXX="$PLBLOCKS/usr/bin/${ARCH_PREFIX}g++-4.2.1"
#export LD="$DEVROOT/usr/bin/ld"
export LD="$PLBLOCKS/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$DEVROOT/usr/
lib"

./configure --with-protoc=protoc --enable-static --disable-shared
------------------------------------------------------------------

Cheers,

Marcus

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to