2009-07-02 12:50:55 Xenomai & Compiling the Examples
Daniel Hartman (UNITED STATES)
Message: 76695
Hi all,
Is there a simple way to compile the Xenomai examples?
I'm able to build an image and run the Xenomai benchmark tests, e.g., latency, but I'm struggling to get the examples compiled.
I followed the cross-compiling instructions from
www.xenomai.org/index.php/Examples
using
$ make XENO=<xenomai-installation-path> ARCH=<kernel-architecture> KSRC=<xenomai-kernel-source>
where:
<xenomai-installation-path> = /home/bfin/uClinux-dist-2008R1.5-RC3/user/xenomai/xenomai-2.4.0
<kernel-architecture> = bfin-uclinux-gcc
<xenomai-kernel-source> = /home/bfin/uClinux-dist-2008R1.5-RC3/linux-2.6.x
with no success:
>>> Invoke make like this: "make XENO=/path/to/xeno-config" <<<
make[1]: --cc: Command not found
make[1]: --xeno-cflags: Command not found
make[1]: --xeno-ldflags: Command not found
make[1]: --libdir: Command not found
...
I've also tried to run the configure script from:
uClinux-dist-2008R1.5-RC3/user/xenomai/xenomai-2.4.0
$ ./configure --host=bfin-uclinux
which generates xeno-config and requires some minor editing to point to the staging directory:
uClinux-dist-2008R1.5-RC3/staging
However, compiling still generates errors:
../native$ make XENO=/home/bfin/uClinux-dist-2008R1.5-RC3/user/xenomai/xenomai-2.4.0/scripts
bfin-uclinux-gcc -I/home/bfin/uClinux-dist-2008R1.5-RC3/staging/usr/include -D_GNU_SOURCE -D_REENTRANT -D__XENO__ -L/home/bfin/uClinux-dist/uClinux-dist-2008R1.5-RC3/staging/usr/lib -lpthread -lnative -Xlinker -rpath -Xlinker /home/bfin/uClinux-dist-2008R1.5-RC3/staging/usr/lib trivial-periodic.c -o trivial-periodic
/tmp/ccSmBuEF.o: In function `_demo':
trivial-periodic.c:(.text+0x64): undefined reference to `_rt_task_set_periodic'
trivial-periodic.c:(.text+0x68): undefined reference to `_rt_timer_read'
trivial-periodic.c:(.text+0x72): undefined reference to `_rt_task_wait_period'
trivial-periodic.c:(.text+0x76): undefined reference to `_rt_timer_read'
/tmp/ccSmBuEF.o: In function `_main':
trivial-periodic.c:(.text+0x168): undefined reference to `_rt_task_create'
trivial-periodic.c:(.text+0x17e): undefined reference to `_rt_task_start'
trivial-periodic.c:(.text+0x18e): undefined reference to `_rt_task_delete'
collect2: ld returned 1 exit status
make: *** [trivial-periodic] Error 1
It seems that I am missing something simple (hopefully).
Any help is greatly appreciated.
Thanks.
QuoteReplyEditDelete
2009-07-06 00:40:32 Re: Xenomai & Compiling the Examples
Yi Li (CHINA)
Message: 76818
Daniel,
If building FLAT format application, the linker will not search undefined symbols repeatly. So you may need to add “-lnative -lpthread” at the end.
e.g:
bfin-uclinux-gcc -I/home/adam/new_workspace/local_svn/kernel/2009r1/uclinux-dist/staging/usr/include -D_GNU_SOURCE -D_REENTRANT -D__XENO__ -L/home/adam/new_workspace/local_svn/kernel/2009r1/uclinux-dist/staging/usr/lib -lpthread -lnative -Xlinker -rpath -Xlinker /home/adam/new_workspace/local_svn/kernel/2009r1/uclinux-dist/staging/usr/lib trivial-periodic.c -o trivial-periodic -lnative -lpthread
Also, the build command can be invoked this way, e.g:
DESTDIR=/home/adam/new_workspace/local_svn/kernel/2009r1/uclinux-dist/staging make XENO=$DESTDIR
-Yi
QuoteReplyEditDelete
2009-07-09 17:04:42 Re: Xenomai & Compiling the Examples
Daniel Hartman (UNITED STATES)
Message: 76982
Thank you Yi.
When I follow your example, I receive the following:
root:/> trivial-periodic
ELF : not found
root:/>
I understand the difference between ELF and FLAT, and I am able to compile Hello World successfully (I copied ping's Makefile) and followed:
docs.blackfin.uclinux.org/doku.php?id=adding_user_applications
I added -Wl,-elf2flt to your example above, and it now appears to be working:
root:/> trivial-periodic
Time since last turn: 1000.012390 ms
Time since last turn: 1000.004690 ms
Time since last turn: 999.989580 ms
Time since last turn: 1000.011190 ms
Time since last turn: 999.988650 ms
root:/>
I am inexperienced with makefiles and large builds such as uClinux, and I'd like to clean up the attached Makefile. I believe that this would help other new users to uClinux and Xenomai.
Thank you.
Makefile
QuoteReplyEditDelete
2009-09-06 08:15:17 Re: Xenomai & Compiling the Examples
Dmitry Romannikov (RUSSIAN FEDERATION)
Message: 79633
Hello!
I tried to compile simple test xenomai program, but insted of "bfin-uclinux-gcc" i used "bfin-linux-uclibc-gcc" because first compile allways returned this:
/home/rdo/Download/uClinux-dist-2008R1-RC8/romfs/usr/xenomai/lib//libnative.so: could not read symbols: File in wrong format
bfin-linux-uclibc-gcc compiled without problems, but when file was executed it returned this:
./file:can't load library 'libnative.so.1'
what is the problem?
thanks for any help.
--
Dmitry
QuoteReplyEditDelete
2009-09-06 09:35:54 Re: Xenomai & Compiling the Examples
Dmitry Romannikov (RUSSIAN FEDERATION)
Message: 79634
mm, forgot: xenomai 2.4, dist:2008RC8
--
Dmitry
QuoteReplyEditDelete
2009-09-06 10:00:02 Re: Xenomai & Compiling the Examples
Mike Frysinger (UNITED STATES)
Message: 79635
you need to copy the library in question to the board
QuoteReplyEditDelete
2009-09-06 11:55:22 Re: Xenomai & Compiling the Examples
Dmitry Romannikov (RUSSIAN FEDERATION)
Message: 79636
you need to copy the library in question to the board
---
You're right, thanks. but solved one problem i got second...
when program was executed it returned:
./file: '/lib/libnative.so.1' is not an ELF executable for BFIN
./file: '/lib/libnative.so.1' is not an ELF executable for BFIN
./file: can't load library 'libnative.so.1'
as i undestud library was in wrong file format. and possible it migth be cause why bfin-uclinux-gcc returned error too:
/home/rdo/Download/lala/usr/xenomai/lib/libnative.so: could not read symbols: File in wrong format?
so, should i recompile libs with another compiler(first time was bfin-linux-uclibc-gcc)?
--
Dmitry
QuoteReplyEditDelete
2009-09-06 12:00:56 Re: Xenomai & Compiling the Examples
Mike Frysinger (UNITED STATES)
Message: 79637
xenomai is integrated into the dist already in 2009R1. so perhaps you should be using that.
QuoteReplyEditDelete
2009-09-07 10:20:08 Re: Xenomai & Compiling the Examples
Dmitry Romannikov (RUSSIAN FEDERATION)
Message: 79650
i tryed 2009R1 but in this case image did not start but return a lot of unreadble symbols.
--
Dmitry
QuoteReplyEditDelete
2009-09-07 10:21:36 Re: Xenomai & Compiling the Examples
Dmitry Romannikov (RUSSIAN FEDERATION)
Message: 79651
i tryed 2009R1 but in this case image did not start but return a lot of unreadble symbols.
--
Dmitry
---
I mean that image did not start like linux..