Unable to compile Raspberry Pi gateway from development due to too error: many initializers for ‘spi_ioc_transfer’
-
On MySensors development (fa673bdb3e50590df060855d03a850ad4677e26e) I am unable to compile the Raspberry Pi gateway. The same configuration compiles cleanly on MySensors master (2.1.1).
make clean; ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensors2Gateway --spi-driver=BCM && make [Cleaning] rm -rf build bin [SECTION] Detecting target machine. [OK] machine detected: SoC=BCM2836, Type=rpi2, CPU=armv7l. [SECTION] Detecting init system. [OK] init system detected: sysvinit. [SECTION] Saving configuration. [SECTION] Cleaning previous builds. [OK] Finished. gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi2\" -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensors2Gateway\" -DMY_LINUX_IS_SERIAL_PTY -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/log.c -o build/drivers/Linux/log.o g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi2\" -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensors2Gateway\" -DMY_LINUX_IS_SERIAL_PTY -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o g++ -MT build/drivers/Linux/noniso.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi2\" -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensors2Gateway\" -DMY_LINUX_IS_SERIAL_PTY -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/noniso.cpp -o build/drivers/Linux/noniso.o g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi2\" -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensors2Gateway\" -DMY_LINUX_IS_SERIAL_PTY -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o g++ -MT build/drivers/Linux/SPIDEV.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi2\" -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensors2Gateway\" -DMY_LINUX_IS_SERIAL_PTY -Ofast -g -Wall -Wextra -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SPIDEV.cpp -o build/drivers/Linux/SPIDEV.o drivers/Linux/SPIDEV.cpp:42:63: error: too many initializers for ‘spi_ioc_transfer’ Makefile:98: recipe for target 'build/drivers/Linux/SPIDEV.o' failed make: *** [build/drivers/Linux/SPIDEV.o] Error 1
I am running a bisect but it will take a while.
-
4c31e22d6ff45c3a4f8aa70f915c5f10fe345f64 is the first bad commit commit 4c31e22d6ff45c3a4f8aa70f915c5f10fe345f64 Author: Marcelo Aquino <marceloaqno@users.noreply.github.com> Date: Wed Apr 19 17:03:10 2017 -0300 Restructure RPi files (#827) - Restructure SPi files for linux and RPi - Update RPi revision detection (#826) :100644 100644 a0a4bd997d52c63dfcd0bcf8fcebe31b957452fb 66f31ae7c4c575d81ed3239c19cbc2e4fa87a431 M Makefile :100755 100755 e80113e3e3b768e3bc4c9f410eb8f84f72974984 f4a15ebc57265fbf4d73be4613459be51a07bfbe M configure :040000 040000 338e1fcb784275b97e4bcc67c6e83d49ffa3cdb5 3b062d65a39b2f6c5aa11237824f48b5dd3250fc M drivers bisect run success
@marceloaqno do you have any idea what went wrong?
development compiles OK if I revert 4c31e2
-
@mfalkvidd Could you check struct spi_ioc_transfer in /usr/include/linux/spi/spidev.h? It should look like this:
struct spi_ioc_transfer { __u64 tx_buf; __u64 rx_buf; __u32 len; __u32 speed_hz; __u16 delay_usecs; __u8 bits_per_word; __u8 cs_change; __u8 tx_nbits; __u8 rx_nbits; __u16 pad; /* If the contents of 'struct spi_ioc_transfer' ever change * incompatibly, then the ioctl number (currently 0) must change; * ioctls with constant size fields get a bit more in the way of * error checking than ones (like this) where that field varies. * * NOTE: struct layout is the same in 64bit and 32bit userspace. */ };
If not, try upgrading the linux-libc-dev package or the package responsible for the spidev.h file on your system (dpkg -S /usr/include/linux/spi/spidev.h)
-
dpkg -S /usr/include/linux/spi/spidev.h linux-libc-dev:armhf: /usr/include/linux/spi/spidev.h sudo apt-get update && apt-cache show linux-libc-dev:armhf Get:1 http://mirrordirector.raspbian.org wheezy Release.gpg [473 B] Hit http://repo.mosquitto.org wheezy Release.gpg Get:2 http://mirrordirector.raspbian.org wheezy Release [11.6 kB] Hit http://repo.mosquitto.org wheezy Release Hit http://archive.raspberrypi.org wheezy Release.gpg Get:3 http://mirrordirector.raspbian.org wheezy/main armhf Packages [7,678 kB] Hit http://archive.raspberrypi.org wheezy Release Hit http://repo.mosquitto.org wheezy/main armhf Packages Hit http://http.debian.net wheezy-backports Release.gpg Hit http://archive.raspberrypi.org wheezy/main armhf Packages Hit http://http.debian.net wheezy-backports Release Ign http://repo.mosquitto.org wheezy/main Translation-en_GB Ign http://repo.mosquitto.org wheezy/main Translation-en Hit http://http.debian.net wheezy-backports/main armhf Packages Hit http://http.debian.net wheezy-backports/main Translation-en Hit https://deb.nodesource.com wheezy Release.gpg Ign http://archive.raspberrypi.org wheezy/main Translation-en_GB Hit https://deb.nodesource.com wheezy Release Ign http://archive.raspberrypi.org wheezy/main Translation-en Hit https://deb.nodesource.com wheezy/main Sources Hit https://deb.nodesource.com wheezy/main armhf Packages Get:4 http://mirrordirector.raspbian.org wheezy/contrib armhf Packages [35.0 kB] Get:5 http://mirrordirector.raspbian.org wheezy/non-free armhf Packages [73.6 kB] Get:6 http://mirrordirector.raspbian.org wheezy/rpi armhf Packages [592 B] Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/main Translation-en Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en Ign https://deb.nodesource.com wheezy/main Translation-en_GB Ign https://deb.nodesource.com wheezy/main Translation-en Fetched 7,799 kB in 17s (441 kB/s) Reading package lists... Done Package: linux-libc-dev Source: linux Version: 3.16.39-1+deb8u1~bpo70+1 Installed-Size: 3300 Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org> Architecture: armhf Replaces: linux-kernel-headers Provides: linux-kernel-headers Conflicts: linux-kernel-headers Description-en: Linux support headers for userspace development This package provides userspaces headers from the Linux kernel. These headers are used by the installed headers for GNU libc and other system libraries. Multi-Arch: same Homepage: https://www.kernel.org/ Description-md5: f310daf8fb891639ee6eeeb4020a7c13 Section: devel Priority: optional Filename: pool/main/l/linux/linux-libc-dev_3.16.39-1+deb8u1~bpo70+1_armhf.deb Size: 1027158 MD5sum: 16c990f08dcb1cfdac1703a568b58d34 SHA1: 5bb6ea749a6dcaf55be491549315634f105cefbc SHA256: 99039188a214135e1e56bdfd01de91bf49c6f97cf0de549e4cb16b56a79179d9 Package: linux-libc-dev Source: linux Version: 3.2.51-1+rpi1 Architecture: armhf Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org> Installed-Size: 2821 Conflicts: linux-kernel-headers Replaces: linux-kernel-headers Provides: linux-kernel-headers Multi-Arch: same Priority: optional Section: devel Filename: pool/main/l/linux/linux-libc-dev_3.2.51-1+rpi1_armhf.deb Size: 791268 SHA256: 6716474c746fa027e5f3fa55e5a1844e0218c8aa8f27d4d37c62d6a440060918 SHA1: bd674821179b0d0ffad1ec1fb8f553b9b1c0825e MD5sum: 85b51d1d8561fe8a4125a2916a7afef4 Description-en: Linux support headers for userspace development This package provides userspaces headers from the Linux kernel. These headers are used by the installed headers for GNU libc and other system sudo apt-get upgrade linux-libc-dev:armhf Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. sudo apt-get upgrade linux-libc-dev Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
/usr/include/linux/spi/spidev.h:
struct spi_ioc_transfer { __u64 tx_buf; __u64 rx_buf; __u32 len; __u32 speed_hz; __u16 delay_usecs; __u8 bits_per_word; __u8 cs_change; __u32 pad; /* If the contents of 'struct spi_ioc_transfer' ever change * incompatibly, then the ioctl number (currently 0) must change; * ioctls with constant size fields get a bit more in the way of * error checking than ones (like this) where that field varies. * * NOTE: struct layout is the same in 64bit and 32bit userspace. */ };
-
@mfalkvidd It looks like your system has two versions available for linux-libc-dev:
3.2.51 and 3.16.39
Is it version 3.2.51 that is installed?sudo apt-cache policy linux-libc-dev
Try to force the update to 3.16.
-
Thanks @marceloaqno, the gateway compiles fine now (at fa673bdb3e5)
In case anyone else runs into this problem, this is what I did:pi@raspberrypi ~ $ sudo apt-cache policy linux-libc-dev linux-libc-dev: Installed: 3.2.51-1+rpi1 Candidate: 3.2.51-1+rpi1 Version table: 3.16.39-1+deb8u1~bpo70+1 0 100 http://http.debian.net/debian/ wheezy-backports/main armhf Packages *** 3.2.51-1+rpi1 0 500 http://mirrordirector.raspbian.org/raspbian/ wheezy/main armhf Packages 100 /var/lib/dpkg/status pi@raspberrypi ~ $ sudo apt-get install linux-libc-dev=3.16.39-1+deb8u1~bpo70+1 Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be upgraded: linux-libc-dev 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 1,027 kB of archives. After this operation, 490 kB of additional disk space will be used. Get:1 http://http.debian.net/debian/ wheezy-backports/main linux-libc-dev armhf 3.16.39-1+deb8u1~bpo70+1 [1,027 kB] Fetched 1,027 kB in 0s (1,259 kB/s) (Reading database ... 63731 files and directories currently installed.) Preparing to replace linux-libc-dev:armhf 3.2.51-1+rpi1 (using .../linux-libc-dev_3.16.39-1+deb8u1~bpo70+1_armhf.deb) ... Unpacking replacement linux-libc-dev:armhf ... Setting up linux-libc-dev:armhf (3.16.39-1+deb8u1~bpo70+1) ...