出现 undefined symbol: ecrt_slave_config_sdo后

xsp@xsp:~$ halrun


halcmd: loadrt lcec
Note: Using POSIX realtime
lcec: dlopen: /usr/lib/linuxcnc/modules/lcec.so: undefined symbol: ecrt_slave_config_sdo
<stdin>:3: waitpid failed /usr/bin/rtapi_app lcec
<stdin>:3: /usr/bin/rtapi_app exited without becoming ready
<stdin>:3: insmod for lcec failed, returned -1
halcmd: Note: Using POSIX realtime

xsp@xsp:~$ ldd -r /usr/lib/linuxcnc/modules/lcec.so
        linux-vdso.so.1 (0x00007ffc6a1fc000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb029394000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb0291b3000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fb0294b6000)
undefined symbol: hal_exit      (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_sdo (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_domain_process   (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: hal_param_new (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_sync_slave_clocks (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_release_master   (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_slave_config      (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_sdo16       (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: hal_malloc    (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_state     (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_pdos        (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_vsnprintf       (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_receive   (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_sdo_upload        (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_sync_reference_clock      (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_watchdog    (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_shmem_delete    (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_activate  (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_domain_reg_pdo_entry_list        (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_state       (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: hal_init      (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_dc  (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_idn (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_deactivate        (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_task_pll_set_correction (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_send      (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_shmem_new       (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_request_master   (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_complete_sdo        (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_snprintf        (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: hal_export_funct      (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: hal_ready     (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_shmem_getptr    (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_print_msg       (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: hal_pin_new   (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_domain_size      (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_task_pll_get_reference  (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_read_real        (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_read_idn  (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_sdo32       (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_create_domain     (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_get_time        (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_slave_config_sdo8        (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_domain_queue     (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_domain_data      (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_application_time  (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: ecrt_master_reference_clock_time      (/usr/lib/linuxcnc/modules/lcec.so)

出现如上错误,你需要覆写 ~/linuxcnc-ethercat/src/realtime.mk 文件

include ../config.mk
include Kbuild

cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
             > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)

.PHONY: all clean install

ifeq ($(BUILDSYS),kbuild)

module = $(patsubst %.o,%.ko,$(obj-m))

ifeq (,$(findstring -Wframe-larger-than=,$(EXTRA_CFLAGS)))
  EXTRA_CFLAGS += $(call cc-option,-Wframe-larger-than=2560)
endif

$(module):
	$(MAKE) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" KBUILD_EXTRA_SYMBOLS="$(RTLIBDIR)/Module.symvers $(RTAIDIR)/modules/ethercat/Module.symvers" -C $(KERNELDIR) SUBDIRS=`pwd` CC=$(CC) V=0 modules

clean::
	rm -f $(obj-m)
	rm -f *.mod.c .*.cmd
	rm -f modules.order Module.symvers
	rm -rf .tmp_versions

else

module = $(patsubst %.o,%.so,$(obj-m))

EXTRA_CFLAGS := $(filter-out -Wframe-larger-than=%,$(EXTRA_CFLAGS))

$(module): $(lcec-objs)
	$(CC) -shared -o $@ $(lcec-objs) -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal -lethercat -lrt

%.o: %.c
	$(CC) -o $@ $(EXTRA_CFLAGS) -Os -c $<

endif

all: $(module)

clean::
	rm -f $(module)
	rm -f $(lcec-objs)

install: $(module)
	mkdir -p $(DESTDIR)$(RTLIBDIR)
	cp $(module) $(DESTDIR)$(RTLIBDIR)/

然后,切换到linuxcnc-ethercat目录下,运行以下命令

cd ~/linuxcnc-ethercat
make clean
make
sudo make install

即可。

运行之后的效果

xsp@xsp:~/linuxcnc-ethercat/src$ ldd -r /usr/lib/linuxcnc/modules/lcec.so
        linux-vdso.so.1 (0x00007fff283d2000)
        liblinuxcnchal.so.0 => /lib/liblinuxcnchal.so.0 (0x00007f2172332000)
        libethercat.so.1 => /usr/local/lib/libethercat.so.1 (0x00007f217230e000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f217212d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2172370000)
undefined symbol: rtapi_task_pll_set_correction (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: hal_export_funct      (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: rtapi_task_pll_get_reference  (/usr/lib/linuxcnc/modules/lcec.so)
undefined symbol: pow   (/usr/lib/linuxcnc/modules/lcec.so)
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值