Every one of my generated include files contains these types of static_assert errors:
static_assert( NUNAVUT_SUPPORT_LANGUAGE_OPTION_OMIT_FLOAT_SERIALIZATION_SUPPORT == 0,
"<< MY DIRECTORY >>/directives/160.LightsCommand.1.0.uavcan is trying to use a serialization library that was compiled with "
"different language options. This is dangerous and therefore not allowed." );
Does anyone have an idea what might be going wrong? “OMIT_FLOAT_SERIALIZATION_SUPPORT” seems to be a hint, but I don’t know where to start looking.
Specifically the one I generated looks like this (with a bit of code removed, the defines are the important bit):
// UAVCAN common serialization support routines. +-+ +-+
// This file is based on canard_dsdl.h, which is part of Libcanard. | | | |
// \ - /
// AUTOGENERATED, DO NOT EDIT. ---
// o
//---------------------------------------------------------------------------------------------------------------------
// Language Options
// target_endianness: little
// omit_float_serialization_support: False
// enable_serialization_asserts: True
// enable_override_variable_array_capacity: False
// [some boilerplate here... ignoring so the post isn't huge]
static_assert(sizeof(size_t) >= sizeof(size_t),
"The bit-length type used by Nunavut, size_t, "
"is smaller than this platform's size_t type. "
"Nunavut serialization relies on size_t to size_t conversions "
"that do not lose data. You will need to regenerate Nunavut serialization support with a larger "
"unsigned_bit_length type specified.");
#define NUNAVUT_SUPPORT_LANGUAGE_OPTION_TARGET_ENDIANNESS 434322821
#define NUNAVUT_SUPPORT_LANGUAGE_OPTION_OMIT_FLOAT_SERIALIZATION_SUPPORT 0
#define NUNAVUT_SUPPORT_LANGUAGE_OPTION_ENABLE_SERIALIZATION_ASSERTS 1
#define NUNAVUT_SUPPORT_LANGUAGE_OPTION_ENABLE_OVERRIDE_VARIABLE_ARRAY_CAPACITY 0
// [the rest of the file]
You seem to be either not including this file (unlikely, the other asserts would be triggering as well, and you’d be getting an include error), or using the wrong version of the file. This should be in uavcan_messages/nunavut/support/serialization.h.
You can check to see if nunavut is generating serialization.h by adding the --list-outputs option to one of your commands. It should be generated every time you run nunavut, and if it isn’t, that may be your issue.
static_assert(sizeof(size_t) >= sizeof(size_t),
"The bit-length type used by Nunavut, size_t, "
"is smaller than this platform's size_t type. "
"Nunavut serialization relies on size_t to size_t conversions "
"that do not lose data. You will need to regenerate Nunavut serialization support with a larger "
"unsigned_bit_length type specified.");
. . .
// API usage errors:
#define NUNAVUT_ERROR_INVALID_ARGUMENT 2
#define NUNAVUT_ERROR_SERIALIZATION_BUFFER_TOO_SMALL 3
// Invalid representation (caused by bad input data, not API misuse):
#define NUNAVUT_ERROR_REPRESENTATION_BAD_ARRAY_LENGTH 10
#define NUNAVUT_ERROR_REPRESENTATION_BAD_UNION_TAG 11
#define NUNAVUT_ERROR_REPRESENTATION_BAD_DELIMITER_HEADER 12
. . .
// The rest of the file
I started the generation sequence by sending :
nnvg --target-language c --target-endianness=little --enable-serialization-asserts --list-outputs uavcan --outdir
uavcan_messages
The very last file listed in a HUGE list of .h’s was: uavcan_messages/nunavut/support/serialization.h
If it defines this macro as anything other than 0, then we’ve found the problem, and need to figure out why it’s generating this file differently. If it is 0, then you probably need to double-check your include paths.
I apologize for the silly question but is the assert actually triggered or are you just questioning why is it present in the generated code at all? Does the code compile?
I’m compiling/building in an Ubuntu terminal. I have generated include files that were done by a coworker that compile and run well. He has since left the company. The instructions he left to generate the files “work”, but the generated code will not compile (assertion errors). I’m left to clean up.