Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: system call error processing #776

Closed

Conversation

WilliamGFish
Copy link

OK, found the issue, it relates to PR #586 ( Fix system calls return error processing)

Causes compilation errors:

C:/gnu_arm_embedded_13/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.bfd.exe: modules/zenoh-pico/lib..__external__zenoh-pico__zephyr.a(system.c.obj): in function _z_task_init': C:/zephyr/external/zenoh-pico/src/system/zephyr/system.c:83:(.text._z_task_init+0x3c): undefined reference to _z_report_system_error'

They are calling a function within a Marco which causes a compilation problem:

void _z_report_system_error(int errcode);

#define _Z_CHECK_SYS_ERR(expr)             \
    do {                                   \
        int __res = expr;                  \
        if (__res != 0) {                  \
            _z_report_system_error(__res); \
            return _Z_ERR_SYSTEM_GENERIC;  \
        }                                  \
        return _Z_RES_OK;                  \
    } while (false)

Unfortunately, #define is a pre-processor directive used in C programs to define macros so the function has not been defined. Removing the function call and some logic amends it could be:

#define _Z_CHECK_SYS_ERR(expr)            \
    do {                                  \
        int __res = expr;                 \
        if (__res > 0) {                  \
            return _Z_ERR_SYSTEM_GENERIC; \
        }                                 \
        return __res;                     \
    } while (false)

Fixes Issue: #775 [Bug] zenoh-pico: zephyr: Compilation Errors

Billy..

Copy link

github-actions bot commented Nov 6, 2024

PR missing one of the required labels: {'internal', 'dependencies', 'documentation', 'enhancement', 'bug', 'breaking-change', 'new feature'}

@sashacmc
Copy link
Member

sashacmc commented Nov 6, 2024

The problem is that platform_common.c (where _z_report_system_error is defined) is not included in CMakeLists.txt for zephyr, thanks for pointing that out.
Here is the fix, please check that it works for you: #778

@sashacmc sashacmc closed this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants