[protobuf] Re: building libprotobuf-lite for iPhone

2012-08-22 Thread Stefan Misslinger
Here's my version, using iOS SDK 5.1:

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

export SDKVER=5.1 
export 
DEVROOT=/Applications/Xcode.app/Contents/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/c++ 
#export CXXCPP=$DEVROOT/usr/bin/c++ 
export CC=$DEVROOT/usr/bin/gcc 
export CXX=$DEVROOT/usr/bin/g++ 
export LD=$DEVROOT/usr/bin/ld 
export STRIP=$DEVROOT/usr/bin/strip 
export LIBRARY_PATH=$SDKROOT/usr/lib

export CPPFLAGS= 
export CFLAGS=-arch armv7 -fmessage-length=0 -pipe -fpascal-strings 
-miphoneos-version-min=4.0 -isysroot=$SDKROOT -I$SDKROOT/usr/include 
-I$SDKROOT/usr/include/c++/4.2.1/ 
export CXXFLAGS=$CFLAGS 
export LDFLAGS=-isysroot='$SDKROOT' -L$SDKROOT/usr/lib/system 
-L$SDKROOT/usr/lib/

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




On Monday, November 1, 2010 4:39:27 PM UTC+1, Marcus Better wrote:

 Hi, 

 I wonder if anyone has built libprotobuf-lite for the iOS, and if 
 there are any special pitfalls? 

 Cheers, 

 Marcus

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/QENKClHm36oJ.
To post to this group, send email to protobuf@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.



[protobuf] Re: building libprotobuf-lite for iPhone

2010-11-23 Thread Marcus Better
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.



Re: [protobuf] Re: building libprotobuf-lite for iPhone

2010-11-23 Thread Kenton Varda
On Tue, Nov 23, 2010 at 3:47 AM, Marcus Better mar...@better.se wrote:

 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.


Last I checked it was more like 100k on gcc/x86/linux, but on another
compiler/arch/platform I suppose anything could happen.  Note that if you
don't use extensions, you can drop extension_set.cc from the library which
saves a considerable amount of binary size.


 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.comprotobuf%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/protobuf?hl=en.



-- 
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.