1:从github下载源码:git clone https://github.com/stephane/libmodbus.git ;
2:./autogen.sh (to generate the configure
script;)
3:./configure --enable-static --prefix ~/static/libmodbus/ 设置静态编译及安装目录;
4:make ;
5:make check;
6:make install ;
静态编译:
(lib目录下只保留libmodbus.a文件)
1:gcc -Wall -I ~/static/libmodbus/include/modbus/ -c -o client_sim_debug.o client_sim_debug.c ;
2:gcc -Wall client_sim_debug.o -L ~/static/libmodbus/lib/ -lmodbus -o client_sim_debug ;