Skip to contentSkip to conversation

undefined reference of rt_timer_read()

Xenomai Arsalan Shahid 2 participants 5 messages Oct 16, 2014 – Oct 18, 2014

lore
Share & tools
lore
#0 lore raw

Hi

I pray that this message finds you in the Best of Health & Happiness

I am using NATIVE skin of Xenomai along with OpenMP. Xenomai works perfectly fine with NATIVE skin when we use it along OpenMP. But In my codes when ever I tried to access any Function of Native skin I get an error in compilation. I used rt_timer_read() as shown below.

RTIME now;
now = rt_timer_read();

code.c:(.text+0x33): undefined reference to rt_timer_read' code.c:(.text+0x49): undefined reference to rt_timer_ticks2ns'

Same is the case when I call used rt_printf. Another thing which comes while compiling Xenomai application occurs when I give command line option (-lrtdk). Without this code is compiled but with this it gives error.

Kindly guide me.

Thanks & Regards
Arsalan Shahid

#1 lore raw
Quoted 1 line · Arsalan Shahid

Hi

Hi,

Quoted 2 lines

I pray that this message finds you in the Best of Health & Happiness

Thanks, but you do not need to be so formal, a simple "hi" will do.

Quoted 11 lines

I am using NATIVE skin of Xenomai along with OpenMP. Xenomai works perfectly fine with NATIVE skin when we use it along OpenMP. But In my codes when ever I tried to access any Function of Native skin I get an error in compilation. I used rt_timer_read() as shown below.

RTIME now;
now = rt_timer_read();

code.c:(.text+0x33): undefined reference to rt_timer_read' code.c:(.text+0x49): undefined reference to rt_timer_ticks2ns'

I believe the problem to be in the way you compile your program. You should obtain the correct flag with the "xeno-config" program, documented here:
http://www.xenomai.org/documentation/xenomai-2.6/html/xeno-config/

Also beware of gcc link order beginners trap: the order of arguments on gcc command line matters:
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

Quoted 5 lines

Same is the case when I call used rt_printf. Another thing which comes while compiling Xenomai application occurs when I give command line option (-lrtdk). Without this code is compiled but with this it gives error.

For -lrtdk, see:
http://www.xenomai.org/pipermail/xenomai/2012-January/025149.html

Regards.

Signature · 1 line
					    Gilles.
#2 lore raw

Thanks for your prompt response.

Gilles, I compiled my code with OpenMP + Xenomai as

Quoted 5 lines

xeno-config --skin=--xeno-cflags
xeno-config --skin=--xeno-ldflags
export CFLAGS=xeno-config --xeno-cflags
export LDFLAGS=xeno-config --xeno-ldflags
gcc -fopenmp $CFLAGS $LDFLAGS -lnative -lrtdk code.c -o code

For -lrtdk I understood the point. But I think I am compiling the code correctly. What do you say ?

Also, I am doing all this in my virtual machine using VmWare. Do you think this can be an issue to access rt_ functions of NATIVE skin due to their RT design ?

Thanks & Regards
Arsalan Shahid

On Thursday, October 16, 2014 10:32 PM, Gilles Chanteperdrix <[email protected]> wrote:

Quoted 1 line · Arsalan Shahid

Hi

Hi,

Quoted 2 lines

I pray that this message finds you in the Best of Health & Happiness

Thanks, but you do not need to be so formal, a simple "hi" will do.

Quoted 11 lines

I am using NATIVE skin of Xenomai along with OpenMP. Xenomai works perfectly fine with NATIVE skin when we use it along OpenMP. But In my codes when ever I tried to access any Function of Native skin I get an error in compilation. I used rt_timer_read() as shown below.

RTIME now;
now = rt_timer_read();

code.c:(.text+0x33): undefined reference to rt_timer_read' code.c:(.text+0x49): undefined reference to rt_timer_ticks2ns'

I believe the problem to be in the way you compile your program. You should obtain the correct flag with the "xeno-config" program, documented here:
http://www.xenomai.org/documentation/xenomai-2.6/html/xeno-config/

Also beware of gcc link order beginners trap: the order of arguments on gcc command line matters:
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

Quoted 5 lines

Same is the case when I call used rt_printf. Another thing which comes while compiling Xenomai application occurs when I give command line option (-lrtdk). Without this code is compiled but with this it gives error.

For -lrtdk, see:
http://www.xenomai.org/pipermail/xenomai/2012-January/025149.html

Regards.

Signature · 1 line
                        Gilles.
#3 lore raw
Quoted 8 lines · Arsalan Shahid

Thanks for your prompt response.

Gilles, I compiled my code with OpenMP + Xenomai as

Quoted 4 lines

xeno-config --skin=--xeno-cflags
xeno-config --skin=--xeno-ldflags
export CFLAGS=xeno-config --xeno-cflags
export LDFLAGS=xeno-config --xeno-ldflags

This syntax of xeno-config is deprecated. You would know if you had read xeno-config man page. I took the pain to send you the link to the HTML version of this manual page.

Quoted 3 lines
Quoted 1 line

gcc -fopenmp $CFLAGS $LDFLAGS -lnative -lrtdk code.c -o code

For -lrtdk I understood the point. But I think I am compiling the code correctly. What do you say ?

No, you are not, I was sure you were doing that, already warned you there was a trap, and posted a link to gcc documentation.

Why can not beginners simply read the documentation they are told to?
.

Signature · 1 line
					    Gilles.
#4 lore raw

well, thank you Gilles.

Thanks & Regards
Arsalan Shahid

On Friday, October 17, 2014 6:04 PM, Gilles Chanteperdrix <[email protected]> wrote:

Quoted 8 lines · Arsalan Shahid

Thanks for your prompt response.

Gilles, I compiled my code with OpenMP + Xenomai as

Quoted 4 lines

xeno-config --skin=--xeno-cflags
xeno-config --skin=--xeno-ldflags
export CFLAGS=xeno-config --xeno-cflags
export LDFLAGS=xeno-config --xeno-ldflags

This syntax of xeno-config is deprecated. You would know if you had read xeno-config man page. I took the pain to send you the link to the HTML version of this manual page.

Quoted 3 lines
Quoted 1 line

gcc -fopenmp $CFLAGS $LDFLAGS -lnative -lrtdk code.c -o code

For -lrtdk I understood the point. But I think I am compiling the code correctly. What do you say ?

No, you are not, I was sure you were doing that, already warned you there was a trap, and posted a link to gcc documentation.

Why can not beginners simply read the documentation they are told

to?
.

Signature · 1 line
                        Gilles.