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

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
dvilela
Posts: 3
Joined: Fri 27. Nov 2020, 11:07

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

Post by dvilela » Fri 27. Nov 2020, 11:20

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!

M.Heidemann
Sales & Support
Sales & Support
Posts: 503
Joined: Fri 20. Sep 2019, 13:31

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

Post by M.Heidemann » Fri 27. Nov 2020, 12:58

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

dvilela
Posts: 3
Joined: Fri 27. Nov 2020, 11:07

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

Post by dvilela » Fri 27. Nov 2020, 18:03

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

M.Heidemann
Sales & Support
Sales & Support
Posts: 503
Joined: Fri 20. Sep 2019, 13:31

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

Post by M.Heidemann » Mon 30. Nov 2020, 09:10

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

dvilela
Posts: 3
Joined: Fri 27. Nov 2020, 11:07

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

Post by dvilela » Mon 30. Nov 2020, 11:11

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.

M.Heidemann
Sales & Support
Sales & Support
Posts: 503
Joined: Fri 20. Sep 2019, 13:31

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

Post by M.Heidemann » Mon 30. Nov 2020, 11:45

Hello,

Thank you for your feedback and providing us additional information.


Best Regards

Marvin

Post Reply