peak-linux-driver-8.15.1 make problem on Debian 11

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
Fakier
Posts: 7
Joined: Thu 25. Aug 2022, 12:22

peak-linux-driver-8.15.1 make problem on Debian 11

Post by Fakier » Thu 22. Sep 2022, 11:51

Hello,
I'm trying to install driver on a debian os

Code: Select all

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
when set make command I get this error:

Code: Select all

make[1]: Entering directory '/home/rock/peak-linux-driver-8.15.1/driver'
***
*** Making pcan driver in chardev mode
***
*** Host OS Release=Debian GNU/Linux v11
*** Host machine kernel version=4.4.194-4-rk3399-rockchip-g5fbf835e0ac4
*** Driver kernel version=4.4.194-4-rk3399-rockchip-g5fbf835e0ac4 (4.4.194)
*** Path to kernel sources=/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4
*** use KBUILD=yes
*** use DKMS=
*** gcc version=10
***
make -C /usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4  EXTRA_CFLAGS="-I/home/rock/peak-linux-driver-8.15.1/driver -DNO_DEBUG -DMODVERSIONS -DNO_PARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DNO_DONGLE_SUPPORT -DNO_PCCARD_SUPPORT -DNO_NETDEV_SUPPORT -DNO_RT   -Wno-date-time" V=0 modules SUBDIRS=/home/rock/peak-linux-driver-8.15.1/driver
make[2]: Entering directory '/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4'
  CC [M]  /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o
/bin/sh: 1: ./scripts/recordmcount: Exec format error
make[3]: *** [scripts/Makefile.build:278: /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o] Error 126
make[3]: *** Deleting file '/home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o'
make[2]: *** [Makefile:1479: _module_/home/rock/peak-linux-driver-8.15.1/driver] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4'
make[1]: *** [Makefile:523: all] Error 2
make[1]: Leaving directory '/home/rock/peak-linux-driver-8.15.1/driver'
make: *** [Makefile:84: all] Error 2
what could be the probblem?

User avatar
S.Grosjean
Software Development
Software Development
Posts: 341
Joined: Wed 4. Jul 2012, 17:02

Re: peak-linux-driver-8.15.1 make problem on Debian 11

Post by S.Grosjean » Thu 22. Sep 2022, 14:06

Hi,

Code: Select all

/bin/sh: 1: ./scripts/recordmcount: Exec format error
"scripts" is a Kernel directory, the place from where all the driver modules are built. I don't know which is the Kernel headers package you have installed but it looks like it doesn't suit your system architecture.

Regards,
— Stéphane

Fakier
Posts: 7
Joined: Thu 25. Aug 2022, 12:22

Re: peak-linux-driver-8.15.1 make problem on Debian 11

Post by Fakier » Thu 22. Sep 2022, 14:40

linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4

right now I'am trying to make the same on

Code: Select all

NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
here is make result

Code: Select all

make[1]: Entering directory '/home/rock/peak-linux-driver-8.15.1/driver'
***
*** Making pcan driver in chardev mode
***
*** Host OS Release=Ubuntu v20.04
*** Host machine kernel version=4.4.194-4-rk3399-rockchip-g5fbf835e0ac4
*** Driver kernel version=4.4.194-4-rk3399-rockchip-g5fbf835e0ac4 (4.4.194)
*** Path to kernel sources=/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4
*** use KBUILD=yes
*** use DKMS=
*** gcc version=9
***
make -C /usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4  EXTRA_CFLAGS="-I/home/rock/peak-linux-driver-8.15.1/driver -DNO_DEBUG -DMODVERSIONS -DNO_PARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DNO_DONGLE_SUPPORT -DNO_PCCARD_SUPPORT -DNO_NETDEV_SUPPORT -DNO_RT   -Wno-date-time" V=0 modules SUBDIRS=/home/rock/peak-linux-driver-8.15.1/driver
make[2]: Entering directory '/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4'
/usr/bin/env: 'python': No such file or directory
  CC [M]  /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o
In file included from /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_common.h:39,
                 from /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.c:36:
include/linux/kernel.h:5:10: fatal error: stdarg.h: No such file or directory
    5 | #include <stdarg.h>
      |          ^~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:278: /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o] Error 1
make[2]: *** [Makefile:1479: _module_/home/rock/peak-linux-driver-8.15.1/driver] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4'
make[1]: *** [Makefile:523: all] Error 2
make[1]: Leaving directory '/home/rock/peak-linux-driver-8.15.1/driver'
make: *** [Makefile:84: all] Error 2
any solution?

Fakier
Posts: 7
Joined: Thu 25. Aug 2022, 12:22

Re: peak-linux-driver-8.15.1 make problem on Debian 11

Post by Fakier » Thu 22. Sep 2022, 14:55

I've included

Code: Select all

/usr/include/c++/9
/usr/include/c++/9/tr1
and now it looks like

Code: Select all

make[1]: Entering directory '/home/rock/peak-linux-driver-8.15.1/driver'
***
*** Making pcan driver in chardev mode
***
*** Host OS Release=Ubuntu v20.04
*** Host machine kernel version=4.4.194-4-rk3399-rockchip-g5fbf835e0ac4
*** Driver kernel version=4.4.194-4-rk3399-rockchip-g5fbf835e0ac4 (4.4.194)
*** Path to kernel sources=/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4
*** use KBUILD=yes
*** use DKMS=
*** gcc version=9
***
make -C /usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4  EXTRA_CFLAGS="-I/usr/include/c++/9/tr1 -I/usr/include/c++/9 -I/home/rock/peak-linux-driver-8.15.1/driver -DNO_DEBUG -DMODVERSIONS -DNO_PARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DNO_DONGLE_SUPPORT -DNO_PCCARD_SUPPORT -DNO_NETDEV_SUPPORT -DNO_RT   -Wno-date-time" V=0 modules SUBDIRS=/home/rock/peak-linux-driver-8.15.1/driver
make[2]: Entering directory '/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4'
/usr/bin/env: 'python': No such file or directory
  CC [M]  /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o
In file included from include/linux/kernel.h:6,
                 from /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_common.h:39,
                 from /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.c:36:
include/linux/linkage.h:7:10: fatal error: asm/linkage.h: No such file or directory
    7 | #include <asm/linkage.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:278: /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o] Error 1
make[2]: *** [Makefile:1479: _module_/home/rock/peak-linux-driver-8.15.1/driver] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4'
make[1]: *** [Makefile:523: all] Error 2
make[1]: Leaving directory '/home/rock/peak-linux-driver-8.15.1/driver'
make: *** [Makefile:84: all] Error 2

I've checked that in

Code: Select all

/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4/include
I have only

Code: Select all

asm-generic
there is no

Code: Select all

asm
generic,

is there any possibility to change makefile so it could compile on asm-generic?

User avatar
S.Grosjean
Software Development
Software Development
Posts: 341
Joined: Wed 4. Jul 2012, 17:02

Re: peak-linux-driver-8.15.1 make problem on Debian 11

Post by S.Grosjean » Thu 22. Sep 2022, 15:32

Hi,

The errors you've got clearly show that your kernel-header package either is not correctly installed or does not correspond to your host machine.

Code: Select all

include/linux/kernel.h:5:10: fatal error: stdarg.h: No such file or directory
    5 | #include <stdarg.h>
      |          ^~~~~~~~~~
Such an error in the Kernel means that your development suite is not correctly installed.

Code: Select all

/usr/bin/env: 'python': No such file or directory
Do you really read the error messages?

Code: Select all

/usr/include/c++/9
/usr/include/c++/9/tr1
I confess that I do not understand what you say you have done here... More precisely, I am afraid to understand...

Building the driver normally is very easy, especially on Debian Linux machines, when one reads "Documentation/PCAN-Driver-Linux_UserMan_eng.pdf" first.

Regards,
— Stéphane

Fakier
Posts: 7
Joined: Thu 25. Aug 2022, 12:22

Re: peak-linux-driver-8.15.1 make problem on Debian 11

Post by Fakier » Fri 23. Sep 2022, 10:26

Hello,
thank you for your answer,

right now post tittle is missleading, because right now I'm trying it on Ubuntu,

I'm trying it on a RockPI 4C+ device,
and I'm using a dedicated image

Code: Select all

rockpi-4cplus-ubuntu-focal-server-arm64-20220901-0254-gpt.img
and it looks like it is not well prepared, because stdarg.h is missing in

Code: Select all

linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4
directory.

Fakier
Posts: 7
Joined: Thu 25. Aug 2022, 12:22

Re: peak-linux-driver-8.15.1 make problem on Debian 11

Post by Fakier » Fri 23. Sep 2022, 10:35

Hello,

I have made a clean installation of rockpi-4cplus-ubuntu-focal-server-arm64-20220901-0254-gpt.img

and now I am getting error with recordmcount as it was in Debian

Code: Select all

make[1]: Entering directory '/home/rock/peak-linux-driver-8.15.1/driver'
***
*** Making pcan driver in chardev mode
***
*** Host OS Release=Ubuntu v20.04
*** Host machine kernel version=4.4.194-4-rk3399-rockchip-g5fbf835e0ac4
*** Driver kernel version=4.4.194 (4.4.194)
*** Path to kernel sources=/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4
*** use KBUILD=yes
*** use DKMS=
*** gcc version=9
***
make -C /usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4  EXTRA_CFLAGS="-I/home/rock/peak-linux-driver-8.15.1/driver -DNO_DEBUG -DMODVERSIONS -DNO_PARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DNO_DONGLE_SUPPORT -DNO_PCCARD_SUPPORT -DNO_NETDEV_SUPPORT -DNO_RT   -Wno-date-time" V=0 modules SUBDIRS=/home/rock/peak-linux-driver-8.15.1/driver
make[2]: Entering directory '/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4'
  CC [M]  /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o
/bin/sh: 1: ./scripts/recordmcount: Exec format error
make[3]: *** [scripts/Makefile.build:278: /home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o] Error 2
make[3]: *** Deleting file '/home/rock/peak-linux-driver-8.15.1/driver/src/pcan_main.o'
make[2]: *** [Makefile:1479: _module_/home/rock/peak-linux-driver-8.15.1/driver] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-4.4.194-4-rk3399-rockchip-g5fbf835e0ac4'
make[1]: *** [Makefile:523: all] Error 2
make[1]: Leaving directory '/home/rock/peak-linux-driver-8.15.1/driver'
make: *** [Makefile:84: all] Error 2
what could be the probblem?
Is it because not correct linux-headers?

Fakier
Posts: 7
Joined: Thu 25. Aug 2022, 12:22

Re: peak-linux-driver-8.15.1 make problem on Debian 11

Post by Fakier » Fri 23. Sep 2022, 14:01

Hello,
to resolve this I've made

Code: Select all

sudo -i

apt-get install libssl-dev build-essential -y
export HEADER_DIR=/usr/src/linux-headers-$(uname -r)
find "$HEADER_DIR/scripts" -type f | while read i; do if file -b $i | egrep -q "^ELF.*x86-64"; then rm "$i"; fi; done

cd $HEADER_DIR/scripts

gcc mkkrnlimg.c -o "$HEADER_DIR/scripts/mkkrnlimg"
gcc kallsyms.c -o "$HEADER_DIR/scripts/kallsyms"
gcc pnmtologo.c -o "$HEADER_DIR/scripts/pnmtologo"
gcc conmakehash.c -o "$HEADER_DIR/scripts/conmakehash"
gcc resource_tool.c -o "$HEADER_DIR/scripts/resource_tool"
gcc ./basic/bin2c.c -o "$HEADER_DIR/scripts/basic/bin2c"
gcc recordmcount.c -o "$HEADER_DIR/scripts/recordmcount"
gcc -I../tools/include sortextable.c -o "$HEADER_DIR/scripts/sortextable"
gcc unifdef.c -o "$HEADER_DIR/scripts/unifdef"
gcc ./basic/fixdep.c -o "$HEADER_DIR/scripts/basic/fixdep"
gcc extract-cert.c -o "$HEADER_DIR/scripts/extract-cert" -lssl -lcrypto
gcc ./mod/modpost.c ./mod/file2alias.c ./mod/sumversion.c -o "$HEADER_DIR/scripts/mod/modpost"
gcc ./mod/mk_elfconfig.c -o "$HEADER_DIR/scripts/mod/mk_elfconfig"
gcc  -I../include asn1_compiler.c -o "$HEADER_DIR/scripts/asn1_compiler"

ln -f ./genksyms/parse.tab.c_shipped ./genksyms/parse.tab.c;
ln  -f ./genksyms/parse.tab.h_shipped ./genksyms/parse.tab.h;
ln -f ./genksyms/lex.lex.c_shipped ./genksyms/lex.lex.c;
ln -f ./genksyms/keywords.hash.c_shipped ./genksyms/keywords.hash.c;
gcc ./genksyms/genksyms.c ./genksyms/parse.tab.c ./genksyms/lex.lex.c -o "$HEADER_DIR/scripts/genksyms/genksyms"

# Rebuild dkms Package (ex.)
sudo dpkg-reconfigure wireguard-dkms

deepakverma92
Posts: 5
Joined: Wed 14. Sep 2022, 14:33

Re: peak-linux-driver-8.15.1 make problem on Debian 11

Post by deepakverma92 » Wed 16. Nov 2022, 18:28

Hi Fakier,

had the same problem. This helped. Could you tell what you are doing in those steps, just for understanding?

Thanks & regards,
Deepak

User avatar
U.Wilhelm
Sales & Support
Sales & Support
Posts: 1588
Joined: Fri 10. Sep 2010, 19:34

Re: peak-linux-driver-8.15.1 make problem on Debian 11

Post by U.Wilhelm » Thu 24. Nov 2022, 09:26

deepakverma92 wrote:
Wed 16. Nov 2022, 18:28
Hi Fakier,

had the same problem. This helped. Could you tell what you are doing in those steps, just for understanding?

Thanks & regards,
Deepak
see code from Fakier...it is self explaining :)
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------

Post Reply