Xenomai+igh的编译问题

基本情况介绍

在移植Xenomai并连接igh的工程中遇到了一些编译问题,但由于本人是这方面的小白,多番寻找之下仍未能解决问题,所以在这里贴出具体情况,希望有大佬能不吝赐教。
移植Xenomai和igh的流程是参考了这篇博客

版本

linux-dovetail-v5.10.76-dovetail3+xenomai-v3.2.1+ethercat-e1000e-5.10源码包

其中linux-dovetail-v5.10.76-dovetail3是Xenomai官方做好的内核源码。具体的连接如下:
linux
xenomai
igh

问题

在Xenomai的移植当中,按照教程的做法能够顺利完成Xenomai的移植, uname -admesg | grep -i xenomai显示版本号已经发生改变,使用sudo /usr/xenomai/bin/latency工具进行测试能够正常使用,但是在igh的安装过程中,经过./configure之后运行sudo make -j4就会出现错误。错误的部分内容如下(完整内容见文末):

/usr/xenomai/lib/xenomai/bootstrap.o: In function `xenomai_main':
bootstrap.c:(.text+0x0): multiple definition of `xenomai_main'
/usr/xenomai/lib/xenomai/bootstrap.o:bootstrap.c:(.text+0x0): first defined here
/usr/xenomai/lib/xenomai/bootstrap.o:(.rodata+0x0): multiple definition of `xenomai_auto_bootstrap'
/usr/xenomai/lib/xenomai/bootstrap.o:(.rodata+0x0): first defined here
/home/lzx/xenomai/ethercat-e1000e-5.10/lib/.libs/libethercat_rtdm.so: undefined reference to `rt_dev_ioctl'
/home/lzx/xenomai/ethercat-e1000e-5.10/lib/.libs/libethercat_rtdm.so: undefined reference to `rt_dev_open'
/home/lzx/xenomai/ethercat-e1000e-5.10/lib/.libs/libethercat_rtdm.so: undefined reference to `rt_dev_close'
collect2: error: ld returned 1 exit status

Xenomai和igh所使用的./configure参数如下:
xenomai

sudo ./scripts/bootstrap
sudo ./configure --with-pic --with-core=cobalt --enable-smp --disable-tls --enable-dlopen-libs --disable-clock-monotonic-raw

igh

sudo ./bootstrap
sudo ./configure --with-module-dir=/lib/modules/5.10.76-xenomai --enable-generic --enable-8139too=no --enable-debug-if --enable-rtdm --enable-cycles --enable-hrtimer --with-xenomai-dir=/usr/xenomai --prefix=/opt/etherlab

这里虽然使用的是e1000的源码包,但是也曾尝试过masterstable-1.5的源码包,同样出现了上面的问题

分析

错误提示undefined reference to rt_dev_xxx,似乎和rtdm接口有关,在igh的文档中有提到rtdm是作为与Xenomai连接的接口,并且出现了multiple definition of xenomai_main的提示,在这篇博客中提到:

Xenomai 3 的rtdm驱动更像一般的Linux驱动,named device会在/dev/rtdm/xxx创建一个设备文件。而用户空间使用时,写得来也和Linux的一般char设备相似,open/close/read/write/ioctl,只不过实际上在link的时候这些函数都被做了手脚,替换成了libcobalt.so中的函数(参见 /usr/xenomai/lib/cobalt.wrappers)

以我粗陋的知识来推断(瞎猜),应该是编译过程中链接动态库时出现了问题。为了解决问题我又到Xenomai和igh的论坛寻找解决方法,在上面发现两篇分别是15、16年的文章与这里遇到的问题一致,里面提到问题之所以出现,可能是因为igh没有更新连接Xenomai的编译方法。最后我在igh的gitlab仓库询问了我所遇到的问题链接,得到的回复是:
官方回复

We (the etherlab team ) mainly support ethercat under preempt rt kernel. We do not use the rtai or xenomai interface anymore in production enviroments.
Please feel free to fix it and create a merge request.
It seems there is a missing library at linking time, maybe the xenomai have splitted some libs

大概意思是igh团队主要支持preemptRT的实时内核,不再使用RTAI和Xenomai的接口。问题看起来似乎是链接过程中某个库没找到,可能Xenomai分割了某些库。

结论

igh团队可能不再更新对Xenomai的接口,Xenomai+igh的实时控制方案似乎没办法进行了,但是我还是想找到解决上面提到的编译错误的方法。毕竟我所参考的博客教程不到一年前才发布,而我使用的源码包与教程一致,在Xenomai和igh的gitlab仓库里也能看到最近的更新是一年以前,是在没道理这篇博客能够顺利安装上,到了我这就不行了。
在这里也求助各位路过的大佬能够解决我的问题。

make完整报错内容

make  all-recursive
make[1]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10'
Making all in include
make[2]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/include'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/include'
Making all in script
make[2]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/script'
Making all in init.d
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/script/init.d'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/script/init.d'
Making all in sysconfig
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/script/sysconfig'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/script/sysconfig'
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/script'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/script'
make[2]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/script'
Making all in devices
make[2]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices'
Making all in ccat
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices/ccat'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices/ccat'
Making all in e1000
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices/e1000'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices/e1000'
Making all in e1000e
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices/e1000e'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices/e1000e'
Making all in igb
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices/igb'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices/igb'
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices'
make[2]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/devices'
Making all in master
make[2]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/master'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/master'
Making all in tool
make[2]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/tool'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/tool'
Making all in lib
make[2]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/lib'
  CC       libethercat_rtdm_la-common.lo
  CC       libethercat_rtdm_la-domain.lo
  CC       libethercat_rtdm_la-master.lo
  CC       libethercat_rtdm_la-reg_request.lo
In file included from domain.c:42:0:
domain.c: In function ‘ecrt_domain_size’:
ioctl.h:50:15: warning: implicit declaration of function ‘rt_dev_ioctl’; did you mean ‘__real_ioctl’? [-Wimplicit-function-declaration]
 #define ioctl rt_dev_ioctl
               ^
domain.c:83:11: note: in expansion of macro ‘ioctl’
     ret = ioctl(domain->master->fd, EC_IOCTL_DOMAIN_SIZE, domain->index);
           ^~~~~
common.c: In function ‘ecrt_open_master’:
In file included from master.c:36:0:
master.c: In function ‘ecrt_master_reserve’:
common.c:98:18: warning: implicit declaration of function ‘rt_dev_open’; did you mean ‘__real_open’? [-Wimplicit-function-declaration]
     master->fd = rt_dev_open(path, O_RDWR);
                  ^~~~~~~~~~~
                  __real_open
ioctl.h:50:15: warning: implicit declaration of function ‘rt_dev_ioctl’; did you mean ‘__real_ioctl’? [-Wimplicit-function-declaration]
 #define ioctl rt_dev_ioctl
               ^
master.c:45:15: note: in expansion of macro ‘ioctl’
     int ret = ioctl(master->fd, EC_IOCTL_REQUEST, NULL);
               ^~~~~
In file included from common.c:41:0:
ioctl.h:50:15: warning: implicit declaration of function ‘rt_dev_ioctl’; did you mean ‘__real_ioctl’? [-Wimplicit-function-declaration]
 #define ioctl rt_dev_ioctl
               ^
common.c:108:11: note: in expansion of macro ‘ioctl’
     ret = ioctl(master->fd, EC_IOCTL_MODULE, &module_data);
           ^~~~~
master.c: In function ‘ec_master_clear’:
master.c:94:9: warning: implicit declaration of function ‘rt_dev_close’; did you mean ‘__real_close’? [-Wimplicit-function-declaration]
         rt_dev_close(master->fd);
         ^~~~~~~~~~~~
         __real_close
In file included from reg_request.c:38:0:
reg_request.c: In function ‘ecrt_reg_request_state’:
ioctl.h:50:15: warning: implicit declaration of function ‘rt_dev_ioctl’; did you mean ‘__real_ioctl’? [-Wimplicit-function-declaration]
 #define ioctl rt_dev_ioctl
               ^
reg_request.c:72:11: note: in expansion of macro ‘ioctl’
     ret = ioctl(reg->config->master->fd, EC_IOCTL_REG_REQUEST_STATE, &io);
           ^~~~~
  CC       libethercat_rtdm_la-sdo_request.lo
  CC       libethercat_rtdm_la-slave_config.lo
  CC       libethercat_rtdm_la-voe_handler.lo
In file included from voe_handler.c:39:0:
voe_handler.c: In function ‘ecrt_voe_handler_send_header’:
ioctl.h:50:15: warning: implicit declaration of function ‘rt_dev_ioctl’; did you mean ‘__real_ioctl’? [-Wimplicit-function-declaration]
 #define ioctl rt_dev_ioctl
               ^
voe_handler.c:67:11: note: in expansion of macro ‘ioctl’
     ret = ioctl(voe->config->master->fd, EC_IOCTL_VOE_SEND_HEADER, &data);
           ^~~~~
In file included from sdo_request.c:38:0:
sdo_request.c: In function ‘ecrt_sdo_request_index’:
ioctl.h:50:15: warning: implicit declaration of function ‘rt_dev_ioctl’; did you mean ‘__real_ioctl’? [-Wimplicit-function-declaration]
 #define ioctl rt_dev_ioctl
               ^
sdo_request.c:68:11: note: in expansion of macro ‘ioctl’
     ret = ioctl(req->config->master->fd, EC_IOCTL_SDO_REQUEST_INDEX, &data);
           ^~~~~
In file included from slave_config.c:34:0:
slave_config.c: In function ‘ecrt_slave_config_sync_manager’:
ioctl.h:50:15: warning: implicit declaration of function ‘rt_dev_ioctl’; did you mean ‘__real_ioctl’? [-Wimplicit-function-declaration]
 #define ioctl rt_dev_ioctl
               ^
slave_config.c:95:11: note: in expansion of macro ‘ioctl’
     ret = ioctl(sc->master->fd, EC_IOCTL_SC_SYNC, &data);
           ^~~~~
/bin/sed -e 's,%libdir%,/opt/etherlab/lib,' -e 's,%includedir%,/opt/etherlab/include,' EtherCATConfig.cmake.in > EtherCATConfig.cmake
  CCLD     libethercat_rtdm.la

*** Warning: Linking the shared library libethercat_rtdm.la against the non-libtool
*** objects  /usr/xenomai/lib/xenomai/bootstrap.o is not portable!
ar: `u' modifier ignored since `D' is the default (see `U')
make[2]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/lib'
Making all in examples
make[2]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/examples'
Making all in dc_user
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/examples/dc_user'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/examples/dc_user'
Making all in user
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/examples/user'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/examples/user'
Making all in xenomai
make[3]: Entering directory '/home/lzx/xenomai/ethercat-e1000e-5.10/examples/xenomai'
  CC       ec_xenomai_example-main.o
  CCLD     ec_xenomai_example
/usr/xenomai/lib/xenomai/bootstrap.o: In function `xenomai_main':
bootstrap.c:(.text+0x0): multiple definition of `xenomai_main'
/usr/xenomai/lib/xenomai/bootstrap.o:bootstrap.c:(.text+0x0): first defined here
/usr/xenomai/lib/xenomai/bootstrap.o:(.rodata+0x0): multiple definition of `xenomai_auto_bootstrap'
/usr/xenomai/lib/xenomai/bootstrap.o:(.rodata+0x0): first defined here
/home/lzx/xenomai/ethercat-e1000e-5.10/lib/.libs/libethercat_rtdm.so: undefined reference to `rt_dev_ioctl'
/home/lzx/xenomai/ethercat-e1000e-5.10/lib/.libs/libethercat_rtdm.so: undefined reference to `rt_dev_open'
/home/lzx/xenomai/ethercat-e1000e-5.10/lib/.libs/libethercat_rtdm.so: undefined reference to `rt_dev_close'
collect2: error: ld returned 1 exit status
Makefile:424: recipe for target 'ec_xenomai_example' failed
make[3]: *** [ec_xenomai_example] Error 1
make[3]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/examples/xenomai'
Makefile:462: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10/examples'
Makefile:519: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/lzx/xenomai/ethercat-e1000e-5.10'
Makefile:444: recipe for target 'all' failed
make: *** [all] Error 2
  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 32
    评论
### 回答1: Xenomai是一个开源的实时操作系统框架,为Linux操作系统提供了实时能力。它基于POSIX和RTDM(实时设备模型)接口,可以在单核或多核处理器上实现硬实时任务的处理。IGH(Interrupt and GPIO Handler)是Xenomai中的一个子系统,用于处理中断和GPIO(通用输入输出)。 IGH可以通过Xenomai的API直接访问硬件的中断和GPIO。对于实时任务来说,中断的处理非常关键。通过IGHXenomai可以提供低延迟和可预测性的中断处理,从而满足实时应用对于快速响应和确定性的要求。 IGH的另一个功能是处理GPIO。GPIO是一个通用的输入输出接口,它可以用来连接外部设备,如传感器、执行器等。通过IGHXenomai可以实现对GPIO的实时控制,提供精确和可靠的输入输出操作。 在Xenomai中,IGH通过中断线程(interrupt thread)和GPIO线程(GPIO thread)来处理中断和GPIO。中断线程负责注册和处理外部中断,保证实时任务优先处理。GPIO线程负责配置和控制GPIO,实现对外部设备的实时控制。 XenomaiIGH的使用可以帮助开发者实现实时应用程序,如机器人控制、数据采集、工业自动化等。通过提供实时能力和对硬件的底层访问,XenomaiIGH可以满足对于实时性、可靠性和可预测性的严格要求。它们的开源特性和丰富的API也使得开发者可以灵活地定制和扩展系统。 ### 回答2: Xenomai是一个开源的实时操作系统框架,用于嵌入式系统和实时应用的开发。它是基于Linux内核的一个补丁包,通过使用Linux可编程实时单位(RTAI)和一个用于实时任务的用户空间组件(Xenomai igh)相结合的方式,提供了一个可预测和可靠的实时环境。 Xenomai ighXenomai框架中与实时任务管理有关的主要组件之一。它提供了一组API接口,使得开发者能够以类似于编写普通Linux应用程序的方式开发实时任务。这些接口包括任务管理、时间管理、中断管理等。通过使用这些接口,开发者可以实现基于时间限制的可预测性,确保实时任务在给定的时间内完成,满足实时性的要求。 Xenomai igh的核心理念是通过将实时任务划分为内核空间和用户空间的两个部分,实现对实时任务的管理和调度。用户空间中的实时任务通过Xenomai igh提供的API与内核空间中的驱动程序进行通信,实现数据传输和设备控制等功能。这样的设计目的是将实时任务的管理与应用程序的开发分离,提高了系统的可维护性和可扩展性。 Xenomai igh对于实时任务的调度也提供了丰富的支持。它使用先进的调度算法,如周期性负载的调度算法和最早截止时间优先算法,以确保实时任务能够按照预期的时间进行调度。此外,Xenomai igh还提供了可以动态调整调度参数的接口,以应对系统工作负载的变化。 总而言之,Xenomai ighXenomai框架中的重要组件之一,通过提供一系列API接口和先进的调度方式,为开发者提供了一个可预测和可靠的实时环境。它被广泛应用于嵌入式系统和实时应用的开发,并在实时性要求较高的领域发挥着重要的作用。 ### 回答3: xenomai是一种开源软件开发套件,它是一个提供实时执行环境的实时扩展,适用于Linux操作系统。它的全称是Xenomai关键基础结构 (Xenomai Infrastructure for Generic Hard Real-Time)。 Xenomai被设计用于将实时任务与Linux内核相结合,通过在用户进程空间创建一个类似实时操作系统的执行环境,实现严格的实时性能。这是通过使用一个称为Cobalt的核心架构来实现的,Cobalt提供了一个实时计时器,能够确保高分辨率的时钟服务。 Xenomai的一个主要功能是提供了一个称为POSIX Skin的接口,用于实现与POSIX标准兼容的编程接口,使得开发人员可以使用熟悉的POSIX API进行实时软件的开发。同时,Xenomai也提供了Native Skin接口,该接口提供了更低层次的编程接口,允许开发者直接访问内核实时任务、中断处理以及硬件设备。 通过使用Xenomai,开发者可以利用Linux操作系统的优势,如开源、丰富的设备支持和广泛的开发资源,来构建实时应用程序。它适用于许多应用领域,如工业自动化、机器人技术、音频处理和实时嵌入式系统等,能够满足对于高实时性能的严格要求。 总结来说,xenomai是一个开源软件开发套件,为Linux操作系统提供实时执行环境。通过它,开发者可以在Linux上构建具有严格实时性能要求的应用程序,并且可以使用熟悉的POSIX API进行开发。xenomai在实时应用领域有着广泛的应用,能够满足高实时性能的要求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 32
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值