Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 839318 - sys-process/btop-1.2.8 calls g++ directly
Summary: sys-process/btop-1.2.8 calls g++ directly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Adrian Schollmeyer
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: tc-directly
  Show dependency tree
 
Reported: 2022-04-18 19:09 UTC by Agostino Sarubbo
Modified: 2023-06-25 07:22 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,40.34 KB, text/plain)
2022-04-18 19:09 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-04-18 19:09:39 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: sys-process/btop-1.2.6 calls g++ directly.
Discovered on: amd64 (internal ref: guru_ci)

NOTE:
As per QA policy, toolchain tools must not be called directly because they can cause issue in cross-compiling and because is not possible use a different C++ implementation (like clang++). To reproduce, please use sys-devel/gcc-config[-native-symlinks], sys-devel/binutils-config[-native-symlinks].
Comment 1 Agostino Sarubbo gentoo-dev 2022-04-18 19:09:41 UTC
Created attachment 771671 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2022-04-18 19:09:43 UTC
Error(s) that match a know pattern:


/bin/sh: line 1: c++: command not found
/bin/sh: line 4: c++: command not found
Comment 3 Adrian Schollmeyer 2022-04-27 11:13:12 UTC
I've checked upstream and it seems they have a hard dependency on GCC 10 or higher, since they're using C++20.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-03 09:08:43 UTC
(In reply to Adrian Schollmeyer from comment #3)
> I've checked upstream and it seems they have a hard dependency on GCC 10 or
> higher, since they're using C++20.

That doesn't mean it should call "c++" directly thoufh.
Comment 5 Adrian Schollmeyer 2022-06-04 19:28:11 UTC
(In reply to Sam James from comment #4)
> That doesn't mean it should call "c++" directly thoufh.

I've opened an issue upstream so the build system respects the CXX variable [0].
This way we should be able to set the compiler more or less freely.

Also, as a side note: In [1] upstream already tracks clang support. Currently, the ranges library isn't implemented, yet. Is there something I can set in the ebuild to explicitly require GCC for building the project?

[0] https://github.com/aristocratos/btop/issues/352
[1] https://github.com/aristocratos/btop/issues/324
Comment 6 Adrian Schollmeyer 2022-06-04 19:29:45 UTC
Removing from GURU bugs since the package has moved to ::gentoo.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-04 21:22:56 UTC
(In reply to Adrian Schollmeyer from comment #5)
> (In reply to Sam James from comment #4)
> > That doesn't mean it should call "c++" directly thoufh.
> 
> I've opened an issue upstream so the build system respects the CXX variable
> [0].
> This way we should be able to set the compiler more or less freely.
> 
> Also, as a side note: In [1] upstream already tracks clang support.
> Currently, the ranges library isn't implemented, yet. Is there something I
> can set in the ebuild to explicitly require GCC for building the project?
> 
> [0] https://github.com/aristocratos/btop/issues/352
> [1] https://github.com/aristocratos/btop/issues/324

Very interesting! Thanks!

As for GCC: yeah, we have to do two things:
1. BDEPEND on it
2. in pkg_setup, check for binary pkg. if not a binary pkg, check if compiler is gcc, if not, die. there's lots of examples in tree but tell me if need more help
Comment 8 Larry the Git Cow gentoo-dev 2022-06-04 21:23:23 UTC
The bug has been closed via the following commit(s):

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

commit 19ae56cb90fdc1dd3256189435bb8229eb4dfe13
Author:     Adrian Schollmeyer <nex+b-g-o@nexadn.de>
AuthorDate: 2022-06-04 19:52:53 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-04 21:23:13 +0000

    sys-process/btop: Don't enforce g++ compiler
    
    Backport of [0]. The current build system enforces using the g++
    binaries it finds in $PATH.
    
    [0] https://github.com/aristocratos/btop/pull/353
    
    Signed-off-by: Adrian Schollmeyer <nex+b-g-o@nexadn.de>
    Closes: https://bugs.gentoo.org/839318
    Closes: https://github.com/gentoo/gentoo/pull/25755
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-process/btop/btop-1.2.7-r1.ebuild                   |  8 ++++++--
 .../btop/files/btop-1.2.7-respect-cxx-var-839318.patch  | 17 +++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
Comment 9 Joonas Niilola gentoo-dev 2022-09-14 10:41:23 UTC
I'm hitting this error on sys-process/btop-1.2.8 when trying to compile with clang:

PLATFORM   ?| Linux
ARCH       ?| amd64
CXX        ?| clang++ (14.0.6)
THREADS    :| 32
REQFLAGS   !| -std=c++20
WARNFLAGS  :| -Wall -Wextra -pedantic
OPTFLAGS   :| 
LDCXXFLAGS :| -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -fexceptions -fstack-clash-protection -fcf-protection -fstack-protector 
CXXFLAGS   +| $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
LDFLAGS    +| $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)

Building btop++ (v1.2.8) Linux amd64
Compiling src/btop.cpp
Compiling src/btop_draw.cpp
Compiling src/btop_input.cpp
Compiling src/btop_config.cpp
Compiling src/btop_menu.cpp
Compiling src/btop_theme.cpp
Compiling src/btop_tools.cpp
Compiling src/linux/btop_collect.cpp
In file included from src/btop_theme.cpp:19:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/cmath:1935:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/specfun.h:45:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/stl_algobase.h:65:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/stl_iterator_base_types.h:71:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/iterator_concepts.h:979:13: error: 
      no matching function for call to '__begin'
        = decltype(ranges::__cust_access::__begin(std::declval<_Tp&>()));

If I switch to gcc by CC="gcc" CXX="g++" it compiles fine. So it looks like g++ is still hardcoded somewhere.

I see 1.3.8 or 1.3.9 don't have the .patch file applied, maybe that was forgotten on a version bump? Looking at the linked upstream issues, it doesn't look like this has been resolved upstream.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-14 10:48:35 UTC
(In reply to Joonas Niilola from comment #9)
> I'm hitting this error on sys-process/btop-1.2.8 when trying to compile with
> clang:
> 
> PLATFORM   ?| Linux
> ARCH       ?| amd64
> CXX        ?| clang++ (14.0.6)
> THREADS    :| 32
> REQFLAGS   !| -std=c++20
> WARNFLAGS  :| -Wall -Wextra -pedantic
> OPTFLAGS   :| 
> LDCXXFLAGS :| -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS
> -fexceptions -fstack-clash-protection -fcf-protection -fstack-protector 
> CXXFLAGS   +| $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
> LDFLAGS    +| $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
> 
> Building btop++ (v1.2.8) Linux amd64
> Compiling src/btop.cpp
> Compiling src/btop_draw.cpp
> Compiling src/btop_input.cpp
> Compiling src/btop_config.cpp
> Compiling src/btop_menu.cpp
> Compiling src/btop_theme.cpp
> Compiling src/btop_tools.cpp
> Compiling src/linux/btop_collect.cpp
> In file included from src/btop_theme.cpp:19:
> In file included from
> /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/cmath:1935:
> In file included from
> /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/specfun.h:45:
> In file included from
> /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/stl_algobase.h:
> 65:
> In file included from
> /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/
> stl_iterator_base_types.h:71:
> /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/
> iterator_concepts.h:979:13: error: 
>       no matching function for call to '__begin'
>         = decltype(ranges::__cust_access::__begin(std::declval<_Tp&>()));
> 
> If I switch to gcc by CC="gcc" CXX="g++" it compiles fine. So it looks like
> g++ is still hardcoded somewhere.
> 
> I see 1.3.8 or 1.3.9 don't have the .patch file applied, maybe that was
> forgotten on a version bump? Looking at the linked upstream issues, it
> doesn't look like this has been resolved upstream.

By default, Clang will use libstdc++ (from GCC) still. Full build.log & emerge --info please.

It's probably adding -stdlib=... in one place and not another, or disrespecting whatever you've set in *FLAGS
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-14 10:48:52 UTC
(sorry, didn't mean to change status to fixed, meant to confirmed)
Comment 12 Stephan Hartmann (RETIRED) gentoo-dev 2022-09-14 10:55:19 UTC
C++20 ranges are supported partially by Clang only. Maybe Clang-15 has better support.
Comment 13 Adrian Schollmeyer 2022-09-14 11:08:30 UTC
The way the ebuild works ensures that the correct compiler is called. The patch used in 1.2.7 was not necessary, as I have found out later. Thus I removed it for 1.2.8 onwards.

The core issue currently is the lack of support for the ranges library with clang [0]. I guess since clang still has its issues, I should enforce gcc...

[0] https://github.com/aristocratos/btop/issues/324
Comment 14 Adrian Schollmeyer 2022-09-14 12:14:19 UTC
(In reply to Stephan Hartmann from comment #12)
> C++20 ranges are supported partially by Clang only. Maybe Clang-15 has
> better support.

I've tested clang 14 with sys-libs/libcxx-15, but no luck either. I'll test with clang/LLVM 15 later.
Comment 15 Adrian Schollmeyer 2022-09-14 15:48:16 UTC
clang/LLVM 15 doesn't work either. Guess I'll have to depend on GCC for now.
Comment 16 Larry the Git Cow gentoo-dev 2022-09-15 12:48:36 UTC
The bug has been closed via the following commit(s):

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

commit 34ccc1d848c74a17edebc48f0c0c936106ffa278
Author:     Adrian Schollmeyer <nex+b-g-o@nexadn.de>
AuthorDate: 2022-09-14 20:31:05 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-15 12:48:23 +0000

    sys-process/btop: Hard-depend on sys-devel/gcc
    
    Clang currently does not have support for the C++ 20 ranges library,
    causing build failures wis sys-process/btop. The only compiler supported
    upstream is sys-devel/gcc [0]. This commit enforces g++ to be used as a
    compiler until proper clang support is available.
    
    [0] https://github.com/aristocratos/btop/issues/324
    
    Closes: https://bugs.gentoo.org/839318
    Signed-off-by: Adrian Schollmeyer <nex+b-g-o@nexadn.de>
    Closes: https://github.com/gentoo/gentoo/pull/27255
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-process/btop/btop-1.2.8.ebuild | 13 +++++++++++++
 sys-process/btop/btop-1.2.9.ebuild | 13 +++++++++++++
 2 files changed, 26 insertions(+)
Comment 17 Larry the Git Cow gentoo-dev 2023-06-25 07:22:22 UTC
The bug has been referenced in the following commit(s):

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

commit 47740cd72e28a74bd91c71302e7993b5fa224439
Author:     Violet Purcell <vimproved@inventati.org>
AuthorDate: 2023-06-20 00:49:37 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-06-25 07:22:08 +0000

    sys-process/btop: Backport patch to allow compilation with clang >=16
    
    Bug: https://bugs.gentoo.org/839318
    Signed-off-by: Violet Purcell <vimproved@inventati.org>
    Closes: https://github.com/gentoo/gentoo/pull/31534
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-process/btop/btop-1.2.13-r2.ebuild             |   4 +
 .../btop/files/btop-1.2.13-allow-clang.patch       | 191 +++++++++++++++++++++
 2 files changed, 195 insertions(+)