Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 235697 - dev-libs/gmp: econf shouldn't replace config.guess/config.sub
Summary: dev-libs/gmp: econf shouldn't replace config.guess/config.sub
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-25 17:59 UTC by DC
Modified: 2022-12-06 10:53 UTC (History)
2 users (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 DC 2008-08-25 17:59:44 UTC
When building gmp-4.2.2-r2, econf replaces config.guess and config.sub with the versions in /usr/share/gnuconfig/:

 * econf: updating gmp-4.2.2/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating gmp-4.2.2/config.sub with /usr/share/gnuconfig/config.sub

It should *not* do this, since GMP has special versions of these files that do processor detection and that pick the best version of the assembly code to use. For example, one problem is that /usr/share/gnuconfig/config.sub turns pentium3 into generic i686, whereas GMP's config.sub has a special case for pentium3.
Comment 1 Wormo (RETIRED) gentoo-dev 2008-08-25 18:53:09 UTC
Hm, looks like this could be an unusual case where 'configure' should be run instead of 'econf'... 

Assigning to package maintainers.
Comment 2 SpanKY gentoo-dev 2008-08-29 08:40:57 UTC
config.guess never gets executed in a Gentoo environment as we have full control over --host/--build/--target

since the custom config.sub really only matters in the case where config.guess provides something gmp-extraneous, preserving it gains nothing as well
Comment 3 DC 2008-08-29 14:53:12 UTC
In Gentoo, Pentium 3's use the CHOST i686-pc-linux-gnu, which gets set as the --host and --build when building GMP. I wanted to build a version of GMP optimized for the Pentium 3 instead of for i686, and it was easy enough to override the --host and --build, but changing them didn't have any effect, since we replace GMP's config.sub with Gentoo's config.sub, which turns pentium3-pc-linux-gnu right back into i686-pc-linux-gnu.

If we left GMP's config.sub in place, users could override --host and --build to optimize GMP for their own processor.
Comment 4 SpanKY gentoo-dev 2008-08-29 16:47:45 UTC
very little is actually checked based on custom proc.  very few (dare i say i can count them on one hand) people would actually go through this effort of custom --host.
Comment 5 DC 2008-08-30 00:57:51 UTC
> very little is actually checked based on custom proc.  very few (dare i say i
> can count them on one hand) people would actually go through this effort of

True :) On the other hand, this is Gentoo, so we should make it as customizable as possible.

GMP does have custom assembly code for the Pentium 3, which is why I wanted build for Pentium 3 instead of generic i686.
Comment 6 Mark Loeser (RETIRED) gentoo-dev 2009-04-30 01:16:33 UTC
Reopen this if you want, it seems to have gone no where and just sat here to rot.
Comment 7 SpanKY gentoo-dev 2015-04-08 07:04:44 UTC
*** Bug 545442 has been marked as a duplicate of this bug. ***
Comment 8 Nikita Zlobin 2018-03-15 12:31:06 UTC
What if econf gets option to not replace these files?
About CHOST / CBUILD: even if these two are specified (this is how gentoo has control on this, right?), config.guess is still executed, otherwise gentoo's version would not crash configure stage, when e.g. "sandybridge-pc-linux-gnu" is used.

Yet, users may don't need to specify exact value for these two variables.
Running configure with --build="" --host="" gives same result, as complete omiting of these options, and autodetection will do the trick for them.

But even if not - of course, they would not try to deal with that... unless they know, what they have to do :)
Imho, making gmp to autodetect arch will do as much work for them, as using -march=native in CFLAGS.

When there is GMP article at gentoo wiki, as well as lint to it, e.g. from GCC page (one of depending on gmp), that page would have more chances to be visited.
________
Current version is now 6.1.2.
I managed to emerge gmp for sandybridgenoavx (i have intel b950) by runing:
 $ ebuild `equery w gmp` configure
 - restoring config.guess and config.sub from sources
 $ ebuild `equery w gmp` merge
Though pgo tuning fails, improvements may be noticed. I made a test, involving libqalculate (another completely depending on gmp/mpfr), to compute 4 functions: linear, sin, parabola and hyperbola, for 400000 points.
- before such rebuild it took from 24 to 27 to complete (usually not less 25 or 26).
- after rebuild: 23

For function x*y, which did several times more poits, result before - 73-74s, after - 70. Not so big of course - could be a bit more for more modern cpu, with avx, avx2, etc.
Comment 9 Larry the Git Cow gentoo-dev 2022-12-01 03:42:09 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 10 Larry the Git Cow gentoo-dev 2022-12-06 10:53:11 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(-)