All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] can't link math.h in a userspace programm
@ 2011-11-23  9:38 Erik Sommer
  2011-11-25 13:06 ` Robert
  0 siblings, 1 reply; 3+ messages in thread
From: Erik Sommer @ 2011-11-23  9:38 UTC (permalink / raw)
  To: xenomai

Hello,

I'm programming a userspace Xenomai-Programm für a Xilinx PowerPC
(additional Information without FPU). I include the math.h because I
have to use arcustangens and arcuscosinus. When compiling the programm
it seems so like the linker can't do his job for math.h.

minimal example:

"
#include <stdbool.h>// boolescher Datentyp
#include <native/task.h>
#include <native/timer.h>
#include <rtdm/rtdm.h>
#include <sys/mman.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <math.h>

void user_task(void *cookie){
...
Vektor.y_w=0.5*atan(Vektor.y/reg->l_O);
...
}
"

the Makefile:

"
# Name der zu erstellenden Programmdatei
PROG=pu10_Las_Vek

# Liste der C-Dateien im Verzeichnis
C_DAT=$(wildcard *.c)


# Variablen für die Benutzung des ELDK-Compilers
ARCH=powerpc

#Xenomai Installations Pfad
DESTDIR=../usersupport/root
#DESTDIR=/mnt/albatros_projekte/PU10/pu10_sw/PU10_Xenomai/xenomai_build/root
XENO := $(DESTDIR)/usr/xenomai

XENOCONFIG=$(shell PATH=$(XENO):$(XENO)/bin:$(PATH) which xeno-config
2>/dev/null)

CC=$(shell $(XENOCONFIG) --cc)

CFLAGS=$(shell export DESTDIR="$(DESTDIR)"; $(XENOCONFIG) --skin native
--cflags) $(MY_CFLAGS)

LDFLAGS=$(shell export DESTDIR="$(DESTDIR)"; $(XENOCONFIG) --skin native
--ldflags) $(MY_LDFLAGS) -lnative -lrtdm

#Xenomai Library Pfad in binary hinzufügen
LPATH=/usr/xenomai/lib
#LDFLAGS+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)
LDFLAGS+=-Xlinker -rpath -Xlinker $(LPATH) 

$(PROG):: 
	$(CC) -Wall $(CFLAGS) $(LDFLAGS) -L/usr/lib -I/usr/include
$(C_DAT) ../defines.h ../regbank.h -o $(PROG)	

clean::
	$(RM) $(PROG) *.o
"

I hope for some hints.

Erik 





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

* Re: [Xenomai-help] can't link math.h in a userspace programm
  2011-11-23  9:38 [Xenomai-help] can't link math.h in a userspace programm Erik Sommer
@ 2011-11-25 13:06 ` Robert
  2011-11-25 13:33   ` Erik Sommer
  0 siblings, 1 reply; 3+ messages in thread
From: Robert @ 2011-11-25 13:06 UTC (permalink / raw)
  To: xenomai, Erik Sommer

Hi,
have You tried to add '-lm' to LDFLAGS?
It adds math library while linking program.


Dnia 23 listopada 2011 10:38 Erik Sommer <erik.sommer@domain.hidr.de> napisał(a):

> Hello,
> 
> I'm programming a userspace Xenomai-Programm für a Xilinx PowerPC
> (additional Information without FPU). I include the math.h because I
> have to use arcustangens and arcuscosinus. When compiling the programm
> it seems so like the linker can't do his job for math.h.
> 
> minimal example:
> 
> "
> #include <stdbool.h>// boolescher Datentyp
> #include <native/task.h>
> #include <native/timer.h>
> #include <rtdm/rtdm.h>
> #include <sys/mman.h>
> #include <stdio.h>
> #include <fcntl.h>
> #include <unistd.h>
> #include <math.h>
> 
> void user_task(void *cookie){
> ...
> Vektor.y_w=0.5*atan(Vektor.y/reg->l_O);
> ...
> }
> "
> 
> the Makefile:
> 
> "
> # Name der zu erstellenden Programmdatei
> PROG=pu10_Las_Vek
> 
> # Liste der C-Dateien im Verzeichnis
> C_DAT=$(wildcard *.c)
> 
> 
> # Variablen für die Benutzung des ELDK-Compilers
> ARCH=powerpc
> 
> #Xenomai Installations Pfad
> DESTDIR=../usersupport/root
> #DESTDIR=/mnt/albatros_projekte/PU10/pu10_sw/PU10_Xenomai/xenomai_build/root
> XENO := $(DESTDIR)/usr/xenomai
> 
> XENOCONFIG=$(shell PATH=$(XENO):$(XENO)/bin:$(PATH) which xeno-config
> 2>/dev/null)
> 
> CC=$(shell $(XENOCONFIG) --cc)
> 
> CFLAGS=$(shell export DESTDIR="$(DESTDIR)"; $(XENOCONFIG) --skin native
> --cflags) $(MY_CFLAGS)
> 
> LDFLAGS=$(shell export DESTDIR="$(DESTDIR)"; $(XENOCONFIG) --skin native
> --ldflags) $(MY_LDFLAGS) -lnative -lrtdm
> 
> #Xenomai Library Pfad in binary hinzufügen
> LPATH=/usr/xenomai/lib
> #LDFLAGS+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)
> LDFLAGS+=-Xlinker -rpath -Xlinker $(LPATH) 
> 
> $(PROG):: 
> 	$(CC) -Wall $(CFLAGS) $(LDFLAGS) -L/usr/lib -I/usr/include
> $(C_DAT) ../defines.h ../regbank.h -o $(PROG)	
> 
> clean::
> 	$(RM) $(PROG) *.o
> "
> 
> I hope for some hints.
> 
> Erik 
> 
> 
> 
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
> 


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

* Re: [Xenomai-help] can't link math.h in a userspace programm
  2011-11-25 13:06 ` Robert
@ 2011-11-25 13:33   ` Erik Sommer
  0 siblings, 0 replies; 3+ messages in thread
From: Erik Sommer @ 2011-11-25 13:33 UTC (permalink / raw)
  To: Robert; +Cc: xenomai

Hello,

thanks for the help. This was only one of the faults. But I have fixed
it now.

Erik
Am Freitag, den 25.11.2011, 14:06 +0100 schrieb Robert:
> Hi,
> have You tried to add '-lm' to LDFLAGS?
> It adds math library while linking program.
> 
> 
> Dnia 23 listopada 2011 10:38 Erik Sommer <erik.sommer@domain.hid> napisał(a):
> 
> > Hello,
> > 
> > I'm programming a userspace Xenomai-Programm für a Xilinx PowerPC
> > (additional Information without FPU). I include the math.h because I
> > have to use arcustangens and arcuscosinus. When compiling the programm
> > it seems so like the linker can't do his job for math.h.
> > 
> > minimal example:
> > 
> > "
> > #include <stdbool.h>// boolescher Datentyp
> > #include <native/task.h>
> > #include <native/timer.h>
> > #include <rtdm/rtdm.h>
> > #include <sys/mman.h>
> > #include <stdio.h>
> > #include <fcntl.h>
> > #include <unistd.h>
> > #include <math.h>
> > 
> > void user_task(void *cookie){
> > ...
> > Vektor.y_w=0.5*atan(Vektor.y/reg->l_O);
> > ...
> > }
> > "
> > 
> > the Makefile:
> > 
> > "
> > # Name der zu erstellenden Programmdatei
> > PROG=pu10_Las_Vek
> > 
> > # Liste der C-Dateien im Verzeichnis
> > C_DAT=$(wildcard *.c)
> > 
> > 
> > # Variablen für die Benutzung des ELDK-Compilers
> > ARCH=powerpc
> > 
> > #Xenomai Installations Pfad
> > DESTDIR=../usersupport/root
> > #DESTDIR=/mnt/albatros_projekte/PU10/pu10_sw/PU10_Xenomai/xenomai_build/root
> > XENO := $(DESTDIR)/usr/xenomai
> > 
> > XENOCONFIG=$(shell PATH=$(XENO):$(XENO)/bin:$(PATH) which xeno-config
> > 2>/dev/null)
> > 
> > CC=$(shell $(XENOCONFIG) --cc)
> > 
> > CFLAGS=$(shell export DESTDIR="$(DESTDIR)"; $(XENOCONFIG) --skin native
> > --cflags) $(MY_CFLAGS)
> > 
> > LDFLAGS=$(shell export DESTDIR="$(DESTDIR)"; $(XENOCONFIG) --skin native
> > --ldflags) $(MY_LDFLAGS) -lnative -lrtdm
> > 
> > #Xenomai Library Pfad in binary hinzufügen
> > LPATH=/usr/xenomai/lib
> > #LDFLAGS+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)
> > LDFLAGS+=-Xlinker -rpath -Xlinker $(LPATH) 
> > 
> > $(PROG):: 
> > 	$(CC) -Wall $(CFLAGS) $(LDFLAGS) -L/usr/lib -I/usr/include
> > $(C_DAT) ../defines.h ../regbank.h -o $(PROG)	
> > 
> > clean::
> > 	$(RM) $(PROG) *.o
> > "
> > 
> > I hope for some hints.
> > 
> > Erik 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Xenomai-help mailing list
> > Xenomai-help@domain.hid
> > https://mail.gna.org/listinfo/xenomai-help
> > 



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

end of thread, other threads:[~2011-11-25 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-23  9:38 [Xenomai-help] can't link math.h in a userspace programm Erik Sommer
2011-11-25 13:06 ` Robert
2011-11-25 13:33   ` Erik Sommer

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.