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: ...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Rick Farina (Zero_Chaos)
Depends on:
Blocks: lto
  Show dependency tree
Reported: 2022-07-29 07:19 UTC by Agostino Sarubbo
Modified: 2023-03-02 19:54 UTC (History)
1 user (show)

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

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

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

Issue: net-wireless/bladerf-2021.03 fails to compile (lto).
Discovered on: amd64 (internal ref: lto_tinderbox)

This machine uses lto with CFLAGS=-flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing

Here is a bit of explanation:

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.

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

Used to find possible runtime issues in packages. These bugs are a problem anyway but may be even worse when combined with LTO.

- 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:
Comment 1 Agostino Sarubbo gentoo-dev 2022-07-29 07:19:21 UTC
Created attachment 795395 [details]

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/ 
/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):

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

    net-wireless/bladerf: bump eapi, QA
    fix deps, add missing deps
    Signed-off-by: Rick Farina <>

 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

<     uint32_t fagc_lock_level;
>     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;