Hello , I am trying instal moxa Nport driver on Rocky Linux 9 , but installation fail with these failure:
I don’t know what’s wrong, the driver is not compatible with the kernel or what?
Is there any way to install this driver on a system with kernel 5.14?
#./mxinst
===============================================================================
Copyright (C) 2002-2021 Moxa Inc.
All Rights Reserved.
MOXA NPort Server Real TTY Driver Ver5.1 Installation.
System Information: Kernel 5.14.0-70.30.1.el9_0.x86_64; Machine x86_64.
===============================================================================
********************************WARNING**********************************
MOXA NPort Server Real TTY Driver has been tested under kernel 5.13.4.
That may not be compatible with Linux Kernel versions 5.14.0-70.30.1.el9_0.x86_64 .
To download the available driver, please visit Moxa at: http://www.moxa.com
If you have questions, please contact Moxa support at: support@moxa.com
*************************************************************************
Press enter to continue...
Building driver...
If you want to use secure communication with target,
you might choose [y] to enable the SSL function.
Note: This function support RealCOM with secure mode only.
Do you want to enable secure function? [y/N].
N
make -C /lib/modules/5.14.0-70.30.1.el9_0.x86_64/build M=/root/moxa EXTRA_CFLAGS=" -DTTYNAME='"ttyr"'" modules
make[1]: Entering directory '/usr/src/kernels/5.14.0-70.30.1.el9_0.x86_64'
CC [M] /root/moxa/npreal2.o
/root/moxa/npreal2.c:490:31: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
490 | .write_room = npreal_write_room,
| ^~~~~~~~~~~~~~~~~
/root/moxa/npreal2.c:490:31: note: (near initialization for ‘mpvar_ops.write_room’)
/root/moxa/npreal2.c:491:36: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
491 | .chars_in_buffer = npreal_chars_in_buffer,
| ^~~~~~~~~~~~~~~~~~~~~~
/root/moxa/npreal2.c:491:36: note: (near initialization for ‘mpvar_ops.chars_in_buffer’)
/root/moxa/npreal2.c: In function ‘npreal_close’:
/root/moxa/npreal2.c:1065:34: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘stats’?
1065 | current->state = TASK_INTERRUPTIBLE;
| ^~~~~
| stats
Looks to me to be a problem with their code not supporting the version of gcc. I expect they have it coded for earlier gcc versions to compile it. From googling the errors, it seems at some point these were warning, but obviously as gcc has moved on, they have now become errors.
You could try testing and compiling on Rocky 8 which has an earlier kernel and gcc version to see if the same errors occur or not.
That said, they do clearly state that it’s been tested for kernel 5.13.4 so not sure how much support you will get from Moxa if it doesn’t work. Maybe contact their support team to get help with it.
Now I try compiling on Rocky 8 (kern 4.18.0-425.3.1.el8.x86_64) .
On a clean Rocky8 system I installed: make, kernel-headers , kernel-devel and download moxa-real-tty-drivers for kernel 4.x .
But when I try compile I get similar error:
# ./mxinst
===============================================================================
Copyright (C) 2002-2021 Moxa Inc.
All Rights Reserved.
MOXA NPort Server Real TTY Driver Ver4.1 Installation.
System Information: Kernel 4.18.0-425.3.1.el8.x86_64; Machine x86_64.
===============================================================================
Building driver...
If you want to use secure communication with target,
you might choose [y] to enable the SSL function.
Note: This function support RealCOM with secure mode only.
Do you want to enable secure function? [y/N].
n
KCPPFLAGS="-DRHEL8" make -C /lib/modules/4.18.0-425.3.1.el8.x86_64/build M=/root/driver/moxa/moxa modules
make[1]: Entering directory '/usr/src/kernels/4.18.0-425.3.1.el8.x86_64'
CC [M] /root/driver/moxa/moxa/npreal2.o
/root/driver/moxa/moxa/npreal2.c: In function ‘npreal_close’:
/root/driver/moxa/moxa/npreal2.c:1050:13: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
current->state = TASK_INTERRUPTIBLE;
^~~~~
__state
/root/driver/moxa/moxa/npreal2.c: In function ‘npreal_ldisc_flush_buffer’:
/root/driver/moxa/moxa/npreal2.c:1311:11: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
current->state = TASK_INTERRUPTIBLE;
^~~~~
__state
What on earth is a “Real TTY driver”? Is this exact driver available for public download?
The Rcoky 9 errors are incompatible pointer type, which used to be warnings, but maybe they made it more strict. It doesn’t like a signed int being assigned to an unsigned int.
On Rocky 8, it doesn’t seem to care about the pointers but obviously both of them dislike the struct member missing. Would help to know where this struct is declared.
One thing that jumps out is that you’re trying to build it as ‘root’, and generally this is considered to be bad. Instead, build as standard user and then install as root.
If you’re using secure boot, the module might refuse to install unless it’s signed.