Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 861230 - net-analyzer/ntopng-5.6-r2 fails to compile: ntop_defines.h:494:99: error: invalid conversion from [-fpermissive]
Summary: net-analyzer/ntopng-5.6-r2 fails to compile: ntop_defines.h:494:99: error: in...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2022-07-26 12:22 UTC by Agostino Sarubbo
Modified: 2024-03-27 16:22 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,174.76 KB, text/plain)
2022-07-26 12:22 UTC, Agostino Sarubbo
Details
Patch fixing this build error. (ntopng.patch,1.91 KB, patch)
2024-02-19 22:00 UTC, ev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-07-26 12:22:51 UTC
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
Comment 1 Agostino Sarubbo gentoo-dev 2022-07-26 12:22:54 UTC
Created attachment 794564 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2024-01-28 16:24:05 UTC
gcc14_tinderbox has reproduced this issue with version 5.6-r2 - Updating summary.
Comment 3 Richard H. 2024-01-31 06:50:23 UTC
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:
Comment 4 ev 2024-02-19 22:00:01 UTC
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.
Comment 5 Eli Schwartz 2024-03-17 19:08:59 UTC
The error is pretty obviously not an LTO-specific error (and does indeed reproduce without -flto).
Comment 6 Eli Schwartz 2024-03-17 19:11:19 UTC
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.
Comment 7 Jack 2024-03-27 16:22:56 UTC
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?