fosi.h compilation error - xenomai 2.5.1

I am trying to compile RTT-1.10.2 against a Ubuntu 9.10, kernel 2.6.32.7, Xenomai 2.5.1.

What I've done so far, following the standard intallation procedure on the orocos-1.10.2 directory: mkdir build $ cd build $ cmake .. -DOROCOS_TARGET=xenomai -DLINUX_SOURCE_DIR=/src/linux-2.6.32.7/ -DXENOMAI_INSTALL_DIR=/usr/xenomai/ $ make

/export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h: In function ‘int rtos_mutex_rec_unlock(rt_rec_mutex_t*)’: /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h:291: error: ‘rt_mutex_unlock’ was not declared in this scope

I found in a topic from this forum, a fosi.h that claims to solve that problem (http://www.orocos.org/forum/rtt/rtt-dev/xenomai-compilation-error). However, after trying to compile I get:

/export/home/localadm/src/orocos-rtt-1.10.2/src/os/Mutex.hpp: In member function ‘virtual bool RTT::OS::MutexRecursive::timedlock(RTT::OS::Seconds)’: /export/home/localadm/src/orocos-rtt-1.10.2/src/os/Mutex.hpp:266: error: ‘rtos_mutex_rec_lock_until’ was not declared in this scope

In an attempt to solve that problem without bugging you guys, I added to fosi.h the following lines of code (I found it in another topic containing the missing function, however this code is intended to be used in macosx):

    static inline int rtos_mutex_lock_until( rt_mutex_t* m, NANO_TIME
abs_time)
    {
        TIME_SPEC arg_time = ticks2timespec( abs_time );
        return pthread_mutex_timedlock(m, &arg_time);
   }

    static inline int rtos_mutex_rec_lock_until( rt_mutex_t* m, NANO_TIME
abs_time)
    {
        TIME_SPEC arg_time = ticks2timespec( abs_time );
        return pthread_mutex_timedlock(m, &arg_time);
    }
That of course did not work, after trying to compile I got: /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h: In function ‘int rtos_mutex_rec_lock_until(rt_mutex_t*, NANO_TIME)’: /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h:296: error: cannot convert ‘rt_mutex_t*’ to ‘pthread_mutex_t*’ for argument ‘1’ to ‘int pthread_mutex_timedlock(pthread_mutex_t*, const timespec*)

I know you are aware of the fosi.h problem with xenomai, but unfortunately I did not find a solution in this forum for my particular configuration. Any help would be much apreciated.

fosi.h compilation error - xenomai 2.5.1

I have experience similar problems compiling different versions of
Orocos against different Xenomai versions.

For example, compiling orocos-rtt-1.10.3 against xenomai 2.5.2
everything went flawlessly,
whereas compiling orocos-rtt-1.10.3 against xenomai-2.4.10 gave me
the following error:

"/home/sergi/palBuild/orocos-rtt-1.10.3/src/os/xenomai/fosi.h: In
function ‘int rtos_mutex_lock_until(rt_mutex_t*, NANO_TIME)’:
/home/sergi/palBuild/orocos-rtt-1.10.3/src/os/xenomai/fosi.h:271:
error: ‘rt_mutex_acquire_until’ was not declared in this scope"

I did a simple grep in xenomai-2.4.10 and I realized that there is no
"rt_mutex_acquire_until" function.

Should not compile orocos-rtt against xenomai 2.4.x or it is the
xenomai 2.4.x considered deprecated for orocos-rtt?

On Wed, Feb 24, 2010 at 4:39 PM, <jpmzometa [..] ...> wrote:
> I am trying to compile RTT-1.10.2 against a Ubuntu 9.10, kernel 2.6.32.7,  Xenomai 2.5.1.
>
> What I've done so far, following the standard intallation procedure on the orocos-1.10.2 directory:
> mkdir build
> $ cd build
> $ cmake .. -DOROCOS_TARGET=xenomai -DLINUX_SOURCE_DIR=/src/linux-2.6.32.7/ -DXENOMAI_INSTALL_DIR=/usr/xenomai/
> $ make
>
> /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h: In function ‘int rtos_mutex_rec_unlock(rt_rec_mutex_t*)’:
> /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h:291: error: ‘rt_mutex_unlock’ was not declared in this scope
>
> I found in a topic from this forum, a fosi.h that claims to solve that problem (http://www.orocos.org/forum/rtt/rtt-dev/xenomai-compilation-error). However, after trying to compile I get:
>
> /export/home/localadm/src/orocos-rtt-1.10.2/src/os/Mutex.hpp: In member function ‘virtual bool RTT::OS::MutexRecursive::timedlock(RTT::OS::Seconds)’:
> /export/home/localadm/src/orocos-rtt-1.10.2/src/os/Mutex.hpp:266: error: ‘rtos_mutex_rec_lock_until’ was not declared in this scope
>
> In an attempt to solve that problem without bugging you guys, I added to fosi.h the following lines of code (I found it in another topic containing the missing function, however this code is intended to be used in macosx):
>
>    static inline int rtos_mutex_lock_until( rt_mutex_t* m, NANO_TIME
> abs_time)
>    {
>        TIME_SPEC arg_time = ticks2timespec( abs_time );
>        return pthread_mutex_timedlock(m, &arg_time);
>   }
>
>    static inline int rtos_mutex_rec_lock_until( rt_mutex_t* m, NANO_TIME
> abs_time)
>    {
>        TIME_SPEC arg_time = ticks2timespec( abs_time );
>        return pthread_mutex_timedlock(m, &arg_time);
>    }
>
> That of course did not work, after trying to compile I got:
> /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h: In function ‘int rtos_mutex_rec_lock_until(rt_mutex_t*, NANO_TIME)’:
> /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h:296: error: cannot convert ‘rt_mutex_t*’ to ‘pthread_mutex_t*’ for argument ‘1’ to ‘int pthread_mutex_timedlock(pthread_mutex_t*, const timespec*)
>

fosi.h compilation error - xenomai 2.5.1

On Friday 16 April 2010 11:07:51 Garcia Sergio wrote:
> I have experience similar problems compiling different versions of
> Orocos against different Xenomai versions.

The fix is attached to this mail and present on trunk. I'll push it to the 1.10
branch.

Peter

fosi.h compilation error - xenomai 2.5.1

On Friday 16 April 2010 11:07:51 Garcia Sergio wrote:
> I have experience similar problems compiling different versions of
> Orocos against different Xenomai versions.
>
> For example, compiling orocos-rtt-1.10.3 against xenomai 2.5.2
> everything went flawlessly,
> whereas compiling orocos-rtt-1.10.3 against xenomai-2.4.10 gave me
> the following error:
>
> "/home/sergi/palBuild/orocos-rtt-1.10.3/src/os/xenomai/fosi.h: In
> function ‘int rtos_mutex_lock_until(rt_mutex_t*, NANO_TIME)’:
> /home/sergi/palBuild/orocos-rtt-1.10.3/src/os/xenomai/fosi.h:271:
> error: ‘rt_mutex_acquire_until’ was not declared in this scope"
>
> I did a simple grep in xenomai-2.4.10 and I realized that there is no
> "rt_mutex_acquire_until" function.
>
> Should not compile orocos-rtt against xenomai 2.4.x or it is the
> xenomai 2.4.x considered deprecated for orocos-rtt?

There is a bug/misunderstanding in the xenomai version detection macros in
os/xenomai/fosi.h line 85. Xenomai changed some API functions and we need to
figure out in which version the API changed. The current macro clearly does not
catch all cases.

I'm trying to figure it out right now...

Peter

>
> On Wed, Feb 24, 2010 at 4:39 PM, <jpmzometa [..] ...> wrote:
> > I am trying to compile RTT-1.10.2 against a Ubuntu 9.10, kernel 2.6.32.7,
> > Xenomai 2.5.1.
> >
> > What I've done so far, following the standard intallation procedure on
> > the orocos-1.10.2 directory: mkdir build
> > $ cd build
> > $ cmake .. -DOROCOS_TARGET=xenomai
> > -DLINUX_SOURCE_DIR=/src/linux-2.6.32.7/
> > -DXENOMAI_INSTALL_DIR=/usr/xenomai/ $ make
> >
> > /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h: In
> > function ‘int rtos_mutex_rec_unlock(rt_rec_mutex_t*)’:
> > /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h:291:
> > error: ‘rt_mutex_unlock’ was not declared in this scope
> >
> > I found in a topic from this forum, a fosi.h that claims to solve that
> > problem
> > (http://www.orocos.org/forum/rtt/rtt-dev/xenomai-compilation-error).
> > However, after trying to compile I get:
> >
> > /export/home/localadm/src/orocos-rtt-1.10.2/src/os/Mutex.hpp: In member
> > function ‘virtual bool
> > RTT::OS::MutexRecursive::timedlock(RTT::OS::Seconds)’:
> > /export/home/localadm/src/orocos-rtt-1.10.2/src/os/Mutex.hpp:266: error:
> > ‘rtos_mutex_rec_lock_until’ was not declared in this scope
> >
> > In an attempt to solve that problem without bugging you guys, I added to
> > fosi.h the following lines of code (I found it in another topic
> > containing the missing function, however this code is intended to be used
> > in macosx):
> >
> > static inline int rtos_mutex_lock_until( rt_mutex_t* m, NANO_TIME
> > abs_time)
> > {
> > TIME_SPEC arg_time = ticks2timespec( abs_time );
> > return pthread_mutex_timedlock(m, &arg_time);
> > }
> >
> > static inline int rtos_mutex_rec_lock_until( rt_mutex_t* m, NANO_TIME
> > abs_time)
> > {
> > TIME_SPEC arg_time = ticks2timespec( abs_time );
> > return pthread_mutex_timedlock(m, &arg_time);
> > }
> >
> > That of course did not work, after trying to compile I got:
> > /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h: In
> > function ‘int rtos_mutex_rec_lock_until(rt_mutex_t*, NANO_TIME)’:
> > /export/home/localadm/src/orocos-rtt-1.10.2/src/os/xenomai/fosi.h:296:
> > error: cannot convert ‘rt_mutex_t*’ to ‘pthread_mutex_t*’ for argument
> > ‘1’ to ‘int pthread_mutex_timedlock(pthread_mutex_t*, const timespec*)
>

probable solution?

Hi. It might sound crazy to you guys, but I managed to compile with the following functions I just wrote based on what I found in this forum:

static inline int rtos_mutex_lock_until( rt_mutex_t* m, NANO_TIME abs_time)
{
TIME_SPEC arg_time = ticks2timespec( abs_time );
RTIME ticks = arg_time.tv_sec * 1000000000LL + arg_time.tv_nsec;
return rt_mutex_acquire_until(m,ticks);
}

static inline int rtos_mutex_rec_lock_until( rt_mutex_t* m, NANO_TIME abs_time)
{
TIME_SPEC arg_time = ticks2timespec( abs_time );
RTIME ticks = arg_time.tv_sec * 1000000000LL + arg_time.tv_nsec;
return rt_mutex_acquire_until(m,ticks);
}

I know I should not be messing around with your code!

Regards,

probable solution?

Hi. It might sound crazy to you guys, but I managed to compile with the following functions I just wrote based on what I found in this forum:

    static inline int rtos_mutex_lock_until( rt_mutex_t* m, NANO_TIME abs_time)
    {
        TIME_SPEC arg_time = ticks2timespec( abs_time );
    RTIME ticks = arg_time.tv_sec * 1000000000LL + arg_time.tv_nsec;
        return rt_mutex_acquire_until(m,ticks);
    }

    static inline int rtos_mutex_rec_lock_until( rt_mutex_t* m, NANO_TIME abs_time)
    {
        TIME_SPEC arg_time = ticks2timespec( abs_time );
    RTIME ticks = arg_time.tv_sec * 1000000000LL + arg_time.tv_nsec;
        return rt_mutex_acquire_until(m,ticks);
    }
I know I should not be messing around with your code!

Regards,

probable solution?

On Wednesday 24 February 2010 16:03:13 jpmzometa [..] ... wrote:
> Hi. It might sound crazy to you guys, but I managed to compile with the
> following functions I just wrote based on what I found in this forum:
>
> static inline int rtos_mutex_lock_until( rt_mutex_t* m, NANO_TIME
> abs_time) {
> TIME_SPEC arg_time = ticks2timespec( abs_time );
> RTIME ticks = arg_time.tv_sec * 1000000000LL + arg_time.tv_nsec;
> return rt_mutex_acquire_until(m,ticks);
> }

The code on 1.x mainline has:

return rt_mutex_acquire_until(m, rt_timer_ns2ticks(abs_time) );

>
> static inline int rtos_mutex_rec_lock_until( rt_mutex_t* m, NANO_TIME
> abs_time) {
> TIME_SPEC arg_time = ticks2timespec( abs_time );
> RTIME ticks = arg_time.tv_sec * 1000000000LL + arg_time.tv_nsec;
> return rt_mutex_acquire_until(m,ticks);
> }
>
> I know I should not be messing around with your code!

I'm just terrible late with releasing 1.10.3, which will contain this fix.

Thanks for pressuring though :-)

Peter