QNX学习笔记--QNX下编译protobuf与libevent

编译平台为64 位Ubuntu16.04
QNX版本为7.0

1.protobuf

(1).在终端中运行QNX sdp安装目录下的环境变量文件


source  qnxsdp-env.sh

(2).protobuf编译

在protobuf目录下,运行configure 配置编译器为qnx编译器,目标为arm。如果qnx运行在x86或x86_64,可把ntoarmv7-gcc ntoarmv7-g++中的armv7替换为x86或x86_64,编译器路径根据sdp安装路径找到。

./configure --prefix=/home/zoutianming/google/qnx/protobuf-c++/arm --host=arm --build=i686-pc-linux CC=/home/zoutianming/qnx700/host/linux/x86_64/usr/bin/ntoarmv7-gcc 
CXX=/home/zoutianming/qnx700/host/linux/x86_64/usr/bin/ntoarmv7-g++ --with-protoc=protoc --disable-shared

(3).依次执行make与make install命令

2.编译libevent

1.在终端中运行QNX sdp安装目录下的环境变量文件


source  qnxsdp-env.sh

2.在libevent目录下,运行configure

配置编译器为qnx编译器,目标为arm。如果qnx运行在x86或x86_64,可把ntoarmv7-gcc ntoarmv7-g++

中的armv7替换为x86或x86_64,编译器路径根据sdp安装路径找到。

–host qnx运行在pc时,–host 设置为i686-pc-qnx ,运行在arm时设置为arm-qnx

–build设定编译平台

–prefix 指定最终include文件和库文件的安装路径

CC设定编译器

–enable-shared=no –enable-static=yes 只编译静态文件


./configure --prefix=/home/zoutianming/opensource/temp --host=i686-pc-qnx --build=i686-pc-linux CC=/home/zoutianming/qnx700/host/linux/x86_64/usr/bin/ntoarmv7-gcc  --enable-shared=no --enable-static=yes

3.依次执行make 与make install命令

在make时,可能会报SA_RESTART undefined 错误,原因时QNX中没有此信号类型,可将其更改为如下:

#ifdef SA_RESTART //to fix the problem that QNX don't have SA_RESTART 


sa.sa_flags |= SA_RESTART;

 #endif

即无该信号时,该代码不参与编译。

猜你喜欢

转载自blog.csdn.net/werweqg/article/details/82191151