Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 729630 - x11-misc/imake - imake calls ld directly
Summary: x11-misc/imake - imake calls ld directly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: tc-directly
  Show dependency tree
 
Reported: 2020-06-25 14:40 UTC by Agostino Sarubbo
Modified: 2021-04-15 06:39 UTC (History)
3 users (show)

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


Attachments
build.log (build.log,7.91 KB, text/plain)
2020-06-25 14:40 UTC, Agostino Sarubbo
Details
files/imake-1.0.8-get_ld_version.patch (imake-1.0.8-get_ld_version.patch,167 bytes, patch)
2020-09-04 08:30 UTC, Jeroen Roovers (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2020-06-25 14:40:14 UTC
@@This is an auto-filed bug@@
Feel free to change the summary at your convenience.

Issue: app-misc/oneko calls ld directly.
Discovered on: amd64

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 LD implementation (like llvm-link). To reproduce, please use sys-devel/gcc-config[-native-symlinks], sys-devel/binutils-config[-native-symlinks] and set the LD variable to x86_64-pc-linux-gnu-ld.
Comment 1 Agostino Sarubbo gentoo-dev 2020-06-25 14:40:19 UTC
Created attachment 646386 [details]
build.log

build log and emerge --info
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2020-06-27 06:44:48 UTC
For the app-misc/oneko case I could work around it like this:

--- a/app-misc/oneko/oneko-1.2_p6_p14-r1.ebuild
+++ b/app-misc/oneko/oneko-1.2_p6_p14-r1.ebuild
@@ -41,9 +41,13 @@ src_prepare() {
        done

        default
+       printf '#!/bin/sh\n%s ${*}\n' $(tc-getLD) > "${T}"/ld
+       chmod +x "${T}"/ld
+       export PATH="${T}:${PATH}"
 }

 src_configure() {
+       tc-export LD
        xmkmf -a || die
 }


Is it viable to use the same approach for all other x11-misc/imake users or should a generic imake wrapper fix this?
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2020-06-27 06:47:16 UTC
(In reply to Jeroen Roovers from comment #2)
> For the app-misc/oneko case I could work around it like this:
> 
> --- a/app-misc/oneko/oneko-1.2_p6_p14-r1.ebuild
> +++ b/app-misc/oneko/oneko-1.2_p6_p14-r1.ebuild
[...]

This doesn't actually do anything:

>  src_configure() {
> +       tc-export LD
>         xmkmf -a || die
>  }
Comment 4 Larry the Git Cow gentoo-dev 2020-06-27 06:54:14 UTC
The bug has been referenced in the following commit(s):

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

commit 1633afd2ea85db7aac81cc84557e18c5b849b475
Author:     Jeroen Roovers <jer@gentoo.org>
AuthorDate: 2020-06-27 06:53:55 +0000
Commit:     Jeroen Roovers <jer@gentoo.org>
CommitDate: 2020-06-27 06:54:10 +0000

    app-misc/oneko: Set up ld => tc-getLD
    
    Package-Manager: Portage-2.3.103, Repoman-2.3.23
    Bug: https://bugs.gentoo.org/729630
    Signed-off-by: Jeroen Roovers <jer@gentoo.org>

 app-misc/oneko/oneko-1.2_p6_p14-r1.ebuild | 4 ++++
 1 file changed, 4 insertions(+)
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2020-06-28 07:19:44 UTC
*** Bug 729856 has been marked as a duplicate of this bug. ***
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2020-09-04 08:10:57 UTC
*** Bug 726136 has been marked as a duplicate of this bug. ***
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2020-09-04 08:30:16 UTC
Created attachment 658326 [details, diff]
files/imake-1.0.8-get_ld_version.patch

The get_ld_version function is executed once and its only function is to define DefaultLinuxBinUtilsMajorVersion which isn't used anywhere else in the generated Makefile. Make get_ld_version a noop.
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2020-09-04 11:47:32 UTC
*** Bug 726228 has been marked as a duplicate of this bug. ***
Comment 9 Joonas Niilola gentoo-dev 2021-02-07 12:27:58 UTC
*** Bug 725200 has been marked as a duplicate of this bug. ***
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-04-10 08:35:04 UTC
*** Bug 779973 has been marked as a duplicate of this bug. ***
Comment 11 Larry the Git Cow gentoo-dev 2021-04-15 06:39:21 UTC
The bug has been closed via the following commit(s):

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

commit b94256f4e995223066f750b65166e6a261fbeed4
Author:     Ionen Wolkens <sudinave@gmail.com>
AuthorDate: 2021-04-13 21:51:11 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2021-04-15 06:38:48 +0000

    x11-misc/imake: ease usage with toolchain's -native-symlinks
    
    This is to provide a more-sane way for ebuilds to fix their bugs,
    without really altering how imake behaves.
    
    There's four notable known runtime issues with -native-symlinks:
    
    - checks if /usr/bin/cc exists (without executing), if missing it
      skips setting some defines and notably causes generated Makefiles
      to use makedepend over gccmakedep resulting in some build failures.
    
    - `ld -v` inoring LD, no failure but gives a QA warning (bug #729630),
      also prevents a define from being set and given previous issue
      rather ensure they're conserved (slightly used in xorg-cf-files).
    
    - `gcc -E` ignoring CC/CPP, causes build failure if missing. imake has
      IMAKECPP to change this but can't take arguments leading to build
      failure if setting to $(tc-getCPP) which often has -E.
    
    - `xmkmf -a` sometimes calls imake again in an imake-generated Makefile
      leading to the environment's CC/LD being ignored again.
    
    Added patches to fix each. xmkmf-using ebuilds wanting to take
    advantage of this need something along the lines of:
    
    BDEPEND=">=x11-misc/imake-1.0.8-r1"
    CC="$(tc-getBUILD_CC)" LD="$(tc-getLD)" \
            IMAKECPP=${IMAKECPP:-$(tc-getCPP)} xmkmf ... || die
    emake CC="$(tc-getCC)" ...
    +test with -native-symlinks to ensure don't need more emake vars.
    (only CC should be BUILD_* here, LD not used to link)
    
    IMAKECPP is used this way to allow users to override without changing
    normal CPP. imake uses traditional CPP and clang notably doesn't
    play that well with that.
    
    Closes: https://bugs.gentoo.org/729630
    Signed-off-by: Ionen Wolkens <sudinave@gmail.com>
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 x11-misc/imake/files/imake-1.0.8-cpp-args.patch    | 18 +++++++++++
 x11-misc/imake/files/imake-1.0.8-no-get-gcc.patch  | 37 ++++++++++++++++++++++
 x11-misc/imake/files/imake-1.0.8-respect-LD.patch  | 15 +++++++++
 .../imake/files/imake-1.0.8-xmkmf-pass-cc-ld.patch | 15 +++++++++
 x11-misc/imake/imake-1.0.8-r1.ebuild               | 25 +++++++++++++++
 5 files changed, 110 insertions(+)