Linuxcnc-ethercat: undefined symbol: ecrt_slave_config_sdo

More
22 Mar 2021 10:57 #203225 by Stormholt
Hello

I know this problem is pretty normal with first installation of linuxcnc-ethercat, however none of the answers on the other topics have done it for me, or maybe i am too dense to understand the answer.

SO... i have followed Grotius' installation guide using ec-debianize.
The error happens when running the line "loadrt lcec" in the postgui.hal file
lcec: dlopen: /home/vaerks/linuxcnc/rtlib/lcec.so: undefined symbol: ecrt_slave_config_sdo
lcec: dlopen: /home/vaerks/linuxcnc/rtlib/lcec.so: undefined symbol: ecrt_slave_config_sdo

hal/postgui.hal:7: waitpid failed /home/vaerks/linuxcnc/bin/rtapi_app lcec
hal/postgui.hal:7: /home/vaerks/linuxcnc/bin/rtapi_app exited without becoming ready
hal/postgui.hal:7: insmod for lcec failed, returned -1

The answers i have already tried to solve this with have been:
Using the realtime.mk from 0.9.1 release
This one, not quite relevant due to the installation method
This never really came to a conclusion

I definetly believe that the lcec.so and libethercat are not linked properly as "ldd lcec.so" prints:
ldd ~/linuxcnc/rtlib/lcec.so
	linux-vdso.so.1 (0x00007ffc4c342000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7837fbb000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7837bca000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f7838579000)
However i have no idea how to solve this.
libethercat.so are located: /usr/lib/x86_64-linux-gnu/libethercat.so

I have gone through the process of installation on two pc's, one with ubuntu 20.04 and another with Mint 19.3, both have reached the same point.

Can someone please help me ? Thanks in advance :-)

Please Log in or Create an account to join the conversation.

More
22 Mar 2021 11:22 - 22 Mar 2021 11:24 #203227 by Hakan
The step to place a small file in /etc/ld.so.conf.d to help find where libethercat.so is has gone wrong.
Before starting linuxcnc enter
% export LD_LIBRARY_PATH=/opt/etherlab/lib:$LD_LIBRARY_PATH
or wherever the libethercat.so is.
Last edit: 22 Mar 2021 11:24 by Hakan.
The following user(s) said Thank You: Stormholt

Please Log in or Create an account to join the conversation.

More
22 Mar 2021 12:23 #203231 by Stormholt
Hello Hakan, thank you for your answer!

I tried the following before running linuxcnc:
$ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu$LD_LIBRARY_PATH
$ $LD_LIBRARY_PATH
bash: /usr/lib/x86_64-linux-gnu: Is a directory
However it did not seem to work :-/

After linuxcnc i get this:
$LD_LIBRARY_PATH
bash: /home/vaerks/linuxcnc/lib:/usr/lib/x86_64-linux-gnu: No such file or directory

Please Log in or Create an account to join the conversation.

More
22 Mar 2021 13:03 #203233 by Hakan
In a new fresh terminal window, type
$ echo $LD_LIBRARY_PATH
If that produce an empty output, then type
$ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
If there is an output, type
$ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
Don't forget the ":" Then followed by
$ linuxcnc your-ini.ini

It can also be that the libethercat.so is found but the build of it has gone wrong and is missing the functions you list.
The following user(s) said Thank You: Stormholt

Please Log in or Create an account to join the conversation.

More
22 Mar 2021 13:10 #203234 by Stormholt
yeah i removed the ":" because the variable was empty.

So it must have something to do with the build as you wrote :-/

Please Log in or Create an account to join the conversation.

More
22 Mar 2021 15:42 #203252 by Stormholt
I managed to get past this error. With an answer i had previously tried, but apparently failed

Thanks to Shameless

For anyone with the same problem, You need to overwrite your ~/linuxcnc-ethercat/src/realtime.mk file with the following:
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)/

After which you can do following:
cd ~/linuxcnc-ethercat
make clean
make 
sudo make install
The following user(s) said Thank You: cncLab

Please Log in or Create an account to join the conversation.

More
22 Mar 2021 15:46 - 22 Mar 2021 15:51 #203254 by Grotius
Hi,

For ethercat i have a iso over here.
And a newer iso over here.
Ethercat is working for kernels up to 4.19 with ec-debianize. Tested on Debian.

For your error : undefined symbol: ecrt_slave_config_sdo.
Did you follow the ec-debianize procedure and installed the 2 .deb package's both?
To be sure, i advise to install a fresh pc and do the process again. But you fixed it i see, nice !

The mercurial repository has changed to git. See etherlab website. This is important for ec-debianize.
The source is changed, and at the moment not compatible with newer kernels.

Finally i now have my new distro Bullseye working with realtime kernel and ethercat.
Linux debian 5.10.0-4-rt-amd64 And Linux debian 5.10.0-5-rt-amd64 are working for ethercat.

Today i had a conversation with Florian Pose about some ethercat problems, related to the latest kernels > 5.0.0
They are solved. So now i must look to make a .deb package for it. And i must dig into ec-debianize to fix this.
Last edit: 22 Mar 2021 15:51 by Grotius.
The following user(s) said Thank You: arvidb, Stormholt, Rabin

Please Log in or Create an account to join the conversation.

More
23 Mar 2021 08:28 #203360 by Stormholt
Hey Grotius

I have been reading a lot of your post getting into ethercat with linuxcnc, so thank for your answer to this topic and thanks for your answers in general.

I did indeed follow the ec-debianize procedure and installed both packages.

In terms of kernel my first attempt was on Ubuntu 20.04 withLinux 5.8.0-45-generic x86_64 and second attempt on Mint 19.3 with Linux 5.0.0-32-generic x86_64, so i am very interested in the .deb package and revision to ec-debianize you will be working on. Where can i follow the development of this project or get notified of its completion?

Please Log in or Create an account to join the conversation.

More
23 Mar 2021 10:39 #203377 by Grotius
Hi Stromholt,

5.8.0-45-generic x86_64, i don't know if this is compatible. Ubuntu is long time ago for me.
For Debian i use at least a "rt" in the kernel name.

Current development for compatibility with latest kernels is here
It's like a working dir for me.

so i am very interested in the .deb package and revision to ec-debianize you will be working on.
Just got linuxcnc deb package ready, and now starting with the ec-debianize story. I hope it goes well. But i know with linux
you could get a few head scratchers....

But my starting point is perfect. Ethercat-bus works already and Linuxcnc works.

Please Log in or Create an account to join the conversation.

More
23 Mar 2021 12:20 #203383 by Stormholt
And of course it makes sense you would primarily work with real time kernels, however i am working on a team taking turns working with the actually cnc machine so i mainly develop and sim on my private ubuntu pc and later push an implement on the actual machine with an rt kernel.
I will try and setup a machine with this kernel (similar to our machine) to work with ethercat.

Good luck with the head scratching!

Please Log in or Create an account to join the conversation.

Time to create page: 0.186 seconds
Powered by Kunena Forum