下载
下载 mbpoll 源码,
Gitee:
git clone https://gitee.com/droidzxy/mbpoll.git
Github:
https://github.com/epsilonrt/mbpoll.git
下载 libmodbus源码,
Gitee:
git clone https://gitee.com/idrm-iot/libmodbus.git
Github:
https://github.com/stephane/libmodbus.git
编译
编译libmodbus源码,
powershell
mkdir install
./autogen.sh
./configure \
--host=arm-none-linux-gnueabihf \
--prefix=$PWD/install \
--enable-static \
--disable-shared
make -j$(nproc)
make install
编译出来的目标文件在
/home/xxx/OpenSource/libmodbus/install
编译mbpoll 源码,
powershell
mkdir build
cd build
cmake .. \
-DCMAKE_C_COMPILER=arm-none-linux-gnueabihf-gcc \
-DCMAKE_CXX_COMPILER=arm-none-linux-gnueabihf-g++ \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=arm\ -DCMAKE_FIND_ROOT_PATH=/home/xxx/OpenSource/libmodbus/install \
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_PREFIX_PATH=/home/xxx/OpenSource/libmodbus/install \
-DCMAKE_INSTALL_PREFIX=$PWD/install
make -j$(nproc)