Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 863716

Summary: sys-apps/uutils-coreutils-0.0.14 fails to compile (lto): undefined reference to onig_region_free
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Luca Barbato <lu_zero>
Status: RESOLVED FIXED    
Severity: normal CC: sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 618550    
Attachments: build.log

Description Agostino Sarubbo gentoo-dev 2022-08-05 07:07:36 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: sys-apps/uutils-0.0.14 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-08-05 07:07:39 UTC
Created attachment 797818 [details]
build.log

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


          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/sys-apps/uutils-0.0.14/work/coreutils-0.0.14/target/release/deps/libonig-3ecdd96966c821df.rlib(onig-3ecdd96966c821df.onig.67290157-cgu.1.rcgu.o): in function `onig::Error::new':
          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: onig.67290157-cgu.1:(.text._ZN4onig5Regex20search_with_encoding17hd851970e63e9b550E.llvm.4542188737732145242+0x1c1): undefined reference to `onig_free_match_param'
          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: onig.67290157-cgu.1:(.text._ZN4onig5Regex20search_with_encoding17hd851970e63e9b550E.llvm.4542188737732145242+0x33): undefined reference to `onig_initialize_match_param'
          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: onig.67290157-cgu.1:(.text._ZN4onig5Regex20search_with_encoding17hd851970e63e9b550E.llvm.4542188737732145242+0x4c): undefined reference to `onig_get_encoding'
          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: onig.67290157-cgu.1:(.text._ZN4onig5Regex20search_with_encoding17hd851970e63e9b550E.llvm.4542188737732145242+0x53): undefined reference to `OnigEncodingUTF8'
          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: onig.67290157-cgu.1:(.text._ZN4onig5Regex20search_with_encoding17hd851970e63e9b550E.llvm.4542188737732145242+0x95): undefined reference to `onig_search_with_param'
          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: onig.67290157-cgu.1:(.text._ZN4onig5Regex20search_with_encoding17hd851970e63e9b550E.llvm.4542188737732145242+0xbc): undefined reference to `onig_free_match_param'
          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: onig.67290157-cgu.1:(.text._ZN4onig5Regex20search_with_encoding17hd851970e63e9b550E.llvm.4542188737732145242+0xdb): undefined reference to `OnigEncodingUTF8'
          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: onig.67290157-cgu.1:(.text._ZN4onig5Regex20search_with_encoding17hd851970e63e9b550E.llvm.4542188737732145242+0xec): undefined reference to `onig_get_encoding'
          /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../x86_64-pc-linux-gnu/bin/ld: onig.67290157-cgu.1:(.text._ZN4onig5Regex25with_options_and_encoding17ha248c0683d886993E+0xc6): undefined reference to `onig_new'
          onig.67290157-cgu.1:(.text._ZN4core3ptr41drop_in_place$LT$onig..region..Region$GT$17ha3cc0605c4cbe147E+0x4): undefined reference to `onig_region_free'
          onig.67290157-cgu.1:(.text._ZN4core3ptr50drop_in_place$LT$onig..match_param..MatchParam$GT$17h45ff8bed5892a8e2E+0x5): undefined reference to `onig_free_match_param'
          onig.67290157-cgu.1:(.text._ZN4onig4find29_$LT$impl$u20$onig..Regex$GT$8captures17h623e34308cfc2f0cE+0x9a): undefined reference to `onig_region_free'
          onig.67290157-cgu.1:(.text._ZN4onig5Error3new17h78cf2186aa1d5f41E+0x3f): undefined reference to `onig_error_code_to_str'
          onig.67290157-cgu.1:(.text._ZN4onig5Regex12captures_len17h82c120afbe3f968aE+0x6): undefined reference to `onig_number_of_captures'
          onig.67290157-cgu.1:(.text._ZN4onig5Regex20search_with_encoding17hd851970e63e9b550E.llvm.4542188737732145242+0x27): undefined reference to `onig_new_match_param'
          onig.67290157-cgu.1:(.text._ZN4onig5Regex25with_options_and_encoding17ha248c0683d886993E+0xb2): undefined reference to `OnigEncodingUTF8'
          onig.67290157-cgu.1:(.text._ZN4onig5Regex4find17h6cc55a86942553a1E+0x73): undefined reference to `onig_region_free'
          onig.67290157-cgu.1:(.text._ZN53_$LT$onig..Regex$u20$as$u20$core..ops..drop..Drop$GT$4drop17hba8c2f0fae4e332cE+0x5): undefined reference to `onig_free'
          onig.67290157-cgu.4:(.text._ZN4onig6syntax6Syntax4grep17hc8e41c954b13fbd1E+0x3): undefined reference to `OnigSyntaxGrep'
          onig.67290157-cgu.5:(.text._ZN62_$LT$onig..region..Region$u20$as$u20$core..ops..drop..Drop$GT$4drop17h11ef0e43e57a09aaE+0x4): undefined reference to `onig_region_free'
error: linking with `x86_64-pc-linux-gnu-gcc` failed: exit status: 1
Comment 3 Larry the Git Cow gentoo-dev 2024-03-05 04:48:44 UTC
The bug has been closed via the following commit(s):

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

commit c662838064b0e22645e922909f6dbab1dcab23c5
Author:     Eli Schwartz <eschwartz93@gmail.com>
AuthorDate: 2024-03-04 06:27:15 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-05 04:46:43 +0000

    sys-apps/uutils-coreutils: mark as LTO-unsafe
    
    Normally cargo.eclass sets this for us but we do not use
    cargo_src_compile.
    
    Closes: https://bugs.gentoo.org/863716
    Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/uutils-coreutils/uutils-coreutils-0.0.24.ebuild | 5 ++++-
 sys-apps/uutils-coreutils/uutils-coreutils-9999.ebuild   | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)