protobuf2.6.1海思平台交叉编译

一、下载protobuf2.6.1

源码地址:https://github.com/google/protobuf/releases

二、编译pc版本

1.解压protobuf-2.6.1.tar.gz

2.配置参数,本人只指定了安装目录/home/work/protobuf/pc_protobuf

./configure --prefix=/home/work/protobuf/pc_protobuf

3.make 

4.make install 

这样我们在/home/work/protobuf/pc_protobuf看见编译成功的三个文件夹。

三、编译海思版本

1.配置参数

./configure --host=arm-linux CC=arm-hisiv200-linux-gcc CXX=arm-hisiv200-linux-g++ --with-protoc=/home/work/protobuff/pc_protobuf/bin/protoc --prefix=/home/work/protobuff/arm_protobuf/

特别注意:--with-protoc的配置

/*
**Note for cross-compiling**

  The makefiles normally invoke the protoc executable that they just
  built in order to build tests.  When cross-compiling, the protoc
  executable may not be executable on the host machine.  In this case,
  you must build a copy of protoc for the host machine first, then use
  the --with-protoc option to tell configure to use it instead.  For
  example:

    ./configure --with-protoc=protoc

  This will use the installed protoc (found in your $PATH) instead of
  trying to execute the one built during the build process.  You can
  also use an executable that hasn't been installed.  For example, if
  you built the protobuf package for your host machine in ../host,
  you might do:

    ./configure --with-protoc=../host/src/protoc

  Either way, you must make sure that the protoc executable you use
  has the same version as the protobuf source code you are trying to
  use it with.

*/

2.make 

3.make install

这样我们在/home/work/protobuff/arm_protobuf/看到编译成功的三哥文件夹。

文件列表 1. 官方包 :protobuf-2.6.1.tar 2. 可直接引用,支持跨平台protobuf-2.6.1 3. 编译库的脚本 :build-protobuf-2.6.1.sh 4. 使用脚本编译得到的可执行文件和库 :lib_protobuf-2.6.1 附:Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos/audio/include) LOCAL_MODULE := MyGame_shared LOCAL_MODULE_FILENAME := libMyGame FILE_LIST := hellocpp/main.cpp FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/utils/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/utils/*.c) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/utils/*.cc) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ohters/protobuf-2.6.1/google/protobuf/*.cc) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ohters/protobuf-2.6.1/google/protobuf/io/*.cc) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ohters/protobuf-2.6.1/google/protobuf/stubs/*.cc) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ohters/protobuf-2.6.1/google/protobuf/testing/*.cc) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ohters/libqrencode/*.c) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ohters/jsoncpp/src/lib_json/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/GF_Net/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/GF_Net/*.cc) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/GF_Net/protoc/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/GF_Net/protoc/*.cc) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/GF_WindowUI/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/GF_Platform/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/GF_Game/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/GF_Game/GF_GameData/*.cpp) FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/GF_Game/GF_GameHall/*
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值