Build errors for SierraLinuxQMIdrivers on Ubuntu-20.04 (focal)

While trying to build the SierraLinuxQMIdrivers version S2.42N2.62 against the linux kernel 5.4.0-39 from Ubuntu 20.04 Focal Fossa, I came across the following error in the build:

/MC7710/GobiNet/GobiUSBNet.c: In function ‘GobiUSBNetProbe’:
/MC7710/GobiNet/GobiUSBNet.c:3263:35: error: passing argument 1 of ‘wakeup_source_register’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 3263 |       ws = wakeup_source_register(szWakeSourceName);
      |                                   ^~~~~~~~~~~~~~~~
      |                                   |
      |                                   char *
In file included from ./include/linux/device.h:1337,
                 from ./include/linux/dma-mapping.h:7,
                 from ./include/linux/skbuff.h:31,
                 from ./include/linux/if_ether.h:19,
                 from ./include/linux/etherdevice.h:20,
                 from /MC7710/GobiNet/Structs.h:75,
                 from /MC7710/GobiNet/GobiUSBNet.c:86:
./include/linux/pm_wakeup.h:92:30: note: expected ‘struct device *’ but argument is of type ‘char *’
   92 | extern struct wakeup_source *wakeup_source_register(struct device *dev,
      |                              ^~~~~~~~~~~~~~~~~~~~~~
/MC7710/GobiNet/GobiUSBNet.c:3263:12: error: too few arguments to function ‘wakeup_source_register’
 3263 |       ws = wakeup_source_register(szWakeSourceName);
      |            ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/device.h:1337,
                 from ./include/linux/dma-mapping.h:7,
                 from ./include/linux/skbuff.h:31,
                 from ./include/linux/if_ether.h:19,
                 from ./include/linux/etherdevice.h:20,
                 from /MC7710/GobiNet/Structs.h:75,
                 from /MC7710/GobiNet/GobiUSBNet.c:86:
./include/linux/pm_wakeup.h:92:30: note: declared here
   92 | extern struct wakeup_source *wakeup_source_register(struct device *dev,
      |                              ^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:275: /MC7710/GobiNet/GobiUSBNet.o] Error 1
make[1]: *** [Makefile:1719: /MC7710/GobiNet] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-39-generic'
make: *** [Makefile:50: all] Error 2

The reason for the error seems pretty cut and dry (interface change in the Linux kernel) , but I have been known to make many many mistakes. The offending commit that introduced this change is
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/pm_wakeup.h?h=v5.4&id=c8377adfa78103be5380200eb9dab764d7ca890e

EDIT 1

The error comes from a line that is inside an #ifdef CONFIG_ANDROID. So I added the following at the beginning of the source file:

#ifdef CONFIG_ANDROID
#warning CONFIG_ANDROID is defined! This may not be android
#endif

The warning triggered on compile, despite this not being an Android build. However digging deeper into the kernel config for the ubuntu kernels, I found that this is always set to yes: CONFIG_ANDROID=y.

The code will definitely need another set of #ifdefs :woman_facepalming: :man_facepalming:

Regards,
Samveen

Is there any traction on this? I would love to get the 4G connection on my laptop working against the latest Ubuntu release kernels, instead of rebooting back to an older kernel when requiring 4G connectivity.

In hindsight, the title should have been Build Errors for SierraLinuxQMIDrivers against Kernel 5.4.0 and later, as this is not just an Ubuntu specific issue, but an issue caused by a kernel interface change.

Hi @samveen

The same issue with Linux QMI Driver S2.42N2.62 on Linux kernel 5.4.0-42 at my side. It is known issue. This issue will be resolved in a future release of the Linux QMI Driver.

Please help to tick “Solution” if your question is answered.

@Donald

The release notes say that the driver is updated to work all the way up to Kernel 5.6, which is why I was disappointed to find the issue. I tried to see if I could fix it with some trivial code, but the change is such that a trivial fix from someone not familiar with the inner workings of the device will definitely work.

Hi @samveen

It is a regression issue. This issue has been reported to the development team before. It will be resolved in a future release of the Linux QMI Driver.

According to Linux QMI Drivers - Customer Release Notes 1.44.pdf
https://source.sierrawireless.com/resources/airprime/software/release_notes/usb-drivers-linux-qmi-release-note-1,-d-,44/#sthash.M2W4aDB5.dpbs
2.2. SierraLinuxQMIdriversS2.42N2.62
2.2.1. Network Driver Changes
Compilation error on kernel v5.6

Please help to tick “Solution” if your question is answered.

1 Like

i am having the same error. GobiSerial make does not work.

khadas@Khadas:/media/khadas/disk/for_Linux/Sierra_Driver/GobiSerial$ sudo make
[sudo] password for khadas: 
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.* modules.order .cache.mk *.o.ur-safe
make -C /lib/modules/4.9.224/build M=/media/khadas/disk/for_Linux/Sierra_Driver/GobiSerial modules
make[1]: Entering directory '/usr/src/linux-headers-4.9.224'
  CC [M]  /media/khadas/disk/for_Linux/Sierra_Driver/GobiSerial/GobiSerial.o
/media/khadas/disk/for_Linux/Sierra_Driver/GobiSerial/GobiSerial.c:242:2: error: #warning "Assuming disc_mutex is locked external to the module" [-Werror=cpp]
 #warning "Assuming disc_mutex is locked external to the module"
  ^~~~~~~
cc1: all warnings being treated as errors
scripts/Makefile.build:340: recipe for target '/media/khadas/disk/for_Linux/Sierra_Driver/GobiSerial/GobiSerial.o' failed
make[2]: *** [/media/khadas/disk/for_Linux/Sierra_Driver/GobiSerial/GobiSerial.o] Error 1
Makefile:1653: recipe for target '_module_/media/khadas/disk/for_Linux/Sierra_Driver/GobiSerial' failed
make[1]: *** [_module_/media/khadas/disk/for_Linux/Sierra_Driver/GobiSerial] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.9.224'
Makefile:25: recipe for target 'all' failed
make: *** [all] Error 2

This has been fixed with SierraLinuxQMIdrivers version S2.42N2.63

No! Error continues

error continues in the same place

I tried on ubuntu 18, I don’t see such problem:


owner@ubuntu:~/QMI/SierraLinuxQMIdriversS2.42N2.64/GobiSerial$ make

rm -rf *.o ~ core .depend ..cmd *.ko .mod.c .tmp_versions Module. modules.order .cache.mk *.o.ur-safe

make -C /lib/modules/4.13.0-32-generic/build M=/home/owner/QMI/SierraLinuxQMIdriversS2.42N2.64/GobiSerial modules

make[1]: Entering directory ‘/usr/src/linux-headers-4.13.0-32-generic’

CC [M] /home/owner/QMI/SierraLinuxQMIdriversS2.42N2.64/GobiSerial/GobiSerial.o

/home/owner/QMI/SierraLinuxQMIdriversS2.42N2.64/GobiSerial/GobiSerial.c:242:2: warning: #warning “Assuming disc_mutex is locked external to the module” [-Wcpp]

#warning “Assuming disc_mutex is locked external to the module”

^~~~~~~

Building modules, stage 2.

MODPOST 1 modules

CC /home/owner/QMI/SierraLinuxQMIdriversS2.42N2.64/GobiSerial/GobiSerial.mod.o

LD [M] /home/owner/QMI/SierraLinuxQMIdriversS2.42N2.64/GobiSerial/GobiSerial.ko

make[1]: Leaving directory ‘/usr/src/linux-headers-4.13.0-32-generic’

owner@ubuntu:~/QMI/SierraLinuxQMIdriversS2.42N2.64/GobiSerial$ uname -r

4.13.0-32-generic

owner@ubuntu:~/QMI/SierraLinuxQMIdriversS2.42N2.64/GobiSerial$ uname -a

Linux ubuntu 4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

owner@ubuntu:~/QMI/SierraLinuxQMIdriversS2.42N2.64/GobiSerial$ lsb_release -a

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu Bionic Beaver (development branch)

Release: 18.04

Codename: bionic


@ [jyijyi] You don’t see the problem since you are running 18.04 and not 20.04. This thread has to do with the “make” process on 20.04. :grinning: The error continues in the same place

please post the full compilation log here.
Also which GobiNet version are you compiling?

BTW, you need to notice that Gobi driver has been end of life, you need to switch to MBPL driver