Solvedklipper Error when compiling firmware on Raspberry Pi Zero W

When following the klipper installation process the firmware compilation step fails. After sending following the command to the Raspberry Pi the process ends with an error:

make flash FLASH_DEVICE=/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

Console output:

  Building out/autoconf.h
  Compiling out/src/sched.o
  Compiling out/src/command.o
  Compiling out/src/basecmd.o
  Compiling out/src/debugcmds.o
  Compiling out/src/initial_pins.o
  Compiling out/src/gpiocmds.o
  Compiling out/src/stepper.o
  Compiling out/src/endstop.o
  Compiling out/src/adccmds.o
  Compiling out/src/spicmds.o
  Compiling out/src/thermocouple.o
  Compiling out/src/i2ccmds.o
src/i2ccmds.c:14:23: error: field i2c_config has incomplete type
     struct i2c_config i2c_config;
                       ^
src/i2ccmds.c: In function command_config_i2c:
src/i2ccmds.c:23:23: warning: implicit declaration of function i2c_setup [-Wimplicit-function-declaration]
     i2c->i2c_config = i2c_setup(args[1], args[2], addr);
                       ^
src/i2ccmds.c: In function command_i2c_write:
src/i2ccmds.c:35:5: warning: implicit declaration of function i2c_write [-Wimplicit-function-declaration]
     i2c_write(i2c->i2c_config, data_len, data);
     ^
src/i2ccmds.c: In function command_i2c_read:
src/i2ccmds.c:48:5: warning: implicit declaration of function i2c_read [-Wimplicit-function-declaration]
     i2c_read(i2c->i2c_config, reg_len, reg, data_len, data);
     ^
make: *** [Makefile:64: out/src/i2ccmds.o] Error 1

There are no problems when connecting the OctoPrint with the printer.

Platform: Raspberry Pi Zero W
System: OctoPi 0.17.0
Printer: Anycubic Mega Zero 2.0

17 Answers

✔️Accepted Answer

The issue is that make menuconfig incidentally sets up the out/board symlink before opening the menu where you'd select the architecture (so it just appends an empty string to the source root):

$ ls -al out/
lrwxrwxrwx  1 pi pi   27 Dec 27 00:45 board -> /home/pi/Code/klipper2/src/ 

The makefile isn't set up so as to automatically regenerate it when the config changes, but the easy fix is to just run make clean and make again.

Other Answers:

Thanks for the fix. I had the same problem on my Pi 3. Maybe you could include "make clean" in the setup instructions. So people don't get discouraged when they are setting up for the first time.

had this issue with latest release. you should really put this in the install guide

This is still an issue with the latest version. This should be reopened @klipper-gitissuebot

Related Issues:

39
klipper Auto-reconnect
@Avalonnw I'm also one of the few people that actually switch off their printer but keep Klipper run...
30
klipper Error when compiling firmware on Raspberry Pi Zero W
The issue is that make menuconfig incidentally sets up the out/board symlink before opening the menu...
11
klipper SKR 1.4 Turbo - can't install Klipper / connect via USB
I'm running Klipper on a SKR 1.4 Turbo myself I would advise to delete Klipper do a fresh check out ...