Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 757681 - dev-libs/icu: strict flags break cross-compiling with LTO
Summary: dev-libs/icu: strict flags break cross-compiling with LTO
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Cross compilation support
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2020-11-29 22:29 UTC by David Michael
Modified: 2024-03-11 22:49 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Michael 2020-11-29 22:29:54 UTC
The --enable-strict flag is unspecified in the ebuild, so it defaults to "yes", which adds -std=c11 to CFLAGS:

https://github.com/unicode-org/icu/blob/master/icu4c/source/acinclude.m4#L472

With -std=c11, the __USE_MISC feature macro is undefined.  The required macros for the autoconf AC_C_BIGENDIAN test are gated on "#ifdef __USE_MISC" in <endian.h>:

https://github.com/unicode-org/icu/blob/master/icu4c/source/configure#L6593-L6597

Since that test fails, the fallback test tries to grep for strings in a compiled object file.  That fails because of LTO mangling the file's constants, and it can't run a final fallback test with native execution because of cross-compiling.

Reproducible: Always

Steps to Reproduce:
1. CFLAGS=-flto cross-emerge -v dev-libs/icu

Actual Results:  
checking whether byte ordering is bigendian... unknown
configure: error: unknown endianness
 presetting ac_cv_c_bigendian=no (or yes) will help

Expected Results:  
It should build and install.

There are a few workarounds like setting EXTRA_ECONF=--disable-strict or ac_cv_c_bigendian=no in the environment or disabling LTO, but I don't know what would be an acceptable fix to apply to the ebuild.  Maybe this combo would be the least intrusive:

tc-is-cross-compiler && is-flagq "-flto*" && myeconfargs+=( --disable-strict )
Comment 1 Larry the Git Cow gentoo-dev 2021-03-22 10:06:59 UTC
The bug has been closed via the following commit(s):

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

commit a4484fc63431d84fd0b366557d1c8a5df964d1c0
Author:     David Michael <fedora.dm0@gmail.com>
AuthorDate: 2021-03-22 10:06:22 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2021-03-22 10:06:22 +0000

    dev-libs/icu: work around cross-endian tests failing
    
    The tests need __USE_MISC, which is undefined by -std=c11, which is
    added by --enable-strict, which is the default setting.  There are
    fallback tests that work for native builds and non-LTO builds, but
    this specific case has no fallback and requires this workaround.
    
    Closes: https://bugs.gentoo.org/757681
    Package-Manager: Portage-3.0.13, Repoman-3.0.2
    Signed-off-by: David Michael <fedora.dm0@gmail.com>
    Signed-off-by: David Seifert <soap@gentoo.org>

 dev-libs/icu/icu-68.2.ebuild | 5 +++++
 1 file changed, 5 insertions(+)