Skip to content

Changing a syscall API breaks the incremental build #89729

@dsch

Description

@dsch

Describe the bug
If a syscall interface changes (for example: adding a new parameter to an existing syscall) the generated syscall headers do not get updated.
This only applies while using Ninja as build system. It works with "Unix Makefile".

Testing under Ubuntu 24.04.

To Reproduce
Steps to reproduce the behavior:

  1. build any sample application for any platform:
    west build zephyr/samples/basic/blinky -b native_sim -- -G Ninja
  2. modify a syscall: for example add a new parameter to the gpio API.
    patch include/zephyr/drivers/gpio.h gpio.patch
  3. re-build the application (no "pristine" build")
    west build zephyr/samples/basic/blinky -b native_sim
  4. Build fails:
Error logs ``` [3/9] Building C object CMakeFiles/app.dir/src/main.c.obj FAILED: CMakeFiles/app.dir/src/main.c.obj ccache /usr/bin/gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -D__ZEPHYR__=1 -I/home/david/zephyrproject/build/zephyr/include/generated/zephyr -I/home/david/zephyrproject/zephyr/include -I/home/david/zephyrproject/build/zephyr/include/generated -I/home/david/zephyrproject/zephyr/soc/native/inf_clock -I/home/david/zephyrproject/zephyr/boards/native/native_sim -I/home/david/zephyrproject/zephyr/scripts/native_simulator/common/src/include -I/home/david/zephyrproject/zephyr/scripts/native_simulator/native/src/include -I/home/david/zephyrproject/custom/cannectivity/include -fno-strict-aliasing -Os -imacros /home/david/zephyrproject/build/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/david/zephyrproject/zephyr/samples/basic/blinky=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/david/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/david/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -m32 -msse2 -mfpmath=sse -fvisibility=hidden -fno-freestanding -std=c11 -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles/app.dir/src/main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c /home/david/zephyrproject/zephyr/samples/basic/blinky/src/main.c In file included from /home/david/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:1908, from /home/david/zephyrproject/zephyr/samples/basic/blinky/src/main.c:9: /home/david/zephyrproject/build/zephyr/include/generated/zephyr/syscalls/gpio.h:23:12: error: conflicting types for ‘z_impl_gpio_pin_interrupt_configure’; have ‘int(const struct device *, gpio_pin_t, gpio_flags_t)’ {aka ‘int(const struct device *, unsigned char, unsigned int)’} 23 | extern int z_impl_gpio_pin_interrupt_configure(const struct device * port, gpio_pin_t pin, gpio_flags_t flags); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/david/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:871:19: note: previous definition of ‘z_impl_gpio_pin_interrupt_configure’ with type ‘int(const struct device *, gpio_pin_t, gpio_flags_t, void *)’ {aka ‘int(const struct device *, unsigned char, unsigned int, void *)’} 871 | static inline int z_impl_gpio_pin_interrupt_configure(const struct device *port, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/david/zephyrproject/build/zephyr/include/generated/zephyr/syscalls/gpio.h:26:19: error: conflicting types for ‘gpio_pin_interrupt_configure’; have ‘int(const struct device *, gpio_pin_t, gpio_flags_t)’ {aka ‘int(const struct device *, unsigned char, unsigned int)’} 26 | static inline int gpio_pin_interrupt_configure(const struct device * port, gpio_pin_t pin, gpio_flags_t flags) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/david/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:866:15: note: previous declaration of ‘gpio_pin_interrupt_configure’ with type ‘int(const struct device *, gpio_pin_t, gpio_flags_t, void *)’ {aka ‘int(const struct device *, unsigned char, unsigned int, void *)’} 866 | __syscall int gpio_pin_interrupt_configure(const struct device *port, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/david/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:866:15: warning: ‘gpio_pin_interrupt_configure’ used but never defined [4/9] Building C object zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_emul.c.obj FAILED: zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_emul.c.obj ccache /usr/bin/gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/home/david/zephyrproject/build/zephyr/include/generated/zephyr -I/home/david/zephyrproject/zephyr/include -I/home/david/zephyrproject/build/zephyr/include/generated -I/home/david/zephyrproject/zephyr/soc/native/inf_clock -I/home/david/zephyrproject/zephyr/boards/native/native_sim -I/home/david/zephyrproject/zephyr/scripts/native_simulator/common/src/include -I/home/david/zephyrproject/zephyr/scripts/native_simulator/native/src/include -I/home/david/zephyrproject/custom/cannectivity/include -Wshadow -fno-strict-aliasing -Os -imacros /home/david/zephyrproject/build/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/david/zephyrproject/zephyr/samples/basic/blinky=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/david/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/david/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -m32 -msse2 -mfpmath=sse -fvisibility=hidden -fno-freestanding -std=c11 -MD -MT zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_emul.c.obj -MF zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_emul.c.obj.d -o zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_emul.c.obj -c /home/david/zephyrproject/zephyr/drivers/gpio/gpio_emul.c In file included from /home/david/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:1908, from /home/david/zephyrproject/zephyr/drivers/gpio/gpio_emul.c:10: /home/david/zephyrproject/build/zephyr/include/generated/zephyr/syscalls/gpio.h:23:12: error: conflicting types for ‘z_impl_gpio_pin_interrupt_configure’; have ‘int(const struct device *, gpio_pin_t, gpio_flags_t)’ {aka ‘int(const struct device *, unsigned char, unsigned int)’} 23 | extern int z_impl_gpio_pin_interrupt_configure(const struct device * port, gpio_pin_t pin, gpio_flags_t flags); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/david/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:871:19: note: previous definition of ‘z_impl_gpio_pin_interrupt_configure’ with type ‘int(const struct device *, gpio_pin_t, gpio_flags_t, void *)’ {aka ‘int(const struct device *, unsigned char, unsigned int, void *)’} 871 | static inline int z_impl_gpio_pin_interrupt_configure(const struct device *port, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/david/zephyrproject/build/zephyr/include/generated/zephyr/syscalls/gpio.h:26:19: error: conflicting types for ‘gpio_pin_interrupt_configure’; have ‘int(const struct device *, gpio_pin_t, gpio_flags_t)’ {aka ‘int(const struct device *, unsigned char, unsigned int)’} 26 | static inline int gpio_pin_interrupt_configure(const struct device * port, gpio_pin_t pin, gpio_flags_t flags) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/david/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:866:15: note: previous declaration of ‘gpio_pin_interrupt_configure’ with type ‘int(const struct device *, gpio_pin_t, gpio_flags_t, void *)’ {aka ‘int(const struct device *, unsigned char, unsigned int, void *)’} 866 | __syscall int gpio_pin_interrupt_configure(const struct device *port, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/david/zephyrproject/zephyr/include/zephyr/drivers/gpio.h:866:15: warning: ‘gpio_pin_interrupt_configure’ used but never defined ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/david/zephyrproject/build ```

Expected behavior

A change to the header file should rebuild the syscall header files and build the application without error.

Impact

A clean build is required to build the application after a changed syscall.

Environment (please complete the following information):

  • OS: Linux (Ubuntu 24.04)
  • Toolchain: Zephyr SDK (0.17.0)
  • latest main (0826996)

** Additional **

Patch file:

diff --git a/include/zephyr/drivers/gpio.h b/include/zephyr/drivers/gpio.h
index 3eed8194726..f3cb17defa1 100644
--- a/include/zephyr/drivers/gpio.h
+++ b/include/zephyr/drivers/gpio.h
@@ -865,11 +865,13 @@ static inline bool gpio_is_ready_dt(const struct gpio_dt_spec *spec)
  */
 __syscall int gpio_pin_interrupt_configure(const struct device *port,
 					   gpio_pin_t pin,
-					   gpio_flags_t flags);
+					   gpio_flags_t flags,
+					   void *dummy);
 
 static inline int z_impl_gpio_pin_interrupt_configure(const struct device *port,
 						      gpio_pin_t pin,
-						      gpio_flags_t flags)
+						      gpio_flags_t flags,
+						      void *dummy)
 {
 	const struct gpio_driver_api *api =
 		(const struct gpio_driver_api *)port->api;
@@ -950,9 +952,9 @@ static inline int z_impl_gpio_pin_interrupt_configure(const struct device *port,
  * @return a value from gpio_pin_interrupt_configure()
  */
 static inline int gpio_pin_interrupt_configure_dt(const struct gpio_dt_spec *spec,
-						  gpio_flags_t flags)
+						  gpio_flags_t flags, void* dummy)
 {
-	return gpio_pin_interrupt_configure(spec->port, spec->pin, flags);
+	return gpio_pin_interrupt_configure(spec->port, spec->pin, flags, dummy);
 }
 
 /**

Metadata

Metadata

Assignees

Labels

area: Build SystembugThe issue is a bug, or the PR is fixing a bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions