Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
clang 4 building packages: user defined -flto=thin error
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3634

PostPosted: Fri Apr 26, 2024 12:18 pm    Post subject: clang 4 building packages: user defined -flto=thin error Reply with quote

Started to implement /etc/portage/env for clang.

Regular & -flto builds fine on 2 test packages here.

Despite conformance with wiki -fuse-ld=lld advice, -ftlo=thin throws:
Code:
emerge -1  media-libs/opus

 * IMPORTANT: 2 config files in '/etc/portage' need updating.
 * See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS
 * sections of the emerge man page to learn how to update config files.

These are the packages that would be merged, in reverse order:

Calculating dependencies  ........ ..... .... ... .!!! /etc/portage/package.env references non-existent file: /etc/portage/env/unchecked
!!! /etc/portage/package.env references non-existent file: /etc/portage/env/no-build
!!! /etc/portage/package.env references non-existent file: /etc/portage/env/no-build
..!!! /etc/portage/package.env references non-existent file: /etc/portage/env/unchecked
!!! /etc/portage/package.env references non-existent file: /etc/portage/env/no-build
!!! /etc/portage/package.env references non-existent file: /etc/portage/env/no-build
... done!
Dependency resolution took 163.84 s (backtrack: 0/20).

[ebuild   R   ~] media-libs/opus-1.5.2

!!! The following installed packages are masked:
- sys-kernel/gentoo-sources-4.14.320::gentoo (masked by: package.mask)
/var/db/repos/gentoo/profiles/package.mask:
# Sam James <sam@gentoo.org> (2023-12-14)
# Gentoo's kernel maintainers have decided to discontinue gentoo-sources and
# gentoo-kernel for old kernel LTS branches because of the resources to require
# testing and patching them, combined with changing kernel lifecycles.
#
# The new policy is to support kernels with genpatches for 3 years after their
# release.
#
# Specifically, 4.14/4.19/5.4 have been dropped. See https://www.mpagano.com/blog/?p=315
# and http://www.kroah.com/log/blog/2018/08/24/what-stable-kernel-should-i-use/.
#
# sys-kernel/vanilla-sources will continue to be provided for all branches
# until they reach formal upstream EOL.
#

- sys-kernel/gentoo-sources-4.19.292::gentoo (masked by: package.mask)
- sys-kernel/gentoo-sources-5.4.257::local (masked by: package.mask)
- sys-kernel/gentoo-sources-4.19.294::gentoo (masked by: package.mask)
For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.



>>> Verifying ebuild manifests

>>> Emerging (1 of 1) media-libs/opus-1.5.2::gentoo
 * opus-1.5.2.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                      [ ok ]
 * Checking whether python3_12 is suitable ...
 *   dev-lang/python:3.12 ...                                                                                                                                         [ ok ]
 * Using python3.12 to build (via PYTHON_COMPAT iteration)
>>> Unpacking source...
>>> Unpacking opus-1.5.2.tar.gz to /var/tmp/portage/media-libs/opus-1.5.2/work
>>> Source unpacked in /var/tmp/portage/media-libs/opus-1.5.2/work
>>> Preparing source in /var/tmp/portage/media-libs/opus-1.5.2/work/opus-1.5.2 ...
 * Applying opus-1.3.1-libdir-macro.patch ...                                                                                                                         [ ok ]
 * Applying opus-1.4-arm64-neon.patch ...                                                                                                                             [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/media-libs/opus-1.5.2/work/opus-1.5.2 ...
 * abi_x86_64.amd64: running multilib-minimal_abi_src_configure
clang-cpp: warning: argument unused during compilation: '-E' [-Wunused-command-line-argument]
meson setup -Db_lto=true -Db_lto_mode=thin --libdir lib64 --localstatedir /var/lib --prefix /usr --sysconfdir /etc --wrap-mode nodownload --build.pkg-config-path /var/tmp/portage/media-libs/opus-1.5.2/temp/python3.12/pkgconfig:/usr/share/pkgconfig --pkg-config-path /var/tmp/portage/media-libs/opus-1.5.2/temp/python3.12/pkgconfig:/usr/share/pkgconfig --native-file /var/tmp/portage/media-libs/opus-1.5.2/temp/meson.x86_64-pc-linux-gnu.amd64.ini -Db_pch=false -Dwerror=false -Dbuildtype=plain -Ddefault_library=shared -Dcustom-modes=false -Dtests=disabled -Dassertions=false -Dhardening=false -Ddocs=disabled -Ddocdir=/usr/share/doc/opus-1.5.2 -Dintrinsics=enabled /var/tmp/portage/media-libs/opus-1.5.2/work/opus-1.5.2 /var/tmp/portage/media-libs/opus-1.5.2/work/opus-1.5.2-abi_x86_64.amd64
The Meson build system
Version: 1.3.2
Source dir: /var/tmp/portage/media-libs/opus-1.5.2/work/opus-1.5.2
Build dir: /var/tmp/portage/media-libs/opus-1.5.2/work/opus-1.5.2-abi_x86_64.amd64
Build type: native build
Project name: opus
Project version: 1.5.2
C compiler for the host machine: clang (clang 18.1.4 "clang version 18.1.4")
C linker for the host machine: clang ld.bfd 2.41
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -fvisibility=hidden: YES
Compiler for C supports arguments -Wcast-align: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wshadow: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -fstack-protector-strong: YES
Library m found: YES
Checking for function "lrintf" with dependency -lm: YES
Checking for function "lrint" with dependency -lm: YES
Checking for function "__malloc_hook" : NO
Check usable header "stdint.h" : YES
Checking if "restrict keyword" compiles: YES
Checking if "C99 variable-size arrays" compiles: YES
Checking if "compiler supports SSE intrinsics" : links: YES
Checking if "compiler supports SSE2 intrinsics" : links: YES
Checking if "compiler supports SSE4.1 intrinsics" : links: NO
Checking if "compiler supports SSE4.1 intrinsics with -msse4.1" : links: YES
Checking if "compiler supports AVX2 intrinsics" : links: NO
Checking if "compiler supports AVX2 intrinsics with -mavx -mfma -mavx2" : links: YES
Checking if "Get X86 CPU info via inline assembly" : links: YES
Configuring config.h using configuration
Found pkg-config: YES (/usr/bin/x86_64-pc-linux-gnu-pkg-config) 2.1.1
Program doxygen skipped: feature docs disabled
Build targets in project: 15

opus 1.5.2

  Compiler support
    C99 var arrays                 : YES
    C99 lrintf                     : YES
    Use alloca                     : NO (using C99 variable-size arrays instead)

  Optimizations
    Floating point support         : YES
    Fast float approximations      : NO
    Fixed point debugging          : NO
    Inline assembly optimizations  : none
    External assembly optimizations: none
    Intrinsics optimizations       : SSE, SSE2, SSE4.1, AVX2
    Run-time CPU detection         : SSE4.1, AVX2

  General configuration
    Custom modes                   : NO
    Assertions                     : NO
    Hardening                      : NO
    Fuzzing                        : NO
    Check ASM                      : NO
    API documentation              : NO
    Extra programs                 : YES
    Tests                          : NO

  User defined options
    Native files                   : /var/tmp/portage/media-libs/opus-1.5.2/temp/meson.x86_64-pc-linux-gnu.amd64.ini
    build.pkg_config_path          : /var/tmp/portage/media-libs/opus-1.5.2/temp/python3.12/pkgconfig:/usr/share/pkgconfig
    buildtype                      : plain
    default_library                : shared
    libdir                         : lib64
    localstatedir                  : /var/lib
    pkg_config_path                : /var/tmp/portage/media-libs/opus-1.5.2/temp/python3.12/pkgconfig:/usr/share/pkgconfig
    prefix                         : /usr
    sysconfdir                     : /etc
    werror                         : false
    wrap_mode                      : nodownload
    b_lto                          : true
    b_lto_mode                     : thin
    b_pch                          : false
    assertions                     : false
    custom-modes                   : false
    docdir                         : /usr/share/doc/opus-1.5.2
    docs                           : disabled
    hardening                      : false
    intrinsics                     : enabled
    tests                          : disabled

Found ninja-1.11.1 at /usr/bin/ninja
                                               
ERROR: LLVM's ThinLTO only works with gold, lld, lld-link, ld64 or mold, not ld.bfd

A full log can be found at /var/tmp/portage/media-libs/opus-1.5.2/work/opus-1.5.2-abi_x86_64.amd64/meson-logs/meson-log.txt
 * ERROR: media-libs/opus-1.5.2::gentoo failed (configure phase):
 *   configure failed
 *
 * Call stack:
 *     ebuild.sh, line  136:  Called src_configure
 *   environment, line 3410:  Called meson-multilib_src_configure
 *   environment, line 2090:  Called multilib-minimal_src_configure
 *   environment, line 2290:  Called multilib_foreach_abi 'multilib-minimal_abi_src_configure'
 *   environment, line 2540:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *   environment, line 2245:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_configure'
 *   environment, line 2243:  Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_configure'
 *   environment, line  685:  Called multilib-minimal_abi_src_configure
 *   environment, line 2284:  Called multilib_src_configure
 *   environment, line 2773:  Called meson_src_configure
 *   environment, line 2177:  Called die
 * The specific snippet of code:
 *       [[ ${rv} -eq 0 ]] || die -n "configure failed";
 *
 * If you need support, post the output of `emerge --info '=media-libs/opus-1.5.2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-libs/opus-1.5.2::gentoo'`.
 * The complete build log is located at '/var/log/portage/media-libs:opus-1.5.2:20240426-120540.log.gz'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/media-libs/opus-1.5.2/temp/build.log.gz'.
 * The ebuild environment file is located at '/var/tmp/portage/media-libs/opus-1.5.2/temp/environment'.
 * Working directory: '/var/tmp/portage/media-libs/opus-1.5.2/work/opus-1.5.2-abi_x86_64.amd64'
 * S: '/var/tmp/portage/media-libs/opus-1.5.2/work/opus-1.5.2'

>>> Failed to emerge media-libs/opus-1.5.2, Log file:

>>>  '/var/log/portage/media-libs:opus-1.5.2:20240426-120540.log.gz'


Plz note sys-devel/binutils, sys-devel/mold(which is defaulted to in /etc/portage/make.conf) are installed as well as sys-devel/lld.
Forcing the later as default throws the same.

Any idea what I might be missing?

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "


Last edited by CaptainBlood on Fri Apr 26, 2024 6:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21682

PostPosted: Fri Apr 26, 2024 2:45 pm    Post subject: Reply with quote

The output posted does not appear to explain the problem, but it does reference a full log, which might be more useful. Do you think it is using a supported linker and wrongly claiming the linker is unsupported, or is it wrongly using an unsupported linker even though you told it to use a supported one?
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3634

PostPosted: Fri Apr 26, 2024 3:07 pm    Post subject: Reply with quote

Hu wrote:
but it does reference a full log, which might be more useful.
Just what is posted, from head to toes.
Hu wrote:
Do you think it is using a supported linker and wrongly claiming the linker is unsupported, or is it wrongly using an unsupported linker even though you told it to use a supported one?
No idea on my side.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3634

PostPosted: Fri Apr 26, 2024 3:51 pm    Post subject: Reply with quote

Going generic "-flto" with ld.lld forced make.conf builds fine.
ld.lld checking snippet
Code:
[174/174] clang  -o src/opus_demo src/opus_demo.p/opus_demo.c.o -flto -Wl,--as-needed -Wl,--no-undefined -march=core2 -mtune=native -O2 -pipe -ftrapping-math -Wl,-O1 -Wl,-fuse-ld=lld '-Wl,-rpath,$ORIGIN/' -Wl,-rpath-link,/var/tmp/portage/media-libs/opus-1.5.2-r1/work/opus-1.5.2-abi_x86_64.amd64/src -Wl,--start-group src/libopus.so.0.10.1 -lm -Wl,--end-group
Forced in /etc/portage/env is fine too.

Wiki suggest LDFLAGS is not even required:
Code:
# No need to set this, clang-common can handle this based on chosen USE flags
#LDFLAGS="${LDFLAGS} -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed"
although rather vague on eventual required conditions.

along with:
Code:
There should be no compatibility differences between full LTO and thin LTO. Additionally, if Clang was not built with the default-lld USE flag, add the -fuse-ld=lld value to the following LDFLAGS.
:roll: only relevant for clang<13, removed on the 2023-02-01.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum