How to create a protocol buffer for iOS7?

I want to rebuild the staticlib protocol buffer in xcode5,
 load the protocol buffer in http://code.google.com/p/protobuf/downloads/list use autogen.sh, I get the configuration file, I can do and install on mac, I write the shell The script will try to build glib for iOS, as a hit:

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

export SDKVER=7.0
export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer
export SDKROOT="$DEVROOT/SDKs/${PLATFORM}$SDKVER.sdk"

export Toolchains=/Applications/Xcode.app/Contents/Developer/Toolchains
export XcodeClangBin="$Toolchains/XcodeDefault.xctoolchain/usr/bin"
export XcodeCpp="$Toolchains/XcodeDefault.xctoolchain/usr/bin/cpp"

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="$XcodeCpp"
export CXXCPP="$XcodeCpp"
export CC="$XcodeClangBin/clang"
export CXX="$XcodeClangBin/clang++"
export LD="$DEVROOT/usr/bin/ld"
export STRIP="$DEVROOT/usr/bin/strip"

export CPPFLAGS="-pipe -no-cpp-precomp -I$SDKROOT/usr/include"
export CFLAGS="-arch armv7 -arch armv7s -fmessage-length=0 -pipe -fpascal-strings -no-cpp-precomp -miphoneos-version-min=5.0 --sysroot='$SDKROOT' -isystem $SDKROOT/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"

./configure --host=${ARCH} --with-protoc=protoc --enable-static --disable-shared --prefix=/tmp/protobuf/arm
make clean
make
make check
make install

When I run this script, return as:

#error Unsupported architecture

What can I do?

in ios6, xcode 4.6, I can use this configuration file to build, but in xcode5, llvm-gcc deleted, I use clang to replace it, but failed.

in ios6 use this

export CPP="$DEVROOT/usr/bin/llvm-cpp-4.2"
export CXXCPP="$DEVROOT/usr/bin/llvm-cpp-4.2"
+2
source share
3 answers

bash script, Protobuf iOS 7. script .

https://gist.github.com/BennettSmith/7150245

script Google Protobuf, i386, armv7, armv7s, arm64 x86_64. , . protoc OS X.

+2

export CPP="$XcodeCpp"
export CXXCPP="$XcodeCpp"

-isysroot -arch

export CPPFLAGS="-pipe -no-cpp-precomp -I$SDKROOT/usr/include"
0

script , protobuf , (armv7, armv7s..etc) OSX build protobuf 64- 32- . ios, .

:

  • configure , proto buffer (./configure, make make install).

  • protobuf, " protoc -version" . protoc , . , protobuf "/usr/local/bin/protoc". , protoc - -protoc .

  • , protobuffer script, *. sh.

    XCODEDIR = xcode-select --print-path

    OSX_SDK = $(xcodebuild -showsdks | grep macosx | sort | head -n 1 | awk '{print $NF}') IOS_SDK = $(xcodebuild -showsdks | grep iphoneos | sort | head -n 1 | awk '{print $NF}') SIM_SDK = $(xcodebuild -showsdks | grep iphonesimulator | sort | head -n 1 | awk '{print $NF}')

    MACOSX_PLATFORM = ${XCODEDIR}/Platforms/MacOSX.platform MACOSX_SYSROOT = ${MACOSX_PLATFORM}//${OSX_SDK}.sdk

    IPHONEOS_PLATFORM = ${XCODEDIR}/Platforms/iPhoneOS.platform IPHONEOS_SYSROOT = ${IPHONEOS_PLATFORM}/Developer/SDKs/iPhoneOS8.1.sdk

    IPHONESIMULATOR_PLATFORM = ${XCODEDIR}/Platforms/iPhoneSimulator.platform IPHONESIMULATOR_SYSROOT = ${IPHONESIMULATOR_PLATFORM}//SDKs/${SIM_SDK}.sdk

    PREFIX = " "

    CC = CFLAGS = "- DNDEBUG -g -O0 -pipe -fPIC -fcxx-exceptions" CXX = CXXFLAGS = "$ {CFLAGS} -std = ++ 11 -stdlib = lib++" LDFLAGS = "- STDLIB = Lib++" LIBS = "- l++ -l++ abi"

    ./configure --build = x86_64-apple-darwin13.0.0 --host = armv7-apple-darwin13.0.0 --with-protoc = protoc --disable-shared --prefix = ${PREFIX} - exec-prefix = ${PREFIX}/platform/armv7 "CC = ${CC}" "CFLAGS = ${CFLAGS} -miphoneos-version-min = 8.0 -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" "CXX = ${ CXX}" "CXXFLAGS = ${CXXFLAGS} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS = "- arch armv7 -miphoneos-version-min = 8.0 ${LDFLAGS}" "LIBS = ${LIBS}"

  • make .

  • Now you will have a new library libprotobuf.a in the $ {PREFIX} / platform / arvm7 / lib folder , which you must have in your xcode project to compile the file created by the C ++ duct.

0
source

All Articles