https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: net-analyzer/ntopng-5.2.1 fails to compile (lto). Discovered on: amd64 (internal ref: lto_tinderbox) NOTE: This machine uses lto with CFLAGS=-flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing Here is a bit of explanation: -Werror=lto-type-mismatch: User to find possible runtime issues in packages. It likely means the package is unsafe to build & use with LTO. For projects using the same identifier but with different types across different files, they must be fixed to be consistent across the codebase. -Werror=odr: Used to find possible runtime issues in packages. These bugs are a problem anyway but may be even worse when combined with LTO. C++ code must comply with the One Definition Rule (ODR) - see https://en.cppreference.com/w/cpp/language/definition#One_Definition_Rule. -Werror=strict-aliasing: Used to find possible runtime issues in packages. These bugs are a problem anyway but may be even worse when combined with LTO. Workarounds: - If upstream is friendly and still active, file a bug upstream. For emulators, codecs, games, or multimedia packages, it may be worth just applying a workaround instead, as upstreams sometimes aren't receptive to these bugs (VALID FOR ALL). - Use the new 'filter-lto' from flag-o-matic.eclass as it's likely to be unsafe with LTO (VALID FOR lto-type-mismatch - odr). - Fix it yourself if interested, of course (VALID FOR ALL). - Append-flags -fno-strict-aliasing (VALID FOR strict-aliasing). - Use memcpy() but a union is sometimes suitable too (VALID FOR strict-aliasing). - -fstrict-aliasing is implied by -O2, so this must be addressed in some form (VALID FOR strict-aliasing). See also: https://marc.info/?l=gentoo-dev&m=165639574126280&w=2
Created attachment 794564 [details] build.log build log and emerge --info
gcc14_tinderbox has reproduced this issue with version 5.6-r2 - Updating summary.
So... what can be done here? I am on GCC 13.2, stable. src/LuaEngineNtop.cpp: In function 'int ntop_rrd_tune(lua_State*)': src/LuaEngineNtop.cpp:5709:27: error: invalid conversion from 'char**' to 'const char**' [-fpermissive] 5709 | status = rrd_tune(argc, (char**)argv); | ^~~~~~~~~~~~ | | | char** In file included from src/LuaEngineNtop.cpp:25:
Created attachment 885477 [details, diff] Patch fixing this build error. I've also encountered this issue. I've created a quick and dirty patch removing const from enough variables to silence this error. After applying this patch I was able to build net-analyzer/ntopng-5.6-r2 on my system.
The error is pretty obviously not an LTO-specific error (and does indeed reproduce without -flto).
Upstream says: > I'm sorry, we won't be able to accept your fix because you are not > using the same RRD library we are using. If you look at > https://github.com/ntop/ntopng/blob/dev/third-party/rrdtool-1.4.8/src/rrd.h#L204 > if we accept your patch we'll break our code. Then they closed the issue as "works for me"... It's trivial to fix though, as I commented on the upstream bug report. It just needs to conditionalize the logic depending on whether the vendored copy is used.
Patch also works for me, but I'm curious, as the same version emerged without problem last October. Could the difference be due to a change in gcc version?