Discussion:
[Linuxptp-users] Cross compiling for ARM imx6
Axel Holzinger
2017-01-02 14:15:41 UTC
Permalink
Hello all,

all the best for 2017!

I try to cross compile linuxptpt on Xubuntu 16.04 for i686 32 bit with a
Linux 4.1.15 cross tool chain for ARM's imx6 and gcc 5.2.0, but I get some
erros and I'm not expert enough to get this resolved, unfortunately.

Perhaps somebody reading this list has an idea what I did do wrong.

This is the make output:
***@imx6-VirtualBox:~/Projects/linuxptp-1.8$ make
arm-poky-linux-gnueabi-gcc -Wall -DVER=1.8 -D_GNU_SOURCE
-DHAVE_ONESTEP_SYNC -c -o ptp4l.o ptp4l.c
In file included from
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-linux/usr/lib/arm-poky-l
inux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0/include-fixed/syslimits.h:7:0,
from
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-linux/usr/lib/arm-poky-l
inux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0/include-fixed/limits.h:34,
from ptp4l.c:20:
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-linux/usr/lib/arm-poky-l
inux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0/include-fixed/limits.h:168:61:
error: no include path in which to search for limits.h
ptp4l.c:21:19: fatal error: stdio.h: No such file or directory
compilation terminated.
<builtin>: recipe for target 'ptp4l.o' failed
make: *** [ptp4l.o] Error 1

Thanks in advance
Axel

PS: This are the locations of the asked C headers:
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/include/limits.h
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/include/c++/5.2.0/tr1/limits.h
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/include/linux/limits.h
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-linux/usr/lib/arm-poky-l
inux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0/include-fixed/limits.h
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-linux/usr/lib/arm-poky-l
inux-gnueabi/gcc/arm-poky-linux-gnueabi/5.2.0/include-fixed/syslimits.h

/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/include/stdio.h
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/include/bits/stdio.h
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/include/c++/5.2.0/tr1/stdio.h
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/src/debug/glibc/2.22-r0/git/include/stdio.h
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/src/debug/glibc/2.22-r0/git/libio/stdio.h
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/src/debug/glibc/2.22-r0/git/libio/bits/stdio.h

PPS: This are the relevant (well, what I think to be relevant) environment
variables:
AR=arm-poky-linux-gnueabi-ar
ARCH=arm
AS=arm-poky-linux-gnueabi-as
CCACHE_PATH=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-linux/usr/bi
n:/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-linux/usr/bin/../i686-
pokysdk-linux/bin:/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-linux/
usr/bin/arm-poky-linux-gnueabi:/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-p
okysdk-linux/usr/bin/arm-poky-linux-uclibc:/opt/fsl-imx-x11/4.1.15-1.2.0/sys
roots/i686-pokysdk-linux/usr/bin/arm-poky-linux-musl:
CC=arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon
-mtune=cortex-a9
--sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-li
nux-gnueabi
CFLAGS= -O2 -pipe -g -feliminate-unused-debug-types
CONFIG_SITE=/opt/fsl-imx-x11/4.1.15-1.2.0/site-config-cortexa9hf-vfp-neon-po
ky-linux-gnueabi
CONFIGURE_FLAGS=--target=arm-poky-linux-gnueabi
--host=arm-poky-linux-gnueabi --build=i686-linux
--with-libtool-sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp
-neon-poky-linux-gnueabi
CPP=arm-poky-linux-gnueabi-gcc -E -march=armv7-a -mfloat-abi=hard
-mfpu=neon -mtune=cortex-a9
--sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-li
nux-gnueabi
CPPFLAGS=
CROSS_COMPILE=arm-poky-linux-gnueabi-
CXX=arm-poky-linux-gnueabi-g++ -march=armv7-a -mfloat-abi=hard -mfpu=neon
-mtune=cortex-a9
--sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-li
nux-gnueabi
CXXFLAGS= -O2 -pipe -g -feliminate-unused-debug-types
KCFLAGS=--sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon
-poky-linux-gnueabi
LD=arm-poky-linux-gnueabi-ld
--sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-li
nux-gnueabi
LDFLAGS=-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
NM=arm-poky-linux-gnueabi-nm
OBJCOPY=arm-poky-linux-gnueabi-objcopy
OBJDUMP=arm-poky-linux-gnueabi-objdump
OECORE_ACLOCAL_OPTS=-I
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-linux/usr/share/aclocal
OECORE_DISTRO_VERSION=4.1.15-1.2.0
OECORE_NATIVE_SYSROOT=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/i686-pokysdk-li
nux
OECORE_SDK_VERSION=4.1.15-1.2.0
OECORE_TARGET_SYSROOT=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-
neon-poky-linux-gnueabi
PWD=/home/imx6/Projects/linuxptp-1.8
RANLIB=arm-poky-linux-gnueabi-ranlib
SDKTARGETSYSROOT=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-
poky-linux-gnueabi
STRIP=arm-poky-linux-gnueabi-strip
TARGET_PREFIX=arm-poky-linux-gnueabi-
Richard Cochran
2017-01-02 15:50:58 UTC
Permalink
Post by Axel Holzinger
I try to cross compile linuxptpt on Xubuntu 16.04 for i686 32 bit with a
Linux 4.1.15 cross tool chain for ARM's imx6 and gcc 5.2.0, but I get some
erros and I'm not expert enough to get this resolved, unfortunately.
Perhaps somebody reading this list has an idea what I did do wrong.
arm-poky-linux-gnueabi-gcc -Wall -DVER=1.8 -D_GNU_SOURCE
-DHAVE_ONESTEP_SYNC -c -o ptp4l.o ptp4l.c
...
Post by Axel Holzinger
CC=arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon
-mtune=cortex-a9
--sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi
...
Post by Axel Holzinger
SDKTARGETSYSROOT=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi
Probably you only need to add --sysroot

make EXTRA_CFLAGS=--sysroot=$SDKTARGETSYSROOT

HTH,
Richard
Axel Holzinger
2017-01-02 16:29:28 UTC
Permalink
Hi Richard,

thanks a lot for your reply.
Post by Richard Cochran
Post by Axel Holzinger
I try to cross compile linuxptpt on Xubuntu 16.04 for i686 32 bit with a
Linux 4.1.15 cross tool chain for ARM's imx6 and gcc 5.2.0, but I get some
erros and I'm not expert enough to get this resolved, unfortunately.
...
Probably you only need to add --sysroot
make EXTRA_CFLAGS=--sysroot=$SDKTARGETSYSROOT
That helped a bit, but then

from ptp4l.c:20:
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file
or directory

And indeed, this time I can't find stubs-soft.h in the file system. So
either __ARM_PCS_VFP needs to be defined or stubs-soft.h needs to be
existing.

When I define __ARM_PCS_VFP I get the next error
arm-poky-linux-gnueabi-gcc -Wall -DVER=1.8 -D_GNU_SOURCE
-DHAVE_ONESTEP_SYNC
--sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-li
nux-gnueabi -D__ARM_PCS_VFP -c -o clock.o clock.c
In file included from clock.c:35:0:
missing.h:66:19: error: static declaration of 'clock_adjtime' follows
non-static declaration
static inline int clock_adjtime(clockid_t id, struct timex *tx)
^
In file included from
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/include/time.h:41:0,
from clock.c:24:
/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueab
i/usr/include/bits/time.h:93:12: note: previous declaration of
'clock_adjtime' was here
extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx)
__THROW;
^
<builtin>: recipe for target 'clock.o' failed
make: *** [clock.o] Error 1

So it seems that there is no posix_clock.h available.

Thanks again and best regards
Axel
Richard Cochran
2017-01-02 17:13:23 UTC
Permalink
Post by Axel Holzinger
And indeed, this time I can't find stubs-soft.h in the file system. So
either __ARM_PCS_VFP needs to be defined or stubs-soft.h needs to be
existing.
Try adding the -m flags into EXTRA_CFLAGS as well.

-march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9

HTH,
Richard
Axel Holzinger
2017-01-02 17:21:40 UTC
Permalink
Post by Richard Cochran
Post by Axel Holzinger
And indeed, this time I can't find stubs-soft.h in the file system. So
either __ARM_PCS_VFP needs to be defined or stubs-soft.h needs to be
existing.
Try adding the -m flags into EXTRA_CFLAGS as well.
-march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9
That's it. Now the only thing missing seems to be the header for
clock_adjtime. I will try to find out how I can install this in my cross
toolchain.

Thank you very much Richard!

Cheers
Axel

Loading...