All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Xenomai @ ppc with linker Porblem
@ 2006-05-22 13:23 Behre, Frederik - LT
  2006-05-22 17:43 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Behre, Frederik - LT @ 2006-05-22 13:23 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]

Hi

I have following problem when I compiling my Xenomai Program. It is a
example from the Internet. 
As Attachment I send the programm and the Makefile.

I think the problem is very simple but I have no Idea what it can be. 

My system is
Linux 2.4.25
Xenomai 2.1.1
Adeos 1.0-04

PPC - MPC 8270 on Mircosys PM287.

This is my output:
bash-2.05b# echo $PATH
/usr/xenomai/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/us
r/bin:/usr/X11R6/bin
bash-2.05b# make
gcc -I. -I/usr/xenomai/include -O2 -D_GNU_SOURCE -D_REENTRANT -D__XENO__
-Wall -pipe -L/usr/xenomai/lib -lpthread -lnative -o timer timer.c
timer.c: In function `main':
timer.c:44: warning: `rt_timer_start' is deprecated (declared at
/usr/xenomai/include/native/timer.h:62)
/tmp/ccyCczMp.o(.text+0x3c): In function `testtask':
: undefined reference to `rt_task_sleep'
/tmp/ccyCczMp.o(.text+0xac): In function `clean_exit':
: undefined reference to `rt_task_delete'
/tmp/ccyCczMp.o(.text+0x124): In function `main':
: undefined reference to `rt_task_create'
/tmp/ccyCczMp.o(.text+0x144): In function `main':
: undefined reference to `rt_task_start'
collect2: ld returned 1 exit status
make: *** [timer] Error 1
bash-2.05b#   


Thanks for helping

Greetz
Freddy

[-- Attachment #2: timer.c --]
[-- Type: application/octet-stream, Size: 1340 bytes --]

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>
//#include <sys/io.h>
//is not in my include directory ??? why I need it ?? take another ???
#include <sys/mman.h>
#include <native/task.h>
#include <native/queue.h>
#include <native/intr.h>

#define STACK_SIZE 8192
#define STD_PRIO 1

RT_TASK test_task_ptr;
int int_count = 0;
int end = 0;

void testtask(void *cookie){
	int count = 0;
	while(!end){
 		rt_task_sleep(1000);	// sleep 1 sec (1000 ticks, 1ms each)
		count++;
		printf("message from testtask: count=%d\n", count);
		fflush(NULL);
	}
}
// signal-handler, to ensure clean exit on Ctrl-C void clean_exit(int dummy) {
	printf("cleanup\n");
	end = 1;
	rt_task_delete(&test_task_ptr);
	printf("end\n");
}

int main(int argc, char *argv[]) {
	int err;
	printf("start\n");
	// install signal handler
	signal(SIGTERM, clean_exit);
	signal(SIGINT, clean_exit);
	// start timer
	err = rt_timer_start(1000000); // 1ms ticks
	if (err) {
		printf("error rt_timer_start - did you 'Enable periodic timer support' ?\n");
		return 0;
	}
	err = rt_task_spawn(&test_task_ptr, "Timer", STACK_SIZE, STD_PRIO, 0, &testtask, NULL);
	if (err) {
		printf("error rt_task_spawn\n");
		return 0;
	}
	// wait for signal & return of signal handler
	pause();
	fflush(NULL);
	return 0;
}

[-- Attachment #3: Makefile --]
[-- Type: application/octet-stream, Size: 431 bytes --]

prefix := $(shell xeno-config --prefix)

ifeq ($(prefix),)
$(error Please add <xeno-install>/bin to your PATH variable) endif

CC = gcc
# chanced because I compileing on my powerpc $(shell xeno-config --cc)
LXRT_CFLAGS = $(shell xeno-config --xeno-cflags) LXRT_LDFLAGS = $(shell xeno-config --xeno-ldflags)

all: timer

timer: timer.c
	$(CC) $(LXRT_CFLAGS) $(LXRT_LDFLAGS) -lnative -o $@ $<

clean:
	rm -f *.o timer

.PHONY: clean

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Xenomai-help] Xenomai @ ppc with linker Porblem
  2006-05-22 13:23 [Xenomai-help] Xenomai @ ppc with linker Porblem Behre, Frederik - LT
@ 2006-05-22 17:43 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2006-05-22 17:43 UTC (permalink / raw)
  To: Behre, Frederik - LT; +Cc: xenomai

Behre, Frederik - LT wrote:
> Hi
> 
> I have following problem when I compiling my Xenomai Program. It is a
> example from the Internet. 
> As Attachment I send the programm and the Makefile.
> 
> I think the problem is very simple but I have no Idea what it can be. 
> 
> My system is
> Linux 2.4.25
> Xenomai 2.1.1

You should upgrade to 2.1.2.

> Adeos 1.0-04
> 

You should upgrade to 1.1-02.

> PPC - MPC 8270 on Mircosys PM287.
> 
> This is my output:
> bash-2.05b# echo $PATH
> /usr/xenomai/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/us
> r/bin:/usr/X11R6/bin
> bash-2.05b# make
> gcc -I. -I/usr/xenomai/include -O2 -D_GNU_SOURCE -D_REENTRANT -D__XENO__
> -Wall -pipe -L/usr/xenomai/lib -lpthread -lnative -o timer timer.c
> timer.c: In function `main':

Try moving the linker flags after the input source file.
i.e. ... -o timer timer.c -L/usr/xenomai/lib -lpthread -lnative

> timer.c:44: warning: `rt_timer_start' is deprecated (declared at
> /usr/xenomai/include/native/timer.h:62)
> /tmp/ccyCczMp.o(.text+0x3c): In function `testtask':
> : undefined reference to `rt_task_sleep'
> /tmp/ccyCczMp.o(.text+0xac): In function `clean_exit':
> : undefined reference to `rt_task_delete'
> /tmp/ccyCczMp.o(.text+0x124): In function `main':
> : undefined reference to `rt_task_create'
> /tmp/ccyCczMp.o(.text+0x144): In function `main':
> : undefined reference to `rt_task_start'
> collect2: ld returned 1 exit status
> make: *** [timer] Error 1
> bash-2.05b#   
> 
> 
> Thanks for helping
> 
> Greetz
> Freddy
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help


-- 

Philippe.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-22 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-22 13:23 [Xenomai-help] Xenomai @ ppc with linker Porblem Behre, Frederik - LT
2006-05-22 17:43 ` Philippe Gerum

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.