Page 1 of 1

Peak Linux Driver failing to build on Raspbery Pi OS 64 bits

Posted: Fri 27. Nov 2020, 11:20
by dvilela
I would like to use a Peak CAN device on a Raspberry Pi 4. I thought the driver was included in the kernel, but I'm seeing so many posts here about compiling it, so I'm following this thread viewtopic.php?t=3381 to build the peak can driver 8.10.2 for Raspberry Pi OS 64 bits beta, and I'm getting the following error:

Code: Select all

ERROR: "__stack_chk_guard" [/home/pi/peak-linux-driver-8.10.2/driver/pcan.ko] undefined!
make[3]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make[2]: *** [Makefile:1645: modules] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-5.4.72-v8+'
make[1]: *** [Makefile:508: all] Error 2
make[1]: Leaving directory '/home/pi/peak-linux-driver-8.10.2/driver'
make: *** [Makefile:72: all] Error 2
Any help? Thank you!

Re: Peak Linux Driver failing to build on Raspbery Pi OS 64 bits

Posted: Fri 27. Nov 2020, 12:58
by M.Heidemann
Hello,

To further assess the issue, can please provide us with your command
history (and full output) regarding the compilation of the driver, so we can actually see the the command used for compiation?

Best Regards

Marvin

Re: Peak Linux Driver failing to build on Raspbery Pi OS 64 bits

Posted: Fri 27. Nov 2020, 18:03
by dvilela
I run succesfully the installation of required packages:

Code: Select all

- sudo apt get update
- sudo apt get upgrade
- reboot
- sudo apt-get install raspberrypi-kernel-headers
- sudo apt-get install libpopt-dev
And then proceeded to:

Code: Select all

- tar -xzf peak-linux-driver-8.9.0.tar.gz
- cd peak-linux-driver-8.9.0
- make clean
- make PCC=NO PCI=NO ISA=NO DNG=NO NET=NETDEV_SUPPORT
The full output for the last command (the only one that showed output I think):

Code: Select all

make[1]: Entering directory '/home/pi/peak-linux-driver-8.10.2/driver'
***
*** Making pcan driver in netdev mode
***
*** Host OS Release=Debian GNU/Linux v10
*** Host machine kernel version=5.4.72-v8+
*** Driver kernel version=5.4.72-v8+ (5.4.72)
*** Path to kernel sources=/usr/src/linux-headers-5.4.72-v8+
*** use KBUILD=yes
*** gcc version=8
***
make -C /usr/src/linux-headers-5.4.72-v8+  EXTRA_CFLAGS="-I/home/pi/peak-linux-driver-8.10.2/driver -DNO_DEBUG -DMODVERSIONS -DPARPORT_SUBSYSTEM -DUSB_SUPPORT -DNO -DNO_PCIEC_SUPPORT -DNO -DNO -DNO -DNETDEV_SUPPORT -DNO_RT   -Wno-date-time" V=0 modules M=/home/pi/peak-linux-driver-8.10.2/driver
make[2]: Entering directory '/usr/src/linux-headers-5.4.72-v8+'
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_main.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_fops.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_fifo.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_filter.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_parse.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_sja1000.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_common.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_timing.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcanfd_core.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcanfd_ucan.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_usb_core.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_usb.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_usbpro.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcanfd_usb.o
  CC [M]  /home/pi/peak-linux-driver-8.10.2/driver/src/pcan_netdev.o
  LD [M]  /home/pi/peak-linux-driver-8.10.2/driver/pcan.o
  Building modules, stage 2.
  MODPOST 1 modules
make[2]: Leaving directory '/usr/src/linux-headers-5.4.72-v8+'
make[1]: Leaving directory '/home/pi/peak-linux-driver-8.10.2/driver'
ERROR: "__stack_chk_guard" [/home/pi/peak-linux-driver-8.10.2/driver/pcan.ko] undefined!
make[3]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make[2]: *** [Makefile:1645: modules] Error 2
make[1]: *** [Makefile:508: all] Error 2
make: *** [Makefile:72: all] Error 2

Re: Peak Linux Driver failing to build on Raspbery Pi OS 64 bits

Posted: Mon 30. Nov 2020, 09:10
by M.Heidemann
Hello,

Please understand, that we cannot give support for prerelease/Beta versions of Raspberry PI OS.

The Raspberry PI OS community reports of similar issues with other software, seemingly related
to the fact the stack-protection feature of gcc seems to be activated by default on this release.

you could try building with the

Code: Select all

-fno-stack-protector
flag and see if that resolves the issue.

We unfortnately cannot provide further support, this
is only managble/possible with stable releases.

Best Regards

Marvin

Re: Peak Linux Driver failing to build on Raspbery Pi OS 64 bits

Posted: Mon 30. Nov 2020, 11:11
by dvilela
So I've switched over to the stable release (Raspberry Pi OS 32-bit) and got a different error.

Code: Select all

make[1]: Entering directory '/home/pi/peak-linux-driver-8.10.2/driver'
Makefile:117: *** "Unable to automatically find the Kernel headers. These are mandatory to build the pcan driver. Please set the KERNEL_LOCATION variable to the root directory of your own built Kernel.".  Stop.
make[1]: Leaving directory '/home/pi/peak-linux-driver-8.10.2/driver'
make: *** [Makefile:72: all] Error 2
I did not forget to

Code: Select all

sudo apt-get install raspberrypi-kernel-headers
. It seems there's a version mismatch between the headers installed and the kernel, so I had to rpi-update and also use rpi-source to install the appropiate headers. Now The driver builds successfully.

Re: Peak Linux Driver failing to build on Raspbery Pi OS 64 bits

Posted: Mon 30. Nov 2020, 11:45
by M.Heidemann
Hello,

Thank you for your feedback and providing us additional information.


Best Regards

Marvin