SDK 2.9.0 problem/bug linkage. Link twice the same library.

Dear Team.
There is a bug in the SDK starting from version 2.9.0 regarding the linkage of libraries.
Indeed, I have a CMakeLists.txt file that works perfectly and correctly links my library "libkineis.a" from version 2.6.2 to version 2.8.0 of the SDK.
However, in version 2.9.0 (or higher), the ccache command adds the library twice to the compilation, resulting in duplicate function errors.
The exact same CMakeList file works in version 2.8.0 and fails in version 2.9.0 and higher.

In CMakeLists.txt

  add_library(kineis_lib STATIC IMPORTED GLOBAL)
  set_target_properties(kineis_lib PROPERTIES IMPORTED_LOCATION ${LIB_KINEIS_DIR}/libkineis.a)
  target_link_libraries(app PRIVATE kineis_lib)
  target_link_options(app PUBLIC -Wl,--whole-archive ${LIB_KINEIS_DIR}/libkineis.a -Wl,--no-whole-archive)

ccache (fragment)

SDK 2.6.2
  && ccache /home/vincent/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
  -gdwarf-4 -Wl,--whole-archive /home/vincent/Projects/XXX/lib/Kineis/Lib/libkineis.a -Wl,--no-whole-archive
  zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf

SDK 2.9.1
  && ccache /home/vincent/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++ -Os -DNDEBUG
	-gdwarf-4 -Wl,--whole-archive /home/vincent/Projects/XXX/firmware/lib/Kineis/Lib/libkineis.a -Wl,--no-whole-archive
	-gdwarf-4 -Wl,--whole-archive /home/vincent/Projects/XXX/firmware/lib/Kineis/Lib/libkineis.a -Wl,--no-whole-archive
	zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf

Related