undefined reference to `zboss_signal_handler'

Hi,

I'm having an issue with linking a Zigbee application. I have a working Zigbee application that is compiled and linked successfully. That application has BLE and Zigbee working together and the whole project is based on a BLE example with a lot of modifications. We now need to add Matter over Thread to the same product. So I took the Matter example and modified it for our own board and got that working as well. Now what I want to do is share code between the BLE/Zigbee project and the Matter project (since Matter and Zigbee can't be both active). To do that I took the Matter code and started modifying that to take out all Matter parts and replace them with Zigbee. My plan is to have one project with two build configurations - one for Matter and one for Zigbee. I got the Zigbee code to finally compile with no errors but linking fails with the following errors:

/home/tiit/ncs/toolchains/e9dba88316/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: modules/nrfxlib/nrfxlib/zboss/production/src/libzboss-sources.a(zdo_commissioning_bdb.c.obj): in function `nwk_cancel_network_discovery_response':
/home/tiit/ncs/v2.7.0/nrfxlib/zboss/production/src/commissioning/bdb/zdo_commissioning_bdb.c:2769: undefined reference to `zboss_signal_handler'
/home/tiit/ncs/toolchains/e9dba88316/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/tiit/ncs/v2.7.0/nrfxlib/zboss/production/lib/cortex-m4/hard-float/libzboss.ed.a(zdo_app.ed.o): in function `zb_zdo_startup_complete_int':
zdo_app.c:(.text.zb_zdo_startup_complete_int+0x44): undefined reference to `zboss_signal_handler'
/home/tiit/ncs/toolchains/e9dba88316/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/tiit/ncs/v2.7.0/nrfxlib/zboss/production/lib/cortex-m4/hard-float/libzboss.ed.a(zdo_app.ed.o): in function `zb_nlme_status_indication_process':
zdo_app.c:(.text.zb_nlme_status_indication_process+0x9c): undefined reference to `zboss_signal_handler'
/home/tiit/ncs/toolchains/e9dba88316/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/tiit/ncs/v2.7.0/nrfxlib/zboss/production/lib/cortex-m4/hard-float/libzboss.ed.a(zdo_app_leave.ed.o): in function `zb_send_leave_signal':
zdo_app_leave.c:(.text.zb_send_leave_signal+0x20): undefined reference to `zboss_signal_handler'

The working Zigbee code is all in C files and links just fine. The Matter examples all use CPP files. I suspect something related to that or using sysbuild is what is breaking it for me. Unfortunately I have no real idea where to continue investigating the problem now. I really want to have one project that can be used for both Zigbee and Matter builds. I'm not very familiar with Zephyr or the whole new build system so any help or guidance would be very helpful for me. I could privately share the whole project if that would help see what I'm doing wrong here.

Or am I approaching this thing wrong? Is there a better way to do this code sharing?

Tiit

  • Hi Tilt,

    Or am I approaching this thing wrong? Is there a better way to do this code sharing?

    I am just speaking from experience here but normally I would want to have the reliable working project to be the base rather than the new project that hasn't stood the test of time. However, considering the Matter project is in CPP, I see why you would want to have that as the base.

    As for the linking issue, I recommend checking which file in your project has zboss_signal_handler defined; and the trace back the CMakeLists.txt to see if there is anything that could have made the file not compiled.

    Hieu 

Related