https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: net-im/bitlbee-3.6-r1 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 794696 [details] build.log build log and emerge --info
I've not looked into the warning but.. 1. https://github.com/bitlbee/bitlbee/commit/129e2825aa6d5e1d34c58cec57a0db312ccc6b87 - this suggests they're open to fixes, yay! 2. They.. default to -fno-strict-aliasing? https://github.com/bitlbee/bitlbee/blob/cc0ad0aacf7e0cbea07e333642e006e1bb3ebee4/configure#L314. I'd look at why.
Related: https://github.com/bitlbee/bitlbee/pull/151. The issue is in a bundled lib.
(In reply to Sam James from comment #3) > Related: https://github.com/bitlbee/bitlbee/pull/151. > > The issue is in a bundled lib. It bundles this https://github.com/json-parser/json-parser, which is not in ::gentoo tree. I'll check if the upstream json-parser fixed this. Than we have two options 1. create new json-parser ebuild, apply PR151 to bitlbee and use system lib, 2. apply the patch to bundled json.
(In reply to Petr Vaněk from comment #4) > (In reply to Sam James from comment #3) > > Related: https://github.com/bitlbee/bitlbee/pull/151. > > > > The issue is in a bundled lib. > > It bundles this https://github.com/json-parser/json-parser, which is not in > ::gentoo tree. I'll check if the upstream json-parser fixed this. Than we > have two options > > 1. create new json-parser ebuild, apply PR151 to bitlbee and use system > lib, > 2. apply the patch to bundled json. I'd prefer 1 if possible. BTW, most recent commits for it even mention type punning, which is promising!
Proposed solution fix is in https://github.com/gentoo/gentoo/pull/26703. (In reply to Sam James from comment #2) > I've not looked into the warning but.. > 2. They.. default to -fno-strict-aliasing? > https://github.com/bitlbee/bitlbee/blob/ > cc0ad0aacf7e0cbea07e333642e006e1bb3ebee4/configure#L314. I'd look at why. I would say this is a historical relict https://github.com/bitlbee/bitlbee/commit/56f260affd91651cb0c44ee14713f7dfa0717ad4 I didn't hit any other error with -Werror=strict-aliasing
(In reply to Petr Vaněk from comment #6) > Proposed solution fix is in https://github.com/gentoo/gentoo/pull/26703. > > (In reply to Sam James from comment #2) > > I've not looked into the warning but.. > > 2. They.. default to -fno-strict-aliasing? > > https://github.com/bitlbee/bitlbee/blob/ > > cc0ad0aacf7e0cbea07e333642e006e1bb3ebee4/configure#L314. I'd look at why. > > I would say this is a historical relict > https://github.com/bitlbee/bitlbee/commit/ > 56f260affd91651cb0c44ee14713f7dfa0717ad4 I didn't hit any other error with > -Werror=strict-aliasing Works okay at runtime too? (And tests pass if any?) If so, they should really drop it.
(In reply to Sam James from comment #7) > (In reply to Petr Vaněk from comment #6) > > (In reply to Sam James from comment #2) > > > I've not looked into the warning but.. > > > 2. They.. default to -fno-strict-aliasing? > > > https://github.com/bitlbee/bitlbee/blob/ > > > cc0ad0aacf7e0cbea07e333642e006e1bb3ebee4/configure#L314. I'd look at why. > > > > I would say this is a historical relict > > https://github.com/bitlbee/bitlbee/commit/ > > 56f260affd91651cb0c44ee14713f7dfa0717ad4 I didn't hit any other error with > > -Werror=strict-aliasing > > Works okay at runtime too? (And tests pass if any?) It runs for me, but I don't use all features it provides. Unfortunately it does not provide any tests. > If so, they should really drop it. Well, my answer was not exact, upstream still has to use -fno-strict-aliasing because of bundled json-parser. They are hesitant about using the system one. Anyway, I'll submit PR from the patch I use for bitlbee-3.6-r2 and suggest to remove -fno-strict-aliasing as well.
Upstream PR: https://github.com/bitlbee/bitlbee/pull/162
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad699292711447f8983a44382c61c0dd00967145 commit ad699292711447f8983a44382c61c0dd00967145 Author: Petr Vaněk <arkamar@atlas.cz> AuthorDate: 2022-07-29 12:42:10 +0000 Commit: Joonas Niilola <juippis@gentoo.org> CommitDate: 2022-08-18 07:06:18 +0000 net-im/bitlbee: fix strict-aliasing issue in bundled library The patch is based on fixes from upstream. LICENSE is extended with BSD-2, the license of bundled library. Upstream-PR: https://github.com/bitlbee/bitlbee/pull/162 Closes: https://bugs.gentoo.org/861371 Signed-off-by: Petr Vaněk <arkamar@atlas.cz> Signed-off-by: Joonas Niilola <juippis@gentoo.org> net-im/bitlbee/bitlbee-3.6-r1.ebuild | 3 ++- .../files/bitlbee-3.6-strict-aliasing.patch | 31 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=90a3d5fff1c032b3b2de6133c6eb9c7711daccb9 commit 90a3d5fff1c032b3b2de6133c6eb9c7711daccb9 Author: Petr Vaněk <arkamar@atlas.cz> AuthorDate: 2022-08-01 14:10:01 +0000 Commit: Joonas Niilola <juippis@gentoo.org> CommitDate: 2022-08-18 07:06:18 +0000 net-im/bitlbee: Use system json-parser - Applied patch allows us to use system json-parser, it is based on upstream PR, see the link below - Dropped arm64, ppc, ppc64 and x86 keywords because newly introduced dev-libs/json-parser dependency has currently only ~amd64 keyword - EAPI 7 -> 8 Upstream-PR: https://github.com/bitlbee/bitlbee/pull/151 Bug: https://bugs.gentoo.org/861371 Signed-off-by: Petr Vaněk <arkamar@atlas.cz> Signed-off-by: Joonas Niilola <juippis@gentoo.org> net-im/bitlbee/bitlbee-3.6-r3.ebuild | 157 +++++++++++++++++++++ .../files/bitlbee-3.6-system-json-parser.patch | 82 +++++++++++ 2 files changed, 239 insertions(+) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d84addb0089529e1b6ef37cb19db59eb63a02cf commit 3d84addb0089529e1b6ef37cb19db59eb63a02cf Author: Petr Vaněk <arkamar@atlas.cz> AuthorDate: 2022-07-29 11:54:22 +0000 Commit: Joonas Niilola <juippis@gentoo.org> CommitDate: 2022-08-18 07:06:18 +0000 dev-libs/json-parser: new package, add 1.1.0_p20211208 Original version 1.1.0 is from a year 2014, which is quite old. The snapshot is from latest commit 531a49062975 ("Add author of #154 to AUTHORS") in master branch, which contains (among others) two fixes related to strict aliasing. New release is anticipated [1], but it is not clear when it will happen, as the ticket is open for 2 years already. It was necessary to apply one patch proposed as PR [2] to upstream, which changes pkgconfig file installation path from datadir to libdir. This library is currently known to be bundled in multiple packages in ::gentoo, see the corresponding bugs bellow. [1] https://github.com/json-parser/json-parser/issues/82 [2] https://github.com/json-parser/json-parser/pull/164 Bug: https://bugs.gentoo.org/858524 Bug: https://bugs.gentoo.org/861143 Bug: https://bugs.gentoo.org/861371 Signed-off-by: Petr Vaněk <arkamar@atlas.cz> Signed-off-by: Joonas Niilola <juippis@gentoo.org> dev-libs/json-parser/Manifest | 1 + .../files/json-parser-1.1.0-pkgconfig-libdir.patch | 22 ++++++ .../json-parser/json-parser-1.1.0_p20211208.ebuild | 82 ++++++++++++++++++++++ dev-libs/json-parser/metadata.xml | 15 ++++ 4 files changed, 120 insertions(+)