1.编译环境
- Ubuntu16.04 + arm-hisiv500-linux-
- protobuf3.20下载地址:https://github.com/google/protobuf/tags
2.移植到3519
1)编译步骤:
- 生成配置文件:
autoconf.sh
- 配置:
./configure --build=i686-pc-linux --host=arm-hisiv500-linux CC=arm-hisiv500-linux-gcc CXX=arm-hisiv500-linux-g++ --with-protoc=../../protobuf/protobuf-3.2.0/src/protoc --prefix=/home/shunzhi/software/protobuf/hi_proto/protobuf-3.2.0/install
- 编译:
make
- 检测:
make check
# 检测会出现错误,不用管他( If “make check” fails, you can still install, but it is likely that some features of this library will not work correctly on your system. Proceed at your own risk.) - 安装:
make install
2)配置参数解释
- –build:指明执行编译的平台为64位x86的Linux平台。
- –host :指明运行的平台。
- CC :gcc交叉编译工具。
- CXX :c++交叉编译工具。
- –prefix:安装目录。
- –with-protoc:指明protoc的查找路径,当我们在pc机上进行交叉编译时,src目录下protoc可能会无法执行,所以我们必须要编译一个protoc可执行文件,将其拷贝到src目录或者执行用这个配置参数来指明protoc的路径;上述参数就是指明protoc路径为我之前在pc编译protobuf时生成的protoc。