Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 495074 - kde4-base.eclass - pkg_setup() dies on CPP="clang -E"
Summary: kde4-base.eclass - pkg_setup() dies on CPP="clang -E"
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] KDE (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-12-23 00:49 UTC by eroen
Modified: 2013-12-23 07:06 UTC (History)
0 users

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


Attachments
Suggested change (patch,876 bytes, patch)
2013-12-23 00:49 UTC, eroen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description eroen 2013-12-23 00:49:50 UTC
Created attachment 365944 [details, diff]
Suggested change

Any ebuild inheriting kde4-base.eclass and calling the
kde4-base_pkg_setup() phase function (exported) will die when exposed to
CPP="clang -E", since this function contains the following check:

    if [[ ${MERGE_TYPE} != binary ]]; then
        [[ $(gcc-major-version) -lt 4 ]] || \
                ( [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -le 3 ]] ) \
            && die "Sorry, but gcc-4.3 and earlier wont work for KDE (see bug 354837)."
    fi

The underlying logic in toolchain-funcs.eclass is:

_gcc_fullversion() {
    local ver="$1"; shift
    set -- `$(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"`
    eval echo "$ver"
}

For this check, current versions of llvm return 4.2.1. This has been the
case for a while, and is unlikely to change due to glibc header
incompatibility, see [1].

eroen@occam /usr/local/portage $ emerge -pqO llvm
[ebuild   R   ] sys-devel/llvm-3.3-r1
eroen@occam ~ $ clang -E -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"
4 2 1

An example of a package suffering from this, is app-office/libreoffice,
see [2].

Suggested change
----------------

I suggest the following change (also attached) to alleviate this issue:

--- a/eclass/kde4-base.eclass
+++ b/eclass/kde4-base.eclass
@@ -594,7 +594,7 @@ kde4-base_pkg_setup() {
    # In theory should be in pkg_pretend but we check it only for kdelibs there
    # and for others we do just quick scan in pkg_setup because pkg_pretend
    # executions consume quite some time.
-   if [[ ${MERGE_TYPE} != binary ]]; then
+   if [[ ${MERGE_TYPE} != binary && "$(tc-getCPP)" == *gcc* ]]; then
        [[ $(gcc-major-version) -lt 4 ]] || \
                ( [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -le 3 ]] ) \
            && die "Sorry, but gcc-4.3 and earlier wont work for KDE (see bug 354837)."

Minimal example showing this issue:
-----------------------------------

eroen@occam portage $ cat app-arch/kdeclang/kdeclang-0.ebuild
API=5
nherit kde4-base
LOT=0
=$WORKDIR
rc_unpack() { :; }
rc_configure() { :; }
rc_compile() { :; }
rc_install() { :; }
roen@occam portage $ ebuild app-arch/kdeclang/kdeclang-0.ebuild clean install
* checking ebuild checksums ;-) ...                                                      [ ok ]
>> Unpacking source...
>> Source unpacked in /tmp/portage/app-arch/kdeclang-0/work
atching locally
tmp/portage/app-arch/kdeclang-0/work /tmp/portage/app-arch/kdeclang-0/work
tmp/portage/app-arch/kdeclang-0/work
>> Preparing source in /tmp/portage/app-arch/kdeclang-0/work ...
>> Source prepared.
>> Configuring source in /tmp/portage/app-arch/kdeclang-0/work ...
>> Source configured.
>> Compiling source in /tmp/portage/app-arch/kdeclang-0/work ...
>> Source compiled.
* Skipping make test/check due to ebuild restriction.
>> Test phase [disabled because of RESTRICT=test]: app-arch/kdeclang-0

>> Install kdeclang-0 into /tmp/portage/app-arch/kdeclang-0/image/ category app-arch
>> Completed installing kdeclang-0 into /tmp/portage/app-arch/kdeclang-0/image/

roen@occam portage $ CPP="clang -E" ebuild app-arch/kdeclang/kdeclang-0.ebuild clean install
* checking ebuild checksums ;-) ...                                                      [ ok ]
* ERROR: app-arch/kdeclang-0::eroen failed (setup phase):
*   Sorry, but gcc-4.3 and earlier wont work for KDE (see bug 354837).
* 
* Call stack:
*     ebuild.sh, line   93:  Called pkg_setup
*   environment, line 3735:  Called kde4-base_pkg_setup
*   environment, line 3077:  Called die
* The specific snippet of code:
*           [[ $(gcc-major-version) -lt 4 ]] || ( [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -le 3 ]] ) && die "Sorry, but gcc-4.3 and earlier wont work for KDE (see bug 354837).";
* 
* If you need support, post the output of `emerge --info '=app-arch/kdeclang-0::eroen'`,
* the complete build log and the output of `emerge -pqv '=app-arch/kdeclang-0::eroen'`.
* The complete build log is located at '/var/log/portage/app-arch:kdeclang-0:20131223-001517.log'.
* For convenience, a symlink to the build log is located at '/tmp/portage/app-arch/kdeclang-0/temp/build.log'.
* The ebuild environment file is located at '/tmp/portage/app-arch/kdeclang-0/temp/environment'.
* Working directory: '/usr/lib64/portage/pym'
* S: '/tmp/portage/app-arch/kdeclang-0/work'

[1]: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-May/021503.html
[2]: https://bugs.gentoo.org/460902
Comment 1 eroen 2013-12-23 07:06:43 UTC
Sorry, I did not think this through sufficiently. I will re-file when I have a suggestion that actually works(tm).