Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 771663 - sci-mathematics/flint-2.6.3 fails configure: GMP version was not detected
Summary: sci-mathematics/flint-2.6.3 fails configure: GMP version was not detected
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrick Lauer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 766977
  Show dependency tree
 
Reported: 2021-02-19 19:44 UTC by Thomas Deutschmann (RETIRED)
Modified: 2021-05-28 19:27 UTC (History)
4 users (show)

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


Attachments
build.log (build.log,3.69 KB, text/plain)
2021-02-19 19:44 UTC, Thomas Deutschmann (RETIRED)
Details
0001-CMake-FindGMP.cmake-compile-a-test-program-to-check-.patch (0001-CMake-FindGMP.cmake-compile-a-test-program-to-check-.patch,4.94 KB, patch)
2021-04-19 21:02 UTC, Michael Orlitzky
Details | Diff
0001-CMake-FindGMP.cmake-compile-a-test-program-to-check-.patch (0001-CMake-FindGMP.cmake-compile-a-test-program-to-check-.patch,5.58 KB, patch)
2021-04-19 21:56 UTC, Michael Orlitzky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann (RETIRED) gentoo-dev 2021-02-19 19:44:11 UTC
Created attachment 687651 [details]
build.log

> -- GMP version was not detected
> CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
>   Could NOT find GMP (missing: GMP_VERSION_OK) (Required is at least version
>   "5.1.0")
> Call Stack (most recent call first):
>   /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
>   CMake/FindGMP.cmake:74 (find_package_handle_standard_args)
>   CMakeLists.txt:31 (find_package)
> 
> 
> -- Configuring incomplete, errors occurred!
> See also "/var/tmp/portage/sci-mathematics/flint-2.6.3/work/flint-2.6.3_build/CMakeFiles/CMakeOutput.log".
>  * ERROR: sci-mathematics/flint-2.6.3::gentoo failed (configure phase):
>  *   cmake failed


Portage 3.0.13 (python 3.8.7-final-0, default/linux/x86/17.0, gcc-9.3.0, glibc-2.32-r6, 5.4.97-gentoo-x86 i686)
=================================================================
System uname: Linux-5.4.97-gentoo-x86-i686-with-glibc2.1.3
KiB Mem:     3106076 total,   1997316 free
KiB Swap:    8387560 total,   8357436 free
Timestamp of repository gentoo: Fri, 19 Feb 2021 14:37:40 +0000
Head commit of repository gentoo: fc67b33c6e61f1f439ffc270260e06cce6ee7dde

sh bash 5.0_p18
ld GNU ld (Gentoo 2.35.1 p2) 2.35.1
ccache version 4.1 [enabled]
app-shells/bash:          5.0_p18::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          3.8.7-r1::gentoo, 3.9.1-r1::gentoo
dev-util/ccache:          4.1::gentoo
dev-util/cmake:           3.18.5::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.2-r1::gentoo
sys-devel/binutils:       2.35.1-r1::gentoo
sys-devel/gcc:            9.3.0-r2::gentoo
sys-devel/gcc-config:     2.3.2-r1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.32-r6::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/sync/gentoo.git
    priority: -1000

ABI="x86"
ABI_X86="32"
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="*"
ACCEPT_PROPERTIES="*"
ACCEPT_RESTRICT="*"
ADA_TARGET="gnat_2018"
ARCH="x86"
BINPKG_COMPRESS="bzip2"
BROOT=""
CBUILD="i686-pc-linux-gnu"
CCACHE_DIR="/var/cache/ccache"
CFLAGS="-O2 -pipe -march=pentium4m -mtune=pentium4m -Wno-error=jump-misses-init -Wno-error=sign-compare"
CHOST="i686-pc-linux-gnu"
CHOST_x86="i686-pc-linux-gnu"
COLLISION_IGNORE="/lib/modules/*"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CPU_FLAGS_X86="mmx mmxext sse sse2"
CXXFLAGS="-O2 -pipe -march=pentium4m -mtune=pentium4m -Wno-error=jump-misses-init -Wno-error=sign-compare"
DCC_EMAILLOG_WHOM_TO_BLAME=""
DEFAULT_ABI="x86"
DISTCC_ENABLE_DISCREPANCY_EMAIL=""
DISTCC_FALLBACK="1"
DISTCC_SAVE_TEMPS="0"
DISTCC_SSH=""
DISTCC_TCP_CORK=""
DISTCC_VERBOSE="0"
EDITOR="/usr/bin/mcedit"
ELIBC="glibc"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
EPREFIX=""
EROOT="/"
ESYSROOT="/"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg ccache cgroup config-protect-if-modified distlocks downgrade-backup ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=i686 -pipe"
GCC_SPECS=""
GRUB_PLATFORMS="efi-32 pc"
GSETTINGS_BACKEND="dconf"
HOME="/root"
INFOPATH="/usr/share/gcc-data/i686-pc-linux-gnu/9.3.0/info:/usr/share/binutils-data/i686-pc-linux-gnu/2.35.1/info:/usr/share/info"
INPUT_DEVICES="libinput"
IUSE_IMPLICIT="abi_x86_32 prefix prefix-guest prefix-stack"
KERNEL="linux"
L10N="en en-US de de-DE"
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LC_MESSAGES="C"
LC_PAPER="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LIBDIR_x86="lib"
LINGUAS="en de"
LOGNAME="root"
LUA_SINGLE_TARGET="lua5-1"
LUA_TARGETS="lua5-1"
MAIL="/var/mail/root"
MAKEOPTS="--jobs 5 --load-average 7.95"
MANPAGER="manpager"
MOTD_SHOWN="pam"
MULTILIB_ABIS="x86"
NOCOLOR="true"
OFFICE_IMPLEMENTATION="libreoffice"
OPENCL_PROFILE="ocl-icd"
OPENGL_PROFILE="xorg-x11"
PAGER="/usr/bin/less"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/11/bin"
PHP_TARGETS="php7-3 php7-4"
POSTGRES_TARGETS="postgres10 postgres11"
PWD="/root"
PYTHONDONTWRITEBYTECODE="1"
PYTHON_SINGLE_TARGET="python3_8"
PYTHON_TARGETS="python3_8"
QT_GRAPHICSSYSTEM="raster"
ROOT="/"
ROOTPATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/11/bin"
RUBY_TARGETS="ruby25 ruby26"
SHELL="/bin/bash"
SHLVL="2"
SSH_TTY="/dev/pts/0"
SYSROOT="/"
TERM="tmux-256color"
TMUX="/tmp//tmux-0/default,3324,0"
TMUX_PANE="%2"
TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
UNCACHED_ERR_FD=""
USER="root"
USERLAND="GNU"
VIDEO_CARDS="vmware"
XDG_RUNTIME_DIR="/run/user/0"
XDG_SESSION_CLASS="user"
XDG_SESSION_ID="2"
XDG_SESSION_TYPE="tty"
Comment 1 Michael Orlitzky gentoo-dev 2021-02-21 03:29:29 UTC
GMP is installed, right?

What does `equery f dev-libs/gmp` output?
Comment 2 Michael Orlitzky gentoo-dev 2021-03-15 17:58:24 UTC
@whissi halp
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2021-03-15 22:50:53 UTC
> # equery f dev-libs/gmp
>  * Searching for gmp in dev-libs ...
>  * Contents of dev-libs/gmp-6.2.1:
> /usr
> /usr/include
> /usr/include/gmp.h
> /usr/include/gmpxx.h
> /usr/include/i686-pc-linux-gnu
> /usr/include/i686-pc-linux-gnu/gmp.h
> /usr/lib
> /usr/lib/libgmp.so -> libgmp.so.10.4.1
> /usr/lib/libgmp.so.10 -> libgmp.so.10.4.1
> /usr/lib/libgmp.so.10.4.1
> /usr/lib/libgmpxx.so -> libgmpxx.so.4.6.1
> /usr/lib/libgmpxx.so.4 -> libgmpxx.so.4.6.1
> /usr/lib/libgmpxx.so.4.6.1
> /usr/lib/pkgconfig
> /usr/lib/pkgconfig/gmp.pc
> /usr/lib/pkgconfig/gmpxx.pc
> /usr/share
> /usr/share/doc
> /usr/share/doc/gmp-6.2.1
> /usr/share/doc/gmp-6.2.1/AUTHORS.bz2
> /usr/share/doc/gmp-6.2.1/ChangeLog.bz2
> /usr/share/doc/gmp-6.2.1/NEWS.bz2
> /usr/share/doc/gmp-6.2.1/README.bz2
> /usr/share/doc/gmp-6.2.1/configuration.bz2
> /usr/share/doc/gmp-6.2.1/html
> /usr/share/doc/gmp-6.2.1/html/doc
> /usr/share/doc/gmp-6.2.1/html/doc/Makefile.am
> /usr/share/doc/gmp-6.2.1/html/doc/Makefile.in
> /usr/share/doc/gmp-6.2.1/html/doc/configuration
> /usr/share/doc/gmp-6.2.1/html/doc/fdl-1.3.texi
> /usr/share/doc/gmp-6.2.1/html/doc/gmp.info
> /usr/share/doc/gmp-6.2.1/html/doc/gmp.info-1
> /usr/share/doc/gmp-6.2.1/html/doc/gmp.info-2
> /usr/share/doc/gmp-6.2.1/html/doc/gmp.texi
> /usr/share/doc/gmp-6.2.1/html/doc/isa_abi_headache
> /usr/share/doc/gmp-6.2.1/html/doc/mdate-sh
> /usr/share/doc/gmp-6.2.1/html/doc/projects.html
> /usr/share/doc/gmp-6.2.1/html/doc/stamp-vti
> /usr/share/doc/gmp-6.2.1/html/doc/tasks.html
> /usr/share/doc/gmp-6.2.1/html/doc/texinfo.tex
> /usr/share/doc/gmp-6.2.1/html/doc/version.texi
> /usr/share/doc/gmp-6.2.1/isa_abi_headache.bz2
> /usr/share/info
> /usr/share/info/gmp.info-1.bz2
> /usr/share/info/gmp.info-2.bz2
> /usr/share/info/gmp.info.bz2
Comment 4 Thomas Deutschmann (RETIRED) gentoo-dev 2021-03-15 22:51:34 UTC
dev-libs/gmp-6.2.1::gentoo was built with the following:
USE="asm cxx -doc -pic -static-libs"
Comment 5 François Bissey 2021-03-15 23:19:31 UTC
@Thomas would you be able and ready to do some manual experiments for me? Alternatively can you attach the folder flint-2.6.3_build (in tar.bz2) which may have cache and log info from cmake. Dealing with config.log in autotools is way easier :(
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-03-15 23:20:53 UTC
Could you attach CMakeOutput.log (and possibly Error, although it's never really helped me)?
Comment 7 Michael Orlitzky gentoo-dev 2021-03-15 23:27:06 UTC
I see the problem... the file at /usr/include/gmp.h is just a wrapper that includes the real file at /usr/include/<arch>/gmp.h. And the check in FindGMP.cmake is too naive. Instead of building a test program, it's grepping the header to find what it needs.

The problem is thus that it's grepping the wrapper at /usr/include/gmp.h instead of the actual header (that would be included transitively) at /usr/include/<arch>/gmp.h.

This just happens to work on amd64 because Dima added a patch that checks for /usr/include/x86*/gmp.h, and that matches the location /usr/include/x86_64-pc-linux-gnu/gmp.h.

For a quick hack we could add i686*/gmp.h to the list of paths, but now is probably the best time to replace the hacks with something reliable.
Comment 8 Michael Orlitzky gentoo-dev 2021-04-19 20:25:19 UTC
I tried to fix this by compiling a test program:

  try_run(GMP_VERSION_OK,
          GMP_VERSION_COMPILE_OK,
	  ${PROJECT_BINARY_DIR},
  	  ${PROJECT_BINARY_DIR}/gmp-version-check.c,
	  CMAKE_FLAGS
	   -DGMP_FIND_VERSION_MAJOR=${GMP_FIND_VERSION_MAJOR},
	   -DGMP_FIND_VERSION_MINOR=${GMP_FIND_VERSION_MINOR},
	   -DGMP_FIND_VERSION_PATCH=${GMP_FIND_VERSION_PATCH})

However, CMake is being stupid today:

  CMake Error at CMake/FindGMP.cmake:55 (try_run):
    Unknown extension ".c," for file

      /home/mjo/src/flint2/gmp-version-check.c,

    try_compile() works only for enabled languages.  Currently these are:

      C CXX

    See project() command to enable other languages.

If anyone knows why CMake thinks that ".c" is not a C extension, I'd love to know myself.
Comment 9 François Bissey 2021-04-19 20:28:08 UTC
I think the comma "," at the end is the issue. It thinks the extension is ".c,". Note how the comma is part of what is quoted. This probably need some quotes.
Comment 10 François Bissey 2021-04-19 20:59:47 UTC
The documentation is actually showing no commas at all anywhere. https://cmake.org/cmake/help/latest/command/try_run.html
Comment 11 Michael Orlitzky gentoo-dev 2021-04-19 21:01:50 UTC
(In reply to François Bissey from comment #10)
> The documentation is actually showing no commas at all anywhere.
> https://cmake.org/cmake/help/latest/command/try_run.html

Right, the fact that I don't know what I'm doing in CMake turns out to be the problem once again!
Comment 12 Michael Orlitzky gentoo-dev 2021-04-19 21:02:46 UTC
Created attachment 700935 [details, diff]
0001-CMake-FindGMP.cmake-compile-a-test-program-to-check-.patch

Here's what I came up with. After fixing the commas and a few more issues, it looks like it's doing what I think it does.
Comment 13 François Bissey 2021-04-19 21:05:35 UTC
Looks alright to me.
Comment 14 Michael Orlitzky gentoo-dev 2021-04-19 21:56:09 UTC
Created attachment 700938 [details, diff]
0001-CMake-FindGMP.cmake-compile-a-test-program-to-check-.patch

Here's an improved version that moves up the call to find_library(), and then uses the found header/library during compilation/linking of the test program.
Comment 15 Larry the Git Cow gentoo-dev 2021-04-22 01:31:18 UTC
The bug has been referenced in the following commit(s):

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

commit 491b50cf718ca492e2d3329545b6709783264a5e
Author:     Michael Orlitzky <mjo@gentoo.org>
AuthorDate: 2021-04-22 01:10:11 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2021-04-22 01:10:11 +0000

    sci-mathematics/flint: new revision to fix x86 gmp detection.
    
    The FindGMP routine in upstream's CMake is using voodoo to determine
    the version of gmp that's installed. The sorcery succeeds quite
    accidentally on amd64, but fails on x86. We patch their cmake
    to do something more reliable.
    
    Bug: https://bugs.gentoo.org/771663
    Package-Manager: Portage-3.0.17, Repoman-3.0.2
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 .../files/flint-2.7.1-fix-cmake-findgmp.patch      | 152 +++++++++++++++++++++
 .../{flint-2.7.1.ebuild => flint-2.7.1-r1.ebuild}  |   2 +
 2 files changed, 154 insertions(+)
Comment 16 Michael Orlitzky gentoo-dev 2021-04-22 01:36:00 UTC
Whissi, can you please try flint-2.7.1-r1 to make sure it works? If it does, we can switch the stablereq to that version and make Andreas happy as well.
Comment 17 Michael Orlitzky gentoo-dev 2021-05-22 01:14:19 UTC
@whissi: ping... I'd like to know if this works before I send it upstream =)
Comment 18 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-05-25 11:48:01 UTC
Patch fixed the issue here at least. Could you backport to the previous version too?
Comment 19 Michael Orlitzky gentoo-dev 2021-05-26 10:44:12 UTC
(In reply to Sam James from comment #18)
> Patch fixed the issue here at least. Could you backport to the previous
> version too?

Thanks! Do we need the previous version for anything? This bug killed its stablereq, and if it's all the same to everyone else, I'd rather just move forward stabilizing 2.7.1 with the patch.
Comment 20 François Bissey 2021-05-26 10:52:38 UTC
I thought there was some changes in sage needed for supporting flint 2.7 but it looks like I was mistaken or that they have been merged in some other ticket. If we can build sage 9.3 in the sage-on-gentoo overlay with it then I am OK to drop 2.6.3.
Comment 21 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-05-26 11:01:28 UTC
(In reply to Michael Orlitzky from comment #19)
> (In reply to Sam James from comment #18)
> > Patch fixed the issue here at least. Could you backport to the previous
> > version too?
> 
> Thanks! Do we need the previous version for anything? This bug killed its
> stablereq, and if it's all the same to everyone else, I'd rather just move
> forward stabilizing 2.7.1 with the patch.

I only hit it because of the pending stabilisation of the fixed version, so no objections from me to your plan!
Comment 22 Larry the Git Cow gentoo-dev 2021-05-28 19:27:52 UTC
The bug has been closed via the following commit(s):

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

commit 23c86f8f7da0613fef04521842168147f21bfc62
Author:     Michael Orlitzky <mjo@gentoo.org>
AuthorDate: 2021-05-28 19:09:42 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2021-05-28 19:27:46 +0000

    sci-mathematics/flint: update GMP detection patch.
    
    The new patch to fix detection of GMP was unnecessarily hostile to
    cross-compiling, but someone was nice enough to point it out on the
    upstream pull request. Here's the patch that was accepted upstream.
    
    Closes: https://bugs.gentoo.org/771663
    Package-Manager: Portage-3.0.18, Repoman-3.0.2
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 .../files/flint-2.7.1-fix-cmake-findgmp.patch      | 72 ++++++++++------------
 1 file changed, 33 insertions(+), 39 deletions(-)