Crosscompiling for BananaPro failed

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
Spanni26
Posts: 1
Joined: Tue 31. May 2016, 16:12

Crosscompiling for BananaPro failed

Post by Spanni26 » Tue 31. May 2016, 16:24

Hello,

I try to cross compile the Peak USB for a BananaPro board (http://www.lemaker.org/product-bananapro-index.html).
I've downloaded a toolchain, changed the settings in the peak Makefile (export ARCH=arm, export CROSS_COMPILE=/opt/cross/bin/arm-linux-gnueabi-, KERNEL_LOCATION = "/root/lemaker-bsp/build/sun7i_defconfig-linux/").

The driver is compiling fine, but I*m failing at the lib and the test directory:

Code: Select all

make[1]: Entering directory '/root/peak-linux-driver-7.15.2/lib'
/opt/cross/bin/arm-linux-gnueabi-gcc src/libpcan.c -DNO_RT -I. -I../driver -fPIC -shared -O2 -Wall  -Wl,-soname,libpcan.so.0 -lc  -o libpcan.so.0.6
src/libpcan.c:38:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.
Makefile:91: recipe for target 'libpcan.so.0.6' failed
make[1]: *** [libpcan.so.0.6] Error 1
make[1]: Leaving directory '/root/peak-linux-driver-7.15.2/lib'
make[1]: Entering directory '/root/peak-linux-driver-7.15.2/test'
/opt/cross/bin/arm-linux-gnueabi-gcc -DNO_RT -g -I. -I../lib -I../driver  src/receivetest.c src/common.c  -lpcan -L../lib -L/lib64 -L/usr/lib64 -L/usr/local/lib64 -o receivetest
src/receivetest.c:40:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.
src/common.c:34:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.
Makefile:120: recipe for target 'receivetest' failed
make[1]: *** [receivetest] Error 1
make[1]: Leaving directory '/root/peak-linux-driver-7.15.2/test'
I'm compiling at a opensuse 13.2
stdio.h and stdlib.h are both at /usr/include so I don't have a idea why it is failing here.

Any hints?

Regards

Daniel

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Crosscompiling for BananaPro failed

Post by S.Grosjean » Fri 3. Jun 2016, 10:20

Hi Daniel,

Since you're cross-compiling, "/usr/incldue/stdio.h" should'nt obvioulsy be the right file to include.

To cross-compile the pcan library , you have to edit the related "lib/Makefile" and define the CC variable with the right cross-compiler:

Code: Select all

 #****************************************************************************
 #
 # Makefile - Makefile for the shared library libpcan.so.x.x
 #
 # $Id: Makefile 517 2007-07-09 09:40:42Z edouard $
 #
 #****************************************************************************

+CC := arm-linux-gnueabi-

 SRC     = src
Same change should be done for the test applications (as well as for yours) in "test/Makefile":

Code: Select all

 #****************************************************************************
 #
 # Makefile - Makefile for receivetest and transmittest programs
 #
 # $Id: Makefile 616 2010-02-14 22:41:17Z khitschler $
 #
 #****************************************************************************

+CC := arm-linux-gnueabi-

 SRC = src
Finally, depending on the toolchain, you might also have to define some (other) LDFLAGS...

Regards,

Stéphane
— Stéphane

Post Reply