From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Amit Goradia <amit@automatasystems.com>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Trouble running native examples
Date: Wed, 17 Oct 2012 09:26:07 +0200 [thread overview]
Message-ID: <507E5D8F.2000705@xenomai.org> (raw)
In-Reply-To: <CAG_j_bA-8b-jkuaLR29bWF92aq=iD1YAfx_844mAq2w9oMhkSg@mail.gmail.com>
On 10/17/2012 09:12 AM, Amit Goradia wrote:
> automata@automata-xenomai:~/xenomai-2.6.1/examples/native$ make
> gcc -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -D__XENO__ -lnative
> -L/usr/xenomai/lib -lxenomai -lpthread -lrt -Xlinker -rpath -Xlinker
> /usr/xenomai/lib trivial-periodic.c -o trivial-periodic
> /tmp/ccJuIj7p.o: In function `demo':
> trivial-periodic.c:(.text+0x2f): undefined reference to
> `rt_task_set_periodic'
> trivial-periodic.c:(.text+0x34): undefined reference to `rt_timer_read'
> trivial-periodic.c:(.text+0x46): undefined reference to
> `rt_task_wait_period'
> trivial-periodic.c:(.text+0x4b): undefined reference to `rt_timer_read'
> /tmp/ccJuIj7p.o: In function `main':
> trivial-periodic.c:(.text+0x133): undefined reference to `rt_task_create'
> trivial-periodic.c:(.text+0x14f): undefined reference to `rt_task_start'
> trivial-periodic.c:(.text+0x160): undefined reference to `rt_task_delete'
> collect2: ld returned 1 exit status
> make: *** [trivial-periodic] Error 1
> So what am I doing wrong?
>
> Any clues?
The link order is wrong, trivial-periodic on the command line should be
before -lnative -lxenomai, etc...
Please try the following patch:
diff --git a/examples/native/Makefile b/examples/native/Makefile
index 485b3fa..498d870 100644
--- a/examples/native/Makefile
+++ b/examples/native/Makefile
@@ -32,13 +32,13 @@ endif
CC=$(shell $(XENOCONFIG) --cc)
-CFLAGS=$(shell $(XENOCONFIG) --skin=native --cflags) $(MY_CFLAGS)
+CPPFLAGS=$(shell $(XENOCONFIG) --skin=native --cflags) $(MY_CFLAGS)
-LDFLAGS=$(shell $(XENOCONFIG) --skin=native --ldflags) $(MY_LDFLAGS)
+LOADLIBES=$(shell $(XENOCONFIG) --skin=native --ldflags) $(MY_LDFLAGS)
# This includes the library path of given Xenomai into the binary to
make live
# easier for beginners if Xenomai's libs are not in any default search
path.
-LDFLAGS+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)
+LOADLIBES+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)
all:: $(APPLICATIONS)
@@ -50,12 +50,6 @@ endif
-###### SPECIAL TARGET RULES ######
-rtprint: rtprint.c
- $(CC) $(CFLAGS) $? $(LDFLAGS) -o $@
-
-
-
###### KERNEL MODULE BUILD (no change required normally) ######
ifneq ($(MODULES),)
--
Gilles.
prev parent reply other threads:[~2012-10-17 7:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-17 7:12 [Xenomai] Trouble running native examples Amit Goradia
2012-10-17 7:26 ` Gilles Chanteperdrix [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=507E5D8F.2000705@xenomai.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=amit@automatasystems.com \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.