WCHSoftGroup / ch343ser_linux

USB driver for USB to serial chip ch342, ch343, ch344, ch9101, ch9102, ch9103, etc
125 stars 46 forks source link

Errors and failure Compiling Arch Linux from git as dkms #32

Closed snostormjp closed 5 months ago

snostormjp commented 8 months ago

Linux flexlinux 6.6.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 02 Jan 2024 02:28:28 +0000 x86_64 GNU/Linux

gcc 13.2.1-3

ch343ser-dkms-git r21.ad5828d-10 (+0 0.00) (Installed: r28.11d4652-1)

resulted in werror
/var/lib/dkms/ch343ser/28.11d4652/build/ch343.c:2004:18: error: initialization of ‘ssize_t ()(struct tty_struct , const u8 , size_t)’ {aka ‘long int ()(struct tty_struct , const unsigned char , long unsigned int)’} from incompatible pointer type ‘int ()(struct tty_struct , const unsigned char *, int)’ [-Werror=incompatible-pointer-types] 2004 | .write = ch343_tty_write, | ^~~~~~~

, adding KBUILD_CFLAGS = -Wno-error provided more but different warnings and errors ././include/linux/compiler_types.h:360:20: error: impossible constraint in ‘asm’ 360 | #define asm_inline asm inline | ^~~ ./arch/x86/include/asm/bug.h:28:9: note: in expansion of macro ‘asm_inline’ 28 | asm_inline volatile("1:\t" ins "\n" \ | ^~~~~~ ./arch/x86/include/asm/bug.h:83:9: note: in expansion of macro ‘_BUG_FLAGS’ 83 | _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ | ^~~~~~ ./include/asm-generic/bug.h:113:17: note: in expansion of macro ‘WARN_FLAGS’ 113 | __WARN_FLAGS(BUGFLAG_ONCE | \ | ^~~~ ./include/linux/thread_info.h:249:13: note: in expansion of macro ‘WARN_ON_ONCE’ 249 | if (WARN_ON_ONCE(bytes > INT_MAX))

d make -C /lib/modules/6.6.9-arch1-1/build M=/var/lib/dkms/ch343ser/28.11d4652/build modules make[1]: Entering directory '/usr/lib/modules/6.6.9-arch1-1/build' CC [M] /var/lib/dkms/ch343ser/28.11d4652/build/ch343.o /var/lib/dkms/ch343ser/28.11d4652/build/ch343.c:2004:18: error: initialization of ‘ssize_t ()(struct tty_struct , const u8 , size_t)’ {aka ‘long int ()(struct tty_struct , const unsigned char , long unsigned int)’} from incompatible pointer type ‘int ()(struct tty_struct , const unsigned char *, int)’ [-Werror=incompatible-pointer-types] 2004 | .write = ch343_tty_write, | ^~~~~~~ /var/lib/dkms/ch343ser/28.11d4652/build/ch343.c:2004:18: note: (near initialization for ‘ch343_ops.write’) cc1: some warnings being treated as errors make[3]: [scripts/Makefile.build:243: /var/lib/dkms/ch343ser/28.11d4652/build/ch343.o] Error 1 make[2]: [/usr/lib/modules/6.6.9-arch1-1/build/Makefile:1913: /var/lib/dkms/ch343ser/28.11d4652/build] Error 2 make[1]: [Makefile:234: __sub-make] Error 2 make[1]: Leaving directory '/usr/lib/modules/6.6.9-arch1-1/build' make: [Makefile:7: all] Error 2

WCHSoftGroup commented 8 months ago

It seems that there is a problem with your system environment. The error message does not point to the ch343.c file itself. Can compiling other drivers such as helloworld be successful?

snostormjp commented 8 months ago

I am uncertain why you think it is just my environment. All other dkms modules compile fine. I will try my Desktop but think it will provide same result. the Werror is with incompatible pointer type with tty_struct. I get the same error in clean download as normal user. Arch Linux generally has newer kernels and base package versions. I compile plenty of code from source, I have not looked to close yet as it has been a long time since I have done C coding, But wanted to open the issue here to document and inform other at least. If there are any recommended setting or flags that woud be helpful

snostormjp commented 8 months ago

Okay retried from my desktop, main difference is I have not updated it to 6.6.9 kernel itis still on 6.5.9 and compilation works. Will try 6.6.10 which is the new LTS maybe it is just 6.6.9 hoping I done need to roll back and can push forward.

snostormjp commented 8 months ago

No luck with 6.6.10 so the newer modules do break the driver build.
make -C /lib/modules/6.6.10-arch1-1/build M=/home/snostorm/Development/ch343ser_linux/driver make: Entering directory '/usr/lib/modules/6.6.10-arch1-1/build' CC [M] /home/snostorm/Development/ch343ser_linux/driver/ch343.o /home/snostorm/Development/ch343ser_linux/driver/ch343.c:2004:18: error: initialization of ‘ssize_t ()(struct tty_struct , const u8 , size_t)’ {aka ‘long int ()(struct tty_struct , const unsigned char , long unsigned int)’} from incompatible pointer type ‘int ()(struct tty_struct , const unsigned char *, int)’ [-Werror=incompatible-pointer-types] 2004 | .write = ch343_tty_write, | ^~~~~~~ /home/snostorm/Development/ch343ser_linux/driver/ch343.c:2004:18: note: (near initialization for ‘ch343_ops.write’) cc1: some warnings being treated as errors make[2]: [scripts/Makefile.build:243: /home/snostorm/Development/ch343ser_linux/driver/ch343.o] Error 1 make[1]: [/usr/lib/modules/6.6.10-arch1-1/build/Makefile:1913: /home/snostorm/Development/ch343ser_linux/driver] Error 2 make: *** [Makefile:234: __sub-make] Error 2 make: Leaving directory '/usr/lib/modules/6.6.10-arch1-1/build'

snostormjp commented 8 months ago

created pull request for fix