Cross-compile libmodbus as shared library for ARM7?

1,580 views
Skip to first unread message

Taylor Sly

unread,
Dec 3, 2015, 4:00:52 PM12/3/15
to libmodbus
Greetings,

I'm working on a school project that is using an embedded computer based on the ARM7 architecture and uses the libmodbus library. After much research and trial and error I was successful in cross-compiling libmodbus.so for the ARM7. I put transferred this file to the target's /usr/lib directory where I could use it as a shared library for my program.

Executing file command on libmodbus.so gives:
$ file libmodbus.so
libmodbus.so: ELF 32-bit LSB  shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, stripped


My problem is that I don't exactly remember how I eventually got this .so file correctly cross-compiled for the ARM7. This is a problem because I need to replicate the process and explain it in a report.

My build machine is x86_64 running Ubuntu 14.04.

Here's what I believe I did to get the libmodbus.so
1. Download libmodbus source and uncompress
2. configure with ./configure --host=arm-linux-gnueabi-gcc --enable-static
3. execute make
4. look in src for libmodbus.so but it is not there (although libmodbus.la exists)

My environment has arm-linux-gnueabi-gcc installed via sudo apt-get install gcc-arm-linux-gnueabi
I've also been using the Linaro cross-compiler when compiling my project (gcc-linaro-arm-linux-gnueabihf from http://releases.linaro.org/14.04/components/toolchain/binaries/).

I'm not sure which of the above toolchains I used to get the libmodbus.so. I suppose I could use specify the path to the linaro cross-compiler or simply use arm-linux-gnueabi-gcc with the --host flag when executing ./configure

So my question is, how can I make libmodbus.so for ARM7?

I'm attaching my working libmodbus.so file. Also attached is the config.log, and config.status used to make libmodbus.so, although they may have been modified since I successfully created libmodbus.so due to my trial and error attempts.

Any help is much appreciated!
config.log
config.status
libmodbus.so

Chris Jones

unread,
Dec 16, 2015, 8:55:28 AM12/16/15
to libmodbus


On Thursday, December 3, 2015 at 10:00:52 PM UTC+1, Taylor Sly wrote:
Here's what I believe I did to get the libmodbus.so
1. Download libmodbus source and uncompress
2. configure with ./configure --host=arm-linux-gnueabi-gcc --enable-static
3. execute make
4. look in src for libmodbus.so but it is not there (although libmodbus.la exists)

I had exactly this problem when trying some modifications to libmodbus. The libraries end up in src/.libs, which is hidden because of the dot in the directory name. Look in there and you should find your .so file.

Chris
 
Reply all
Reply to author
Forward
0 new messages