1. 环境变量设置 (我这里是用的ubuntu 编译的)
source ./qnxsdp-env.sh
2. 确认 设置成功
echo $QNX_TARGET
/home/xxx/qnx/qnx700/target/qnx7
3. 下载 libmodbus 源文件
https://github.com/stephane/libmodbus/tree/v3.1.6
或
git clone https://github.com/stephane/libmodbus.git
4. 如果没有configure ,可以先运行 ./autogen.sh
生成 configure
脚本
./configure --host=x86_64 CC=ntox86_64-gcc CFLAGS="-L/home/xxx/qnx/qnx700/target/qnx7/x86_64/lib -lsocket" CXX=ntox86_64-g++ --enable-static --enable-shared --prefix=$PWD/install
结果如下:
5. make & make install
make
make install