stephane / libmodbus

A Modbus library for Linux, Mac OS, FreeBSD and Windows
http://libmodbus.org
GNU Lesser General Public License v2.1
3.4k stars 1.73k forks source link

cross compile for ARM? #212

Closed bringingkatigbak closed 10 years ago

bringingkatigbak commented 10 years ago

Hi,

I am having trouble cross-compiling (using arm-linux-gcc) the libmodbus library for an ARM based machine. I am using pkg-config... and getting: "cannot find -lmodbus" and "collect2: ld returned 1 exit status".

details could be found here: http://stackoverflow.com/questions/22851209/arm-linux-gcc-compiler-linking-file-could-not-be-found

Any guidance would be appreciated!

Niko

bringingkatigbak commented 10 years ago

How can I build libmodbus for an ARM target device? such that I can eventually cross-compile for that ARM target device and #include modbus.h ?

dhruvvyas90 commented 10 years ago

I am not an expert but from the little I know, you will have to specify your cross compiler while performing ./configure step. Run ./configure --help to get more help regarding available configurable options.

And I guess after a successful compilation, you just need to copy libmodbus.so file from lib_path and related header files from include path and upload it to the same path on your targeted device.

Again, I am not sure if these are the exact steps but I do remember doing the same 2 years ago while cross compiling opencv libraries for my mini2440.

Hope it helps.

stephane commented 10 years ago

It isn't an issue with libmodbus but your dev environment (related to #211)