cross-compile ts-arm pkg-config

Asked by wawan wiratno

Dear All,

I just moved my dev environment to arm based, I can cross compile the lib succeed without any error.
but when I tried to compile my applications, I got following errors:

wawan@adil:~/Downloads/libmodbus3/tests$ arm-unknown-linux-gnu-gcc pm750.c -o testreadarm `pkg-config --libs --cflags libmodbus`
/opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/lib/gcc/arm-unknown-linux-gnu/4.0.1/../../../../arm-unknown-linux-gnu/bin/ld: skipping incompatible /usr/local/lib/libmodbus.so when searching for -lmodbus
/opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/lib/gcc/arm-unknown-linux-gnu/4.0.1/../../../../arm-unknown-linux-gnu/bin/ld: cannot find -lmodbus
collect2: ld returned 1 exit status

it seems like "dpkg-config --cflags " must be changed, but I cannot figure out how to change it.

anyone could help?

many thanks

Br,
Wawan

Question information

Language:
English Edit question
Status:
Solved
For:
libmodbus Edit question
Assignee:
No assignee Edit question
Solved by:
wawan wiratno
Solved:
Last query:
Last reply:
Revision history for this message
Alex Stapleton (alexs-prol) said :
#1

I cross compile to ARM too. I think it should all work and link fine if your configure script is run with the correct cross options for your platform. I usually static link it though.

Where has the ARM libmodbus binaries been installed too? Presumably your cross compiler doesn't think that's a place to look for libs though…

Revision history for this message
wawan wiratno (wawan-wiratno) said :
#2

Hi Alex,

cross compile results (libmodbus.so.4.0.0, etc...) are located on /home/wawan/Download/libmodbusarm/
how can I point the 'pkg-config ....' into this statis folder

because when I compile without that options I got following errors:

wawan@adil:~/Downloads/libmodbus3/tests$ arm-unknown-linux-gnu-gcc pm750.c -o testreadarm
pm750.c:7:20: error: modbus.h: No such file or directory
pm750.c: In function 'main':
pm750.c:15: error: 'modbus_t' undeclared (first use in this function)
pm750.c:15: error: (Each undeclared identifier is reported only once
pm750.c:15: error: for each function it appears in.)
pm750.c:15: error: 'mb' undeclared (first use in this function)
pm750.c:16: error: 'uint16_t' undeclared (first use in this function)
pm750.c:16: error: syntax error before 'tab_reg'
pm750.c:21: error: 'TRUE' undeclared (first use in this function)
pm750.c:28: error: 'tab_reg' undeclared (first use in this function)

thanks

Revision history for this message
wawan wiratno (wawan-wiratno) said :
#3

I got it works,
compiled directly on board...

Thanks