ethercat build fails

More
1 year 7 months ago #323003 by esmurf
ethercat build fails was created by esmurf
Hi,

i am trying to compile ethercat 1.6.3 on Alma9 linux (RHEL9 clone).
The build fails with this error:

make -C "/usr/src/kernels/5.14.0-503.23.2.el9_5.x86_64" M="/usr/src/ethercat-1.6.3" INSTALL_MOD_DIR="ethercat" modules
make[1]: Entering directory '/usr/src/kernels/5.14.0-503.23.2.el9_5.x86_64'
  CC [M]  /usr/src/ethercat-1.6.3/master/cdev.o
/usr/src/ethercat-1.6.3/master/cdev.c: In function ‘eccdev_mmap’:
/usr/src/ethercat-1.6.3/master/cdev.c:233:19: error: assignment of read-only member ‘vm_flags’
  233 |     vma->vm_flags |= VM_DONTDUMP; /* Pages will not be swapped out */
      |                   ^~
make[3]: *** [scripts/Makefile.build:249: /usr/src/ethercat-1.6.3/master/cdev.o] Error 1
make[2]: *** [scripts/Makefile.build:478: /usr/src/ethercat-1.6.3/master] Error 2
make[1]: *** [Makefile:1944: /usr/src/ethercat-1.6.3] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.14.0-503.23.2.el9_5.x86_64'
make: *** [Makefile:957: modules] Error 2

What might be the problem here? 

Build of linuxcnc 2.9.4 worked.

TIA

Please Log in to join the conversation.

More
1 year 7 months ago #323028 by tommylight
Replied by tommylight on topic ethercat build fails
Moved to "ethercat" section.

Please Log in to join the conversation.

More
1 year 7 months ago #323421 by esmurf
Replied by esmurf on topic ethercat build fails
ok, i got it to build.
RHEL9 seems to have some stuff backported from kernel 6.x, so ifdef macros go the wrong path.
For me a quick fix was to just remove the ifdefs, like this:

*** cdev.c.orig 2025-03-02 10:05:18.704523437 +0100
--- cdev.c 2025-03-02 10:06:13.589430791 +0100
***************
*** 227,237 ****
EC_MASTER_DBG(priv->cdev->master, 1, "mmap()\n");

vma->vm_ops = &eccdev_vm_ops;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
vm_flags_set(vma, VM_DONTDUMP);
- #else
- vma->vm_flags |= VM_DONTDUMP; /* Pages will not be swapped out */
- #endif
vma->vm_private_data = priv;

return 0;
--- 227,233 ----

The same problem was in module.c.

Now the driver builds and loads into the kernel.

Please Log in to join the conversation.

Time to create page: 0.263 seconds
Powered by Kunena Forum