Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 861872 - net-wireless/bladerf-2021.03 fails to compile (lto): common.h:200:25: error: type of bladerf2_rfic_init_params_fastagc_burst does not match original declaration [-Werror=lto-type-mismatch]
Summary: net-wireless/bladerf-2021.03 fails to compile (lto): common.h:200:25: error: ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Rick Farina (Zero_Chaos)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2022-07-29 07:19 UTC by Agostino Sarubbo
Modified: 2024-03-12 03:31 UTC (History)
1 user (show)

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


Attachments
build.log (build.log,430.03 KB, text/plain)
2022-07-29 07:19 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-07-29 07:19:19 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: net-wireless/bladerf-2021.03 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-29 07:19:21 UTC
Created attachment 795395 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2022-07-29 07:19:23 UTC
Error(s) that match a know pattern in addition to what has been reported in the summary:


FAILED: host/output/libbladeRF.so.2 
/var/tmp/portage/net-wireless/bladerf-2021.03/work/bladeRF-2021.03/host/libraries/libbladeRF/src/board/bladerf2/common.h:200:25: error: type of ‘bladerf2_rfic_init_params_fastagc_burst’ does not match original declaration [-Werror=lto-type-mismatch]
Comment 3 Larry the Git Cow gentoo-dev 2023-02-16 02:59:26 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65bd64de57ef57f431b814ae031212f42aba2e70

commit 65bd64de57ef57f431b814ae031212f42aba2e70
Author:     Rick Farina <zerochaos@gentoo.org>
AuthorDate: 2023-02-16 02:33:10 +0000
Commit:     Rick Farina <zerochaos@gentoo.org>
CommitDate: 2023-02-16 02:59:17 +0000

    net-wireless/bladerf: bump eapi, QA
    
    fix deps, add missing deps
    Bug: https://bugs.gentoo.org/861872
    Signed-off-by: Rick Farina <zerochaos@gentoo.org>

 net-wireless/bladerf/bladerf-2021.03.ebuild | 7 ++++---
 net-wireless/bladerf/bladerf-9999.ebuild    | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
Comment 4 Rick Farina (Zero_Chaos) gentoo-dev 2023-02-16 14:48:24 UTC
Fun note, this only errors if you actually pass -flto, the -Werror lines don't catch it.  I'll pass this to upstream.
Comment 5 Rick Farina (Zero_Chaos) gentoo-dev 2023-03-02 19:00:53 UTC
upstream has informed me that they feel this is a compiler bug.  I tried to set CC and CXX to test with clang and it doesn't replicate the failure.  It does provide a related warning though
warning: unknown warning option '-Werror=lto-type-mismatch'; did you mean '-Werror=selector-type-mismatch'? [-Wunknown-warning-option]

Suggestions on how to continue?
Comment 6 Jannik Glückert 2023-03-02 19:54:18 UTC
This is NOT a compiler bug. The definitions of AD9361_InitParam differ.

The one defined in thirdparty/analogdevicesinc/no-OS/ad9361/sw/ad9361_api.h has size 528 bytes.

The one defined in fpga_common/include/ad936x.h has size 536 bytes.

The diff between these (smaller on the left) is

88d87
<     uint32_t fagc_lock_level;
170a170,175
>     uint8_t clk_out_drive;
>     uint8_t dataclk_drive;
>     uint8_t data_port_drive;
>     uint8_t clk_out_slew;
>     uint8_t dataclk_slew;
>     uint8_t data_port_slew;
Comment 7 Larry the Git Cow gentoo-dev 2024-03-12 03:31:20 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f408c3737cfb897bd18877458f28c03092620b74

commit f408c3737cfb897bd18877458f28c03092620b74
Author:     Eli Schwartz <eschwartz93@gmail.com>
AuthorDate: 2024-03-12 03:26:28 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-12 03:30:50 +0000

    net-wireless/bladerf: mark as LTO-unsafe
    
    Closes: https://bugs.gentoo.org/861872
    Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 net-wireless/bladerf/bladerf-2021.03-r1.ebuild | 7 ++++++-
 net-wireless/bladerf/bladerf-2023.02.ebuild    | 7 ++++++-
 net-wireless/bladerf/bladerf-9999.ebuild       | 7 ++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)