Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 545442 - dev-libs/gmp-6.0.0a incorrectly configures GMP on any x86-64 computer better than AMD k8
Summary: dev-libs/gmp-6.0.0a incorrectly configures GMP on any x86-64 computer better ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-03 19:59 UTC by Крыськов Денис
Modified: 2022-12-06 10:53 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Крыськов Денис 2015-04-03 19:59:52 UTC
When GMP ./configure is run without arguments, it correctly auto-detects microarchitecure and uses best possible subroutines (uses MULX instruction when run on Haswell, for instance).

When configures thru gmp-6.0.0a.ebuild, GMP treats every x86-64 as K8, which results in poor perfomance.

GMP devs spent time optimizing their library, but Gentoo users do not benefit from that. 

Reproducible: Always

Steps to Reproduce:
1. Use not very old x86-64 computer (core2, core-i*, K10 will do), anything more capable than k8
2. Run GMP configure by hand. When done, say 'fgrep k8 config.log'. That gives nothing - you are not on k8.
3. 'ebuild gmp-6.0.0a.ebuild clean configure'. 'fgrep k8 config.log' gives lots of matches such as

config.status:1793: linking /tmp/portage/dev-libs/gmp-6.0.0a/work/gmp-6.0.0/mpn/x86_64/k8/mul_basecase.asm to mpn/mul_basecase.asm

 - now GMP treats your modern computer like old k8.
Actual Results:  
GMP misconfigured.

Expected Results:  
GMP configured to full perfomance.

I offer a cure

66a68,72
>  build_alias=`/bin/sh $S/config.guess` ||
>   die "failed to run config.guess"
>  [ -z $build_alias ] && die "empty result from config.guess"
>  einfo "guessed processor type: $build_alias"
> 
67a74
>  export ac_cv_host=$build_alias

This patch runs GMP auto-guesser, then feeds result to configure thru variable ac_cv_host.
Comment 1 SpanKY gentoo-dev 2015-04-08 07:04:44 UTC

*** This bug has been marked as a duplicate of bug 235697 ***
Comment 2 Larry the Git Cow gentoo-dev 2022-12-01 03:42:10 UTC
The bug has been closed via the following commit(s):

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

commit 121152c38caefd8e94fb8c90cb51102693b6d6a8
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-12-01 03:26:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-12-01 03:41:54 +0000

    dev-libs/gmp: allow automatic detection of host for USE=-cpudetection
    
    Bug: https://bugs.gentoo.org/883201
    Closes: https://bugs.gentoo.org/235697
    Closes: https://bugs.gentoo.org/545442
    Signed-off-by: Sam James <sam@gentoo.org>

 .../{gmp-6.2.1-r3.ebuild => gmp-6.2.1-r4.ebuild}   | 32 +++++++++++++++++++---
 dev-libs/gmp/metadata.xml                          | 13 ++++++++-
 profiles/arch/amd64/package.use.mask               |  4 ---
 profiles/arch/base/package.use.mask                |  4 ---
 profiles/arch/x86/package.use.mask                 |  4 ---
 5 files changed, 40 insertions(+), 17 deletions(-)
Comment 3 Larry the Git Cow gentoo-dev 2022-12-06 10:53:12 UTC
The bug has been referenced in the following commit(s):

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

commit 2e58af672b41a624f84eb7fada145ab2f6c2b1b6
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-12-06 10:48:07 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-12-06 10:52:50 +0000

    dev-libs/gmp: further econf fixes
    
    * Use gnuconfig.eclass to update configfsf.{guess,sub} before the wrapped
      versions call them.
    * Export CBUILD too just in case for the deduced host from upstream's wrapped
      config.guess (not the same as gnuconfig's at all, see bugs for details).
    * Save/restore upstream's config.{guess,sub} to make sure that for the second
      multilib build we still have it available to run. In practice, this may not
      have mattered too much, as the exported ac_cv_host should've persisted, but
      it's still worth being (clearly) correct as is the case now.
    * Move cpudetection warning into pkg_pretend so it's easier to spot and
      we also don't then repeat it for each ABI.
    
    Bug: https://bugs.gentoo.org/235697
    Bug: https://bugs.gentoo.org/545442
    Bug: https://bugs.gentoo.org/883201
    See: 78b4d4ebbcee12f5ef4c1dfa89f80c98a582db9d
    See: 3fe1b5370c0cc1537d1249e8ec9d2fbcd8619499
    See: bf286a7973d8b95dbef90f17cc8e2d66c19a47c8
    See: 121152c38caefd8e94fb8c90cb51102693b6d6a8
    Signed-off-by: Sam James <sam@gentoo.org>

 .../{gmp-6.2.1-r4.ebuild => gmp-6.2.1-r5.ebuild}   | 32 ++++++++++++++++++----
 1 file changed, 26 insertions(+), 6 deletions(-)