cross compiling for ARM at91sam9g20 with ptxdist

702 views
Skip to first unread message

Alexander Dahl

unread,
Jan 19, 2012, 11:45:49 AM1/19/12
to OpenNI
Hei hei,

I'm working on compiling OpenNI with ptxdist, maybe see also
http://article.gmane.org/gmane.comp.embedded.ptxdist.devel/8531 O:-)

I have problems cross compiling OpenNI for ARM. I am using OSELAS
toolchain 2011.03.0 for arm-v5te architecture. What I did so far
besides ptxdist:

Install the toolchain and add /opt/OSELAS.Toolchain-2011.03.0/arm-v5te-
linux-gnueabi/gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-
sanitized/bin to $PATH, download libusb-1.0.8 and compile and install
it like this:

./configure --host=arm-v5te-linux-gnueabi
make
DESTDIR=~/build/sysroot-arm make install

So far this works, now for OpenNI I followed the instructions in the
README file [1], went to the appropriate directory and called:

ARM_CXX=arm-v5te-linux-gnueabi-g++ ARM_STAGING=~/build/sysroot-arm-2 ./
RedistMaker Arm

This gives me the following errors:


*********************************
* PrimeSense OpenNI Redist *
* 2012-01-19 17:42:29 *
*********************************

Target: Linux-Arm
Version: 1.5.2.23
Num of compile jobs: 4

* Building OpenNI...
In file included from ../../../../Include/Linux-Arm/XnPlatformLinux-
Arm.h:26:0,
from ../../../../Include/XnPlatform.h:68,
from ../../../../Source/OpenNI/openNI.cpp:25:
../../../../Include/Linux-Arm/../Linux-x86/XnPlatformLinux-x86.h:
32:20: fatal error: unistd.h: No such file or directoryIn file
included from ../../../../Include/Linux-Arm/XnPlatformLinux-Arm.h:
26:0,
from ../../../../Include/XnPlatform.h:68,
from ../../../../Include/XnDump.h:28,
from ../../../../Source/OpenNI/XnDump.cpp:25:
../../../../Include/Linux-Arm/../Linux-x86/XnPlatformLinux-x86.h:
32:20: fatal error: unistd.h: No such file or directory

compilation terminated.
compilation terminated.
make[1]: *** [Arm-Release/openNI.o] Fehler 1
make[1]: *** Warte auf noch nicht beendete Prozesse...
make[1]: *** [Arm-Release/XnDump.o] Fehler 1
In file included from ../../../../Include/Linux-Arm/XnPlatformLinux-
Arm.h:26:0,
from ../../../../Include/XnPlatform.h:68,
from ../../../../Include/XnDump.h:28,
from ../../../../Include/XnDumpWriters.h:7,
from ../../../../Source/OpenNI/XnDumpFileWriter.h:7,
from ../../../../Source/OpenNI/XnDumpFileWriter.cpp:
4:
../../../../Include/Linux-Arm/../Linux-x86/XnPlatformLinux-x86.h:
32:20: fatal error: unistd.h: No such file or directory
compilation terminated.
In file included from ../../../../Include/Linux-Arm/XnPlatformLinux-
Arm.h:26:0,
from ../../../../Include/XnPlatform.h:68,
from ../../../../Include/XnOS.h:28,
from ../../../../Include/XnDataTypes.h:28,
from ../../../../Include/XnBaseNode.h:27,
from ../../../../Source/OpenNI/XnBaseNode.cpp:22:
../../../../Include/Linux-Arm/../Linux-x86/XnPlatformLinux-x86.h:
32:20: fatal error: unistd.h: No such file or directory
compilation terminated.
make[1]: *** [Arm-Release/XnDumpFileWriter.o] Fehler 1
make[1]: *** [Arm-Release/XnBaseNode.o] Fehler 1
make: *** [OpenNI] Fehler 2
failed to execute: make PLATFORM=Arm -j4 -C /home/adahl/src/OpenNI/
Platform/Linux/CreateRedist/../Build > /home/adahl/src/OpenNI/Platform/
Linux/CreateRedist/Output/BuildOpenNI.txt
Building Failed!


It seems the libc header files are not found in the toolchain path. In
ptxdist I more or less run into the same error. I already spotted some
other problems in the Makefiles coming with OpenNI but I leave this
for subsequent mails.

Hope someone can give me a hint on how to solve this.
Greets
Alex

[1] https://github.com/OpenNI/OpenNI/blob/master/README

Byung-Ho Ahn

unread,
Jan 19, 2012, 8:21:19 PM1/19/12
to openn...@googlegroups.com
Hi Alexander,

Please put cross compiler include directory into Platform/Linux/Build/Common/CommonCppMakefile like below.

INC_DIRS += <path to compiler include>

Thanks,
BH Ahn

Hei hei,

[1] https://github.com/OpenNI/OpenNI/blob/master/README

--
You received this message because you are subscribed to the Google Groups "OpenNI" group.
To post to this group, send email to openn...@googlegroups.com.
To unsubscribe from this group, send email to openni-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/openni-dev?hl=en.

Alexander Dahl

unread,
Jan 20, 2012, 4:09:12 AM1/20/12
to OpenNI
Hei hei,

On 20 Jan., 02:21, Byung-Ho Ahn <Byung-Ho....@PrimeSense.com> wrote:
> Please put cross compiler include directory into Platform/Linux/Build/Common/CommonCppMakefile like below.
>
> INC_DIRS += <path to compiler include>

I had a look in this file and found the following comment:

7 # Project makefile should define the following BEFORE including
this file:
8 # SRC_FILES - a list of all source files
9 # Output name under one of the following:
10 # EXE_NAME (executable),
11 # LIB_NAME (dynamic library) or
12 # SLIB_NAME (static library) or
13 # BIN_DIR - Bin directory (output dir)
14 # INC_DIRS - a list of additional include directories
15 # LIB_DIRS - a list of additional library directories
16 # USED_LIBS - a list of libraries to link with

So I appended the following to Platform/Linux/Build/OpenNI/Makefile

29 INC_DIRS += /opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/
gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/sysroot-arm-
v5te-linux-gnueabi/include
30 INC_DIRS += /opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/
gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/sysroot-arm-
v5te-linux-gnueabi/usr/include

just before

34 include ../Common/CommonCppMakefile

This leads to the following:


% ARM_CXX=arm-v5te-linux-gnueabi-g++ ARM_STAGING=~/build/sysroot-
arm-2 ./RedistMaker Arm


*********************************
* PrimeSense OpenNI Redist *
* 2012-01-20 09:48:08 *
*********************************

Target: Linux-Arm
Version: 1.5.2.23
Num of compile jobs: 4

* Building OpenNI...
../../../../Source/OpenNI/XnDump.cpp:136:13: note: the mangling of
'va_list' has changed in GCC 4.4
../../../../Source/OpenNI/XnLog.cpp:720:6: note: the mangling of
'va_list' has changed in GCC 4.4
/opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/gcc-4.5.2-
glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/lib/gcc/arm-v5te-
linux-gnueabi/4.5.2/../../../../arm-v5te-linux-gnueabi/bin/ld: cannot
find crti.o: No such file or directory
/opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/gcc-4.5.2-
glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/lib/gcc/arm-v5te-
linux-gnueabi/4.5.2/../../../../arm-v5te-linux-gnueabi/bin/ld: cannot
find -ldl
/opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/gcc-4.5.2-
glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/lib/gcc/arm-v5te-
linux-gnueabi/4.5.2/../../../../arm-v5te-linux-gnueabi/bin/ld: cannot
find -lpthread
/opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/gcc-4.5.2-
glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/lib/gcc/arm-v5te-
linux-gnueabi/4.5.2/../../../../arm-v5te-linux-gnueabi/bin/ld: cannot
find -lrt
/opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/gcc-4.5.2-
glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/lib/gcc/arm-v5te-
linux-gnueabi/4.5.2/../../../../arm-v5te-linux-gnueabi/bin/ld: cannot
find -lm
collect2: ld returned 1 exit status
make[1]: *** [../../Bin/Arm-Release/libOpenNI.so] Fehler 1
make: *** [OpenNI] Fehler 2
failed to execute: make PLATFORM=Arm -j4 -C /home/adahl/src/OpenNI/
Platform/Linux/CreateRedist/../Build > /home/adahl/src/OpenNI/Platform/
Linux/CreateRedist/Output/BuildOpenNI.txt
Building Failed!


Ok seems he does not find some libs so I added some additional lines
to Platform/Linux/Build/OpenNI/Makefile

31 LIB_DIRS += /opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/
gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/sysroot-arm-
v5te-linux-gnueabi/lib
32 LIB_DIRS += /opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/
gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/sysroot-arm-
v5te-linux-gnueabi/usr/lib

Compiling still does not succeed, now with this error:

* Building OpenNI...
../../../../Source/OpenNI/XnDump.cpp:136:13: note: the mangling of
'va_list' has changed in GCC 4.4
../../../../Source/OpenNI/XnLog.cpp:720:6: note: the mangling of
'va_list' has changed in GCC 4.4
/opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/gcc-4.5.2-
glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/lib/gcc/arm-v5te-
linux-gnueabi/4.5.2/../../../../arm-v5te-linux-gnueabi/bin/ld: cannot
find crti.o: No such file or directory
/opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/gcc-4.5.2-
glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/lib/gcc/arm-v5te-
linux-gnueabi/4.5.2/../../../../arm-v5te-linux-gnueabi/bin/ld: cannot
find /lib/libpthread.so.0
/opt/OSELAS.Toolchain-2011.03.0/arm-v5te-linux-gnueabi/gcc-4.5.2-
glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/lib/gcc/arm-v5te-
linux-gnueabi/4.5.2/../../../../arm-v5te-linux-gnueabi/bin/ld: cannot
find /usr/lib/libpthread_nonshared.a
collect2: ld returned 1 exit status
make[1]: *** [../../Bin/Arm-Release/libOpenNI.so] Fehler 1
make: *** [OpenNI] Fehler 2
failed to execute: make PLATFORM=Arm -j4 -C /home/adahl/src/OpenNI/
Platform/Linux/CreateRedist/../Build > /home/adahl/src/OpenNI/Platform/
Linux/CreateRedist/Output/BuildOpenNI.txt
Building Failed!


However there are files crti.o, libpthread.so.0,
libpthread_nonshared.a in /opt/OSELAS.Toolchain-2011.03.0/arm-v5te-
linux-gnueabi/gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-
sanitized/sysroot-arm-v5te-linux-gnueabi – see:

% find -L . -name 'crti.o'
./usr/lib/crti.o
% find -L . -name 'libpthread.so.0'
./lib/libpthread.so.0
% find -L . -name 'libpthread_nonshared.a'
./usr/lib/libpthread_nonshared.a

This is strange because if I have a look in /home/adahl/src/OpenNI/
Platform/Linux/CreateRedist/Output/BuildOpenNI.txt then there's no
error, maybe because just stdout is piped to this file and the error
on console comes through stderr. So I tried do execute the build
without the Python stuff:

% ARM_CXX=arm-v5te-linux-gnueabi-g++ ARM_STAGING=~/build/sysroot-arm-2
make PLATFORM=Arm -j4 -C /home/adahl/src/OpenNI/Platform/Linux/
CreateRedist/../Build

But this gives the same error as above, would have assumed that
before. So what did I miss?

Thanks so far and greets
Alex

Byung-Ho Ahn

unread,
Jan 20, 2012, 4:27:32 AM1/20/12
to openn...@googlegroups.com
Hi Alexander,

Just copy to the files like crti.o from <compiler path>/usr/lib to <rootfs path>/usr/lib.
And You need copy the files from <compiler path>/lib to <rootfs path>/lib as well.

Thanks,
BH Ahn

-----Original Message-----
From: openn...@googlegroups.com [mailto:openn...@googlegroups.com] On Behalf Of Alexander Dahl

Hei hei,

just before

34 include ../Common/CommonCppMakefile

sanitized/sysroot-arm-v5te-linux-gnueabi - see:

% find -L . -name 'crti.o'
./usr/lib/crti.o
% find -L . -name 'libpthread.so.0'
./lib/libpthread.so.0
% find -L . -name 'libpthread_nonshared.a'
./usr/lib/libpthread_nonshared.a

This is strange because if I have a look in /home/adahl/src/OpenNI/ Platform/Linux/CreateRedist/Output/BuildOpenNI.txt then there's no error, maybe because just stdout is piped to this file and the error on console comes through stderr. So I tried do execute the build without the Python stuff:

% ARM_CXX=arm-v5te-linux-gnueabi-g++ ARM_STAGING=~/build/sysroot-arm-2 make PLATFORM=Arm -j4 -C /home/adahl/src/OpenNI/Platform/Linux/
CreateRedist/../Build

But this gives the same error as above, would have assumed that before. So what did I miss?

Thanks so far and greets
Alex

--

Alexander Dahl

unread,
Jan 20, 2012, 4:40:50 AM1/20/12
to openn...@googlegroups.com
Hei hei,

Am 20.01.2012 10:27, schrieb Byung-Ho Ahn:
> Just copy to the files like crti.o from <compiler path>/usr/lib to
> <rootfs path>/usr/lib.
> And You need copy the files from <compiler path>/lib to <rootfs
> path>/lib as well.

Actually this is what I wanted to avoid in the first place. What I
really try to do is building OpenNI with ptxdist [1] and these files are
not in the target sysroot folder there and none of the other packages
needs it there, regardless if using autotools, cmake or plain makefiles
for building.

:-/

Alex

[1] http://www.ptxdist.org/

Reply all
Reply to author
Forward
0 new messages