juliagoda / CH341SER

CH341SER driver with fixed bug

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to Compile on Ubuntu 16.04 LTS

brian00715 opened this issue · comments

~/Downloads/CH341SER-master$ sudo make
make -C /lib/modules/4.15.0-142-generic/build  M=/home/simon/Downloads/CH341SER-master 
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-142-generic'
  CC [M]  /home/simon/Downloads/CH341SER-master/ch34x.o
/home/simon/Downloads/CH341SER-master/ch34x.c:1292:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .write_room     = ch34x_write_room,
                    ^
/home/simon/Downloads/CH341SER-master/ch34x.c:1292:20: note: (near initialization for ‘ch34x_device.write_room’)
/home/simon/Downloads/CH341SER-master/ch34x.c:1293:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .chars_in_buffer = ch34x_chars_in_buffer,
                     ^
/home/simon/Downloads/CH341SER-master/ch34x.c:1293:21: note: (near initialization for ‘ch34x_device.chars_in_buffer’)
cc1: some warnings being treated as errors
scripts/Makefile.build:337: recipe for target '/home/simon/Downloads/CH341SER-master/ch34x.o' failed
make[2]: *** [/home/simon/Downloads/CH341SER-master/ch34x.o] Error 1
Makefile:1584: recipe for target '_module_/home/simon/Downloads/CH341SER-master' failed
make[1]: *** [_module_/home/simon/Downloads/CH341SER-master] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-142-generic'
Makefile:7: recipe for target 'default' failed
make: *** [default] Error 2
simon@ubuntu:~/Downloads/CH341SER-master$

Same issue in Ubuntu 20.04 LTS on raspberry pi arm64.

I changed the code a litte bit to make it compile on those systems. Just change the types of ch34x_write_room and
ch34x_chars_in_buffer to int instead of unsiged int.

This does indeed fix compilation. Thanks !

Also getting this on:
20.04.3 LTS (Focal Fossa)
CPU: Intel x64 i3-6100

I was able to fix the issue by downloading the official driver and then only replacing wait_queue_t wait; with wait_queue_entry_t wait; before running the make command.

#15

sorry for the late response

Hey, just wanted to let you know that I had to revert the changes of 45074ab to make it work on my Arch system.
Otherwise I get the initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ error.

Arch Linux, Kernel: 5.14.14-zen1-1-zen

Should I open a new issue? Would make sense I guess in case other Arch users get stuck on this and can fix it themselves without you having to work on it right now.
Edit: I just did it, won't hurt I guess.

Question for Ubuntu/Mint users. As a change made by the maintainer of this repository makes it impossible to build this on Arch Linux and therefore we would like to determine the culprit. I have two leads and would like to eliminate one of them.

Could you see if this solution works for you?

If it doesn't build up in you after this change, we can probably pinpoint the real cause of the problem.

I have tested for both cases - when there is a newer kernel with gcc and an older one, and it looks like the condition from the pull request adjusts correctly. Nevertheless, it would be good if others would confirm this. Users no longer need to clone the repo from @sirlucjan if they don't want to, because the changes were accepted in the pull request