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

[BUG] is_power_of_2 of nuttx conflict #13757

Closed
1 task done
nicolas71640 opened this issue Sep 30, 2024 · 5 comments
Closed
1 task done

[BUG] is_power_of_2 of nuttx conflict #13757

nicolas71640 opened this issue Sep 30, 2024 · 5 comments
Assignees
Labels
Arch: all Issues that apply to all architectures blocker Release Blocker

Comments

@nicolas71640
Copy link
Contributor

Description / Steps to reproduce the issue

The compilation of botan with nuttx fails. It comes with the redefinition of is_power_of_2 function : declared in botan AND in nuttx int math32.h.

Here's the error with the chain of includes.

In file included from /build/nuttx/include/nuttx/clock.h:36,
                 from /build/nuttx/include/nuttx/semaphore.h:33,
                 from /build/nuttx/include/nuttx/mutex.h:31,
                 from /build/nuttx/include/nuttx/fs/fs.h:39,
                 from /build/nuttx/include/stdio.h:34,
                 from /build/nuttx/include/wchar.h:35,
                 from /build/nuttx/include/cxx/cwchar:30,
                 from /install/arm-none-eabi/include/c++/12.3.1/bits/postypes.h:40,
                 from /install/arm-none-eabi/include/c++/12.3.1/iosfwd:40,
                 from /install/arm-none-eabi/include/c++/12.3.1/ios:38,
                 from /install/arm-none-eabi/include/c++/12.3.1/ostream:38,
                 from /install/arm-none-eabi/include/c++/12.3.1/bits/unique_ptr.h:41,
                 from /install/arm-none-eabi/include/c++/12.3.1/memory:75,
                 from build/include/botan/types.h:17,
                 from build/include/botan/secmem.h:11,
                 from build/include/botan/symkey.h:11,
                 from build/include/botan/sym_algo.h:11,
                 from build/include/botan/block_cipher.h:11,
                 from build/include/botan/aes.h:11,
                 from src/lib/block/aes/aes.cpp:7:
build/include/botan/internal/bit_ops.h:43:39: error: expected ')' before 'arg'
   43 | inline constexpr bool is_power_of_2(T arg)

From what I understand, the nuttx libc shouldn't defined public functions outside of the one defines by the libc standard.

Any ideas how can we fix that ?

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Ubuntu 22

NuttX Version

master

Issue Architecture

[Arch: all]

Issue Area

[Area: Other]

Verification

  • I have verified before submitting the report.
@github-actions github-actions bot added the Arch: all Issues that apply to all architectures label Sep 30, 2024
@TimJTi
Copy link
Contributor

TimJTi commented Sep 30, 2024

I had similar using LVGL (with the OS set to NuttX) also down to a conflict with a math32 function. I raised an issue on LVGL here

The proposal there was to rename.

I originally thought that it was incorrect use of static but I should have thought harder first. The scope of static is OK, and that's what LVGL used (in my case) but the math32.h uses #define macros for functions so the scope is pre-compile so will interfere with other libraries I think?

Should this NuttX library have "proper" static functions not #defines for these?

All a bit beyond my 2immediately to hand" experience so relying on a bit of Googling to refresh my aging memory, but surely there shouldn't be such library conflicts?

@xiaoxiang781216
Copy link
Contributor

@GUIDINGLI look at this problem.

@TimJTi
Copy link
Contributor

TimJTi commented Oct 1, 2024

Also, [BUG] Compile warning due to __CONCAT redefinition #13562 is possibly related given the prevalence of #define functions/helpers in NuttX?

@GUIDINGLI
Copy link
Contributor

How about this:
#13864

@xiaoxiang781216 xiaoxiang781216 added the blocker Release Blocker label Oct 7, 2024
@GUIDINGLI
Copy link
Contributor

Resolve, see the comments above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: all Issues that apply to all architectures blocker Release Blocker
Projects
None yet
Development

No branches or pull requests

4 participants