Skip to contentSkip to conversation

Header Conflicts Between C++ and Xenomai During Compilation

DISCUSSION [email protected] 2 participants 2 messages Feb 25, 2025

lore
Share & tools
lore
#0 lore raw

Hello Dear Xenomai supports,

I hope this email finds you well.

I am encountering issues while compiling a C++ application integrated with Xenomai 4, where the C++ headers conflict with the Xenomai kernel and user-space headers. Specifically, there are errors related to type definitions such as stdbool.h and bool, as well as undefined macros in the Xenomai kernel headers, like BITS_PER_LONG, ARM64_HAS_PAN, and __no_sanitize_or_inline. These conflicts seem to stem from mismatched header definitions between the standard C++ library and Xenomai's kernel-space headers, causing compilation failures.

So far I have tried undefining the functions as // Ensure kernel headers are excluded in user-space code #define __NO_KERNEL_HEADERS

#undef swap  // Undefine the kernel's swap macro to avoid conflicts
#undef min   // Undefine the kernel's min macro to avoid conflicts
#undef max   // Undefine the kernel's max macro to avoid conflicts, for some this fixes the uses but then I get the errors related to type definitions.

Could you please advise on how to resolve these conflicts, particularly in regard to header definitions between C++ and Xenomai? Is there anything I need to update while configuration setup to make sure that tehre is no conflict between C++ and Xenomai headers

Thanks and regards,
Akshay Vaghasiya

Deutsches Zentrum für Luft- und Raumfahrt e.V.(DLR)
German Aerospace Center
Institute of Software Technology | Flight Software | Lilenthalüplatz 7 | 38108 |Braunschweig | Germany Akshay Vaghasiya | Software Engineer (Master Thesis)

#1 lore raw
Quoted 13 lines · <[email protected]> writes:

Hello Dear Xenomai supports,

I hope this email finds you well.

I am encountering issues while compiling a C++ application integrated with Xenomai 4, where the C++ headers conflict with the Xenomai kernel and user-space headers. Specifically, there are errors related to type definitions such as stdbool.h and bool, as well as undefined macros in the Xenomai kernel headers, like BITS_PER_LONG, ARM64_HAS_PAN, and __no_sanitize_or_inline. These conflicts seem to stem from mismatched header definitions between the standard C++ library and Xenomai's kernel-space headers, causing compilation failures.

Quoted 8 lines

So far I have tried undefining the functions as // Ensure kernel headers are excluded in user-space code #define __NO_KERNEL_HEADERS

#undef swap  // Undefine the kernel's swap macro to avoid conflicts
#undef min   // Undefine the kernel's min macro to avoid conflicts
#undef max   // Undefine the kernel's max macro to avoid conflicts, for some this fixes the uses but then I get the errors related to type definitions.

Could you please advise on how to resolve these conflicts, particularly in regard to header definitions between C++ and Xenomai? Is there anything I need to update while configuration setup to make sure that tehre is no conflict between C++ and Xenomai headers

libevl does not use any kernel header. Could you please post the exact errors as output by the compiler?

Signature · 1 line
Philippe.