Re: Compiling 0.1.4.2 with RTAI 3.0r3

Peter Soetens <[email protected]> Tue, 8 Jun 2004 10:20:12 +0200
Newsgroups gmane.science.robotics.orocos.user
Organization KU Leuven
Message-ID <[email protected]>
On Monday 07 June 2004 14:36, Vandenbroucke Sander wrote:
> Hello,
>
> When compiling PeriodicThread.cxx (in the packages/os/lxrt tree) I get a
> compilation error:
>
> /usr/realtime/incluse/rtai_posix.h: In function 'sem_t* sem_open_rt(const
> char*, int, int, int)':
> /usr/realtime/incluse/rtai_posix.h:591: 'atomic_inc' undeclared (first use
> this function)
> ...
>
> There are a couple more undeclared 'atomic' functions. Also a lot of
> warnings about using kernel headers in userspace.
>
> I use RTAI-LXRT 3.03r and orocos 0.1.4.2.
>
> Can anyone help me out?

Ok. I guess the only solution is a change in rtai (and orocos). The point is 
that atomic_inc/dec are i386 specific. It does not exist in the same form on 
other architectures. That is why Redhat has removed these files from their 
systems. If RTAI wants to do atomic ops in userspace (atomic_inc, atomic_dec, 
atomic_cmpxchg in rtai_posix.h) it should fall back on regular locking 
primitives in order to be portable. 

For now, I can only advise to put #if 0 ... #endif blocks around each 
*_open_rt and *_close_rt function in rtai_posix.h (they all use atomic ops), 
in order to compile on RedHat systems (RTAI-dev : what is the prefered 
solution ?)

Debian does not issue such a warning or errors. I'll send you a patch 
seperately for Orocos (it uses atomic ops on 1 place).

Peter

-- 
------------------------------------------------------------------------
Peter Soetens, Research Assistent                  http://www.orocos.org
Katholieke Universiteit Leuven
Division Production Engineering,                      tel. +32 16 322773
Machine Design and Automation                         fax. +32 16 322987
Celestijnenlaan 300B                   [email protected]
B-3001 Leuven Belgium                 http://www.mech.kuleuven.ac.be/pma
------------------------------------------------------------------------