Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 662990 - dev-cpp/tbb always pick g++ instead of clang++
Summary: dev-cpp/tbb always pick g++ instead of clang++
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2018-08-07 00:46 UTC by Julian Cléaud
Modified: 2019-10-03 09:34 UTC (History)
1 user (show)

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


Attachments
Log of emerge dev-cpp/tbb-2017.20161126 with clang++ (bug-tbb-log.txt,9.17 KB, text/plain)
2018-08-07 00:46 UTC, Julian Cléaud
Details
build.log (tbb-2018.20180312:20180902-145830.log,40.64 KB, text/x-log)
2018-09-02 15:13 UTC, unhappy-ending
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Cléaud 2018-08-07 00:46:39 UTC
Created attachment 542650 [details]
Log of emerge dev-cpp/tbb-2017.20161126 with clang++

The package dev-cpp/tbb (all current versions) will never pick clang when used because of an error within the ebuild :

local_src_compile() {
    [...]

    case "$(tc-getCXX)" in
        *g++*) comp="gcc" ;;
        *ic*c) comp="icc" ;;
        *clang*) comp="clang" ;;
        *) die "compiler $(tc-getCXX) not supported by build system" ;;
    esac

    [...]

    CXX="$(tc-getCXX)" \
    CC="$(tc-getCC)" \
    [...]

    emake compiler=${comp} work_dir="${BUILD_DIR}" tbb_root="${S}" $@
}

This snippet causes error because tc-getCXX most probably returns clang++ when clang is used and hence matches "*g++*" first.

As a test, I added this line just before the case block :
elog "TC: $(tc-getCXX)"

And got the following :
 * TC: /usr/lib/llvm/6/bin/clang++



Hence, at build time, this line showed that gcc was selected :

make -j9 compiler=gcc work_dir=/var/tmp/portage/dev-cpp/tbb-2017.20161128/work/tbb2017_20161128oss-abi_x86_64.amd64 tbb_root=/var/tmp/portage/dev-cpp/tbb-2017.20161128/work/tbb2017_20161128oss tbb tbbmalloc


Finally, this result in the following error (at least for >=dev-cpp/tbb-2017.20161128) and a failure to emerge it :

clang-6.0: error: unknown argument: '-flifetime-dse=1'


To fix this bug, simply swap clang before g++ within the case, because g++ is unlikely to match clang (all current ebuilds have this bug) :

local_src_compile() {
    [...]

    case "$(tc-getCXX)" in
        *clang*) comp="clang" ;;
        *g++*) comp="gcc" ;;
        *ic*c) comp="icc" ;;
        *) die "compiler $(tc-getCXX) not supported by build system" ;;
    esac

    [...]
}
Comment 1 unhappy-ending 2018-09-02 15:13:39 UTC
Created attachment 545780 [details]
build.log

successful compile of tbb using clang with edited ebuild
Comment 2 unhappy-ending 2018-09-02 15:14:40 UTC
Couldn't compile using clang with the default ebuild. I tested this out using the same method above and can confirm it works.
Comment 3 Larry the Git Cow gentoo-dev 2019-10-03 09:34:06 UTC
The bug has been closed via the following commit(s):

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

commit a1ddeefb53647830f2c1b781c51487eecd290d4a
Author:     Peter Levine <plevine457@gmail.com>
AuthorDate: 2019-10-03 01:43:17 +0000
Commit:     Guilherme Amadio <amadio@gentoo.org>
CommitDate: 2019-10-03 09:31:43 +0000

    dev-cpp/tbb: Fix building with clang
    
    Prevent "clang++" from being inadvertently matched to "*g++*" in a case
    statement.
    
    Closes: https://bugs.gentoo.org/662990
    Closes: https://github.com/gentoo/gentoo/pull/13129
    Package-Manager: Portage-2.3.76, Repoman-2.3.17
    Signed-off-by: Peter Levine <plevine457@gmail.com>
    Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

 dev-cpp/tbb/tbb-2019.8.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)