Open LeBirlante opened 2 days ago
That looks like the compiler being overly picky about the code. It seems to be complaining that the strncpy
will possibly overwrite the \0
nul terminator at the end of the string. However, on the very next line we add the terminator back:
strncpy(exported.networkName, inputTensorInfo.networkName.c_str(),sizeof(exported.networkName));
exported.networkName[sizeof(exported.networkName) - 1] = '\0';
I think you can either ignore this warning, or update the line to
strncpy(exported.networkName, inputTensorInfo.networkName.c_str(), sizeof(exported.networkName) - 1);
exported.networkName[sizeof(exported.networkName) - 1] = '\0';
Hi there,
I was trying to compile libcamera for my Zero 2W, so I basically dumped my SD card to an IMG file, mounted it on my desktop linux and chrooted it, allowing QEMU to handle the armv7l architecture.
Things were going along nicely, until this:
[6/11] Compiling C++ object src/ipa/rpi/cam_helper/librpi_ipa_cam_helper.a.p/cam_helper_imx500.cpp.o FAILED: src/ipa/rpi/cam_helper/librpi_ipa_cam_helper.a.p/cam_helper_imx500.cpp.o
.... .... ....
../src/ipa/rpi/cam_helper/cam_helper_imx500.cpp: In member function 'void CamHelperImx500::parseInferenceData(libcamera::Span, RPiController::Metadata&)':
../src/ipa/rpi/cam_helper/cam_helper_imx500.cpp:259:40: error: 'char strncpy(char, const char*, size_t)' specified bound 64 equals destination size [-Werror=stringop-truncation]
259 strncpy(exported.networkName, inputTensorInfo.networkName.c_str(),
cc1plus: all warnings being treated as errors ninja: build stopped: subcommand failed.
my C++ days are long gone, but would it be that the crux of the problem lies at the "specified bound 64 equals destination size", triggered due to using the -Werror=stringop-truncation compile option?
thanks for your time,