Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling fails on Ubuntu 20.04.3 LTS, Kernel 5.11.0-27-generic, Macbook A1534 #15

Closed
t1devel opened this issue Aug 29, 2021 · 3 comments

Comments

@t1devel
Copy link

t1devel commented Aug 29, 2021

I'm no software developer, so please let me know if there's any additional information I can provide.
It worked on kernel 5.8 but fails since update to 5.11

XXXXX@MacBook:~$ sudo apt update
[sudo] Passwort für XXXXX: 
OK:1 http://de.archive.ubuntu.com/ubuntu focal InRelease
OK:2 http://de.archive.ubuntu.com/ubuntu focal-updates InRelease                                                     
OK:3 http://de.archive.ubuntu.com/ubuntu focal-backports InRelease                                                   
OK:4 http://security.ubuntu.com/ubuntu focal-security InRelease                                                      
OK:5 https://linux.teamviewer.com/deb stable InRelease                                                               
OK:6 http://ppa.launchpad.net/unit193/encryption/ubuntu focal InRelease               
Paketlisten werden gelesen... Fertig                          
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
Alle Pakete sind aktuell.
XXXXX@MacBook:~$ sudo apt install wget make gcc linux-headers-generic
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
gcc ist schon die neueste Version (4:9.3.0-1ubuntu2).
make ist schon die neueste Version (4.2.1-1.2).
wget ist schon die neueste Version (1.20.3-1ubuntu1).
linux-headers-generic ist schon die neueste Version (5.4.0.81.85).
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
XXXXX@MacBook:~$ git clone https://github.com/leifliddy/macbook12-bluetooth-driver.git
Klone nach 'macbook12-bluetooth-driver' ...
remote: Enumerating objects: 181, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 181 (delta 1), reused 0 (delta 0), pack-reused 174
Empfange Objekte: 100% (181/181), 45.97 KiB | 2.00 MiB/s, fertig.
Löse Unterschiede auf: 100% (95/95), fertig.
XXXXX@MacBook:~$ cd macbook12-bluetooth-driver/
XXXXX@MacBook:~/macbook12-bluetooth-driver$ sudo ./install.bluetooth.sh 
--2021-08-29 20:52:17--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.11.0.tar.xz
Auflösen des Hostnamens cdn.kernel.org (cdn.kernel.org) … 2a04:4e42:3::432, 151.101.13.176
Verbindungsaufbau zu cdn.kernel.org (cdn.kernel.org)|2a04:4e42:3::432|:443... verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 404 Not Found
2021-08-29 20:52:18 FEHLER 404: Not Found.

--2021-08-29 20:52:18--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.11.tar.xz
Auflösen des Hostnamens cdn.kernel.org (cdn.kernel.org) … 2a04:4e42:3::432, 151.101.13.176
Verbindungsaufbau zu cdn.kernel.org (cdn.kernel.org)|2a04:4e42:3::432|:443... verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 117619104 (112M) [application/x-xz]
Wird in »build/linux-5.11.tar.xz« gespeichert.

linux-5.11.tar.xz             100%[===============================================>] 112,17M  21,5MB/s    in 5,4s    

2021-08-29 20:52:23 (20,9 MB/s) - »build/linux-5.11.tar.xz« gespeichert [117619104/117619104]

tar --strip-components=2 -xvf build/linux-5.11.tar.xz linux-5.11/drivers/bluetooth --directory=build/
linux-5.11/drivers/bluetooth/
linux-5.11/drivers/bluetooth/Kconfig
linux-5.11/drivers/bluetooth/Makefile
linux-5.11/drivers/bluetooth/ath3k.c
linux-5.11/drivers/bluetooth/bcm203x.c
linux-5.11/drivers/bluetooth/bfusb.c
linux-5.11/drivers/bluetooth/bluecard_cs.c
linux-5.11/drivers/bluetooth/bpa10x.c
linux-5.11/drivers/bluetooth/bt3c_cs.c
linux-5.11/drivers/bluetooth/btbcm.c
linux-5.11/drivers/bluetooth/btbcm.h
linux-5.11/drivers/bluetooth/btintel.c
linux-5.11/drivers/bluetooth/btintel.h
linux-5.11/drivers/bluetooth/btmrvl_debugfs.c
linux-5.11/drivers/bluetooth/btmrvl_drv.h
linux-5.11/drivers/bluetooth/btmrvl_main.c
linux-5.11/drivers/bluetooth/btmrvl_sdio.c
linux-5.11/drivers/bluetooth/btmrvl_sdio.h
linux-5.11/drivers/bluetooth/btmtksdio.c
linux-5.11/drivers/bluetooth/btmtkuart.c
linux-5.11/drivers/bluetooth/btqca.c
linux-5.11/drivers/bluetooth/btqca.h
linux-5.11/drivers/bluetooth/btqcomsmd.c
linux-5.11/drivers/bluetooth/btrsi.c
linux-5.11/drivers/bluetooth/btrtl.c
linux-5.11/drivers/bluetooth/btrtl.h
linux-5.11/drivers/bluetooth/btsdio.c
linux-5.11/drivers/bluetooth/btusb.c
linux-5.11/drivers/bluetooth/dtl1_cs.c
linux-5.11/drivers/bluetooth/h4_recv.h
linux-5.11/drivers/bluetooth/hci_ag6xx.c
linux-5.11/drivers/bluetooth/hci_ath.c
linux-5.11/drivers/bluetooth/hci_bcm.c
linux-5.11/drivers/bluetooth/hci_bcsp.c
linux-5.11/drivers/bluetooth/hci_h4.c
linux-5.11/drivers/bluetooth/hci_h5.c
linux-5.11/drivers/bluetooth/hci_intel.c
linux-5.11/drivers/bluetooth/hci_ldisc.c
linux-5.11/drivers/bluetooth/hci_ll.c
linux-5.11/drivers/bluetooth/hci_mrvl.c
linux-5.11/drivers/bluetooth/hci_nokia.c
linux-5.11/drivers/bluetooth/hci_qca.c
linux-5.11/drivers/bluetooth/hci_serdev.c
linux-5.11/drivers/bluetooth/hci_uart.h
linux-5.11/drivers/bluetooth/hci_vhci.c
make -C /lib/modules/5.11.0-27-generic/build M=/home/XXXXX/macbook12-bluetooth-driver/build/bluetooth-5.11.0 modules
make[1]: Verzeichnis „/usr/src/linux-headers-5.11.0-27-generic“ wird betreten
  CC [M]  /home/XXXXX/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ldisc.o
/home/XXXXX/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ldisc.c: In function ‘hci_uart_init’:
/home/XXXXX/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ldisc.c:836:23: error: assignment to ‘ssize_t (*)(struct tty_struct *, struct file *, unsigned char *, size_t,  void **, long unsigned int)’ {aka ‘long int (*)(struct tty_struct *, struct file *, unsigned char *, long unsigned int,  void **, long unsigned int)’} from incompatible pointer type ‘ssize_t (*)(struct tty_struct *, struct file *, unsigned char *, size_t)’ {aka ‘long int (*)(struct tty_struct *, struct file *, unsigned char *, long unsigned int)’} [-Werror=incompatible-pointer-types]
  836 |  hci_uart_ldisc.read  = hci_uart_tty_read;
      |                       ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:287: /home/XXXXX/macbook12-bluetooth-driver/build/bluetooth-5.11.0/hci_ldisc.o] Fehler 1
make[1]: *** [Makefile:1848: /home/XXXXX/macbook12-bluetooth-driver/build/bluetooth-5.11.0] Fehler 2
make[1]: Verzeichnis „/usr/src/linux-headers-5.11.0-27-generic“ wird verlassen
make: *** [Makefile:19: all] Fehler 2
cp hci_uart.ko /lib/modules/5.11.0-27-generic/updates
cp: Aufruf von stat für 'hci_uart.ko' nicht möglich: Datei oder Verzeichnis nicht gefunden
make: *** [Makefile:26: install] Fehler 1

contents of /lib/modules/5.11.0-27-generic/updates
insgesamt 144
lrwxrwxrwx 1 root root     70 Aug 29 19:08 snd-hda-codec-cirrus.ko -> /lib/modules/5.11.0-27-generic/updates/snd-hda-codec-cirrus.ko_speaker
-rw-r--r-- 1 root root 141104 Aug 29 19:08 snd-hda-codec-cirrus.ko_speaker
XXXXX@MacBook:~/macbook12-bluetooth-driver$ 
@dvilelaf
Copy link

dvilelaf commented Oct 7, 2021

Same here with 5.11.0-37 on Macbook Pro 2016 (13,1):

david@MacBookPro:~/Descargas/macbook12-bluetooth-driver-master$ sudo ./install.bluetooth.sh 
--2021-10-07 19:38:24--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.11.0.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.1.176, 151.101.65.176, 151.101.129.176, ...
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.1.176|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-10-07 19:38:24 ERROR 404: Not Found.

--2021-10-07 19:38:24--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.11.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.193.176, 151.101.129.176, 151.101.65.176, ...
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.193.176|:443... connected.
HTTP request sent, awaiting response... 416 Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

tar --strip-components=2 -xvf build/linux-5.11.tar.xz linux-5.11/drivers/bluetooth --directory=build/
linux-5.11/drivers/bluetooth/
linux-5.11/drivers/bluetooth/Kconfig
linux-5.11/drivers/bluetooth/Makefile
linux-5.11/drivers/bluetooth/ath3k.c
linux-5.11/drivers/bluetooth/bcm203x.c
linux-5.11/drivers/bluetooth/bfusb.c
linux-5.11/drivers/bluetooth/bluecard_cs.c
linux-5.11/drivers/bluetooth/bpa10x.c
linux-5.11/drivers/bluetooth/bt3c_cs.c
linux-5.11/drivers/bluetooth/btbcm.c
linux-5.11/drivers/bluetooth/btbcm.h
linux-5.11/drivers/bluetooth/btintel.c
linux-5.11/drivers/bluetooth/btintel.h
linux-5.11/drivers/bluetooth/btmrvl_debugfs.c
linux-5.11/drivers/bluetooth/btmrvl_drv.h
linux-5.11/drivers/bluetooth/btmrvl_main.c
linux-5.11/drivers/bluetooth/btmrvl_sdio.c
linux-5.11/drivers/bluetooth/btmrvl_sdio.h
linux-5.11/drivers/bluetooth/btmtksdio.c
linux-5.11/drivers/bluetooth/btmtkuart.c
linux-5.11/drivers/bluetooth/btqca.c
linux-5.11/drivers/bluetooth/btqca.h
linux-5.11/drivers/bluetooth/btqcomsmd.c
linux-5.11/drivers/bluetooth/btrsi.c
linux-5.11/drivers/bluetooth/btrtl.c
linux-5.11/drivers/bluetooth/btrtl.h
linux-5.11/drivers/bluetooth/btsdio.c
linux-5.11/drivers/bluetooth/btusb.c
linux-5.11/drivers/bluetooth/dtl1_cs.c
linux-5.11/drivers/bluetooth/h4_recv.h
linux-5.11/drivers/bluetooth/hci_ag6xx.c
linux-5.11/drivers/bluetooth/hci_ath.c
linux-5.11/drivers/bluetooth/hci_bcm.c
linux-5.11/drivers/bluetooth/hci_bcsp.c
linux-5.11/drivers/bluetooth/hci_h4.c
linux-5.11/drivers/bluetooth/hci_h5.c
linux-5.11/drivers/bluetooth/hci_intel.c
linux-5.11/drivers/bluetooth/hci_ldisc.c
linux-5.11/drivers/bluetooth/hci_ll.c
linux-5.11/drivers/bluetooth/hci_mrvl.c
linux-5.11/drivers/bluetooth/hci_nokia.c
linux-5.11/drivers/bluetooth/hci_qca.c
linux-5.11/drivers/bluetooth/hci_serdev.c
linux-5.11/drivers/bluetooth/hci_uart.h
linux-5.11/drivers/bluetooth/hci_vhci.c
make -C /lib/modules/5.11.0-37-generic/build M=/home/david/Descargas/macbook12-bluetooth-driver-master/build/bluetooth-5.11.0 modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-37-generic'
  CC [M]  /home/david/Descargas/macbook12-bluetooth-driver-master/build/bluetooth-5.11.0/hci_ldisc.o
/home/david/Descargas/macbook12-bluetooth-driver-master/build/bluetooth-5.11.0/hci_ldisc.c: In function 'hci_uart_init':
/home/david/Descargas/macbook12-bluetooth-driver-master/build/bluetooth-5.11.0/hci_ldisc.c:836:23: error: assignment to 'ssize_t (*)(struct tty_struct *, struct file *, unsigned char *, size_t,  void **, long unsigned int)' {aka 'long int (*)(struct tty_struct *, struct file *, unsigned char *, long unsigned int,  void **, long unsigned int)'} from incompatible pointer type 'ssize_t (*)(struct tty_struct *, struct file *, unsigned char *, size_t)' {aka 'long int (*)(struct tty_struct *, struct file *, unsigned char *, long unsigned int)'} [-Werror=incompatible-pointer-types]
  836 |  hci_uart_ldisc.read  = hci_uart_tty_read;
      |                       ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:288: /home/david/Descargas/macbook12-bluetooth-driver-master/build/bluetooth-5.11.0/hci_ldisc.o] Error 1
make[1]: *** [Makefile:1849: /home/david/Descargas/macbook12-bluetooth-driver-master/build/bluetooth-5.11.0] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-37-generic'
make: *** [Makefile:19: all] Error 2
cp hci_uart.ko /lib/modules/5.11.0-37-generic/updates
cp: cannot stat 'hci_uart.ko': No such file or directory
make: *** [Makefile:26: install] Error 1

contents of /lib/modules/5.11.0-37-generic/updates
total 768
-rw-r--r-- 1 root root 782872 Oct  7 19:23 snd-hda-codec-cirrus.ko

@leifliddy
Copy link
Owner

leifliddy commented Oct 7, 2021

This question has already been answered here:
#12
#13
#14

The issue only seems to occur on Debian-based systems and is a result of the stated kernel version not matching the kernel source. ie if your kernel version was actually 5.11.0-x then you wouldn't have this problem. Which is why I don't intend to create a "fix" for this issue.

Debian must have applied some patches from a newer kernel version or something.
You won't have this issue once you hit kernel 5.11.3

In the meantime, try performing the following

./install.bluetooth.sh
cd build/bluetooth-5.11.x
sed -i 's/size_t nr/size_t nt, void **cookie, unsigned long offset/' hci_ldisc.c
make
make install 

@dvilelaf
Copy link

dvilelaf commented Oct 7, 2021

Thanks, that worked like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants