Compilation problems with rtai-comedi

Anders Zachrison andza at
Thu Oct 28 16:44:27 CEST 2004

Previously, we have been using rtai in a few research projects.
Recently we have started to look into using rtai in lab-setups for
undergrads. Here we would like to use Matlab/Simulink with RTW and
xrtailab. I've successfully set up a test box to test this part of the
tool-chain. In the lab-setups, we're obviously going to need to interface
I/O-cards, hence I've installed comedi (with rtai support) & comedilib.
To be able to use the predefined simulink comedi A/D & D/A blocks in
RTW, rtai-addons/comedi must be built first. Here the problems gathers.

I hope some of you might get an idea of what the solution could be when
you read further on...

What I've done, and what problems occurred:

I've downloaded and installed Vesuvio from cvs. Kernel 2.6.7, adeos
hal7-patch. (See the end of the mail for a link to configuration files
as well as the complete rtai build-log).

I downloaded the cvs versions of comedi and comedilib (as I understand
it, the current stable release do not like the combination of rtai/adeos
and 2.6.x-kernel). Comedi are configured with
./configure --prefix=/usr --with-rtaidir=/usr/realtime
and comedelib with the same prefix. They both compiles and installs
OK, and my PCI-1711 card is recognized.

Now I try to compile rtai again, this time with comedi-support (pointing
to the install path /usr, as used above). Now the first problem occur:

1) The configure-script looks for comedilib.h in <linux/comedilib.h>,
but comedilib has installed it in <comedlib.h>. (I.e. directly under
/usr/include in my case). Errormsg:
checking for COMEDI... configure: error: /usr/include directory doesn't
contain linux/comedilib.h

When trying to work around this problem by adding a softlink, the
configure script works. 
2) However, make fails when building rtai-comedi as it can't find
linux/comedi.h. Errormsg:
In file included from /usr/src/vesuvio/rtai-addons/comedi/kcomedi.c:28:
linux/comedi.h: No such file or directory

The two problem above, occurs in the same way if comedi is installed
under /usr/local, just exchange /usr/include for /usr/local/include.
Trying to work around this problem the same way as
before, two alternative problems occur:

3a) If comedi & comedilib is installed under /usr/local, the compiler
can't find fctnl.h, stdio.h and sys/ioctl.h (I think the last one was

3b) If comedi & comedelib is installed under /usr, lots of redefinitions
of stuff happens, eg.:
  CC [M]  /usr/src/builddir-vesuvio/rtai-addons/comedi/kcomedi-module.o
In file included from /usr/include/features.h:295,
                 from /usr/include/sys/ioctl.h:22,
                 from /usr/include/linux/comedilib.h:29,
/usr/include/sys/cdefs.h:183:1: warning: "__attribute_pure__" redefined


/usr/include/sys/types.h:35: error: redefinition of `u_char'
include/linux/types.h:93: error: `u_char' previously declared here
/usr/include/sys/types.h:36: error: redefinition of `u_short'
include/linux/types.h:94: error: `u_short' previously declared here
/usr/include/sys/types.h:37: error: redefinition of `u_int'

(The full message can be found in the err.log at the link below). 

Yes, I know that the work arounds I tried are an attempt to just cure the
symptom and not the problem... One just has to try everything!

The complete build log from running 'make 2>&1 1>err.log' in the
builddir, together with the rtai-configuration and kernel configuration
are availalbe as a tar-file at

Well, the mail got quite long, so I hope someone has read this far!
Thanks for any pointers...

 Anders Zachrison, M.Sc.              Phone: +46 (0)13 - 28 11 91
 Div. of Fluid and Mech. Eng. System  Fax:   +46 (0)13 - 13 04 14
 Dept. of Mechanical Engineering      mailto:andza at
 Linköping University       
 S-581 83 Linköping, SWEDEN

More information about the Rtai mailing list