Skip to content

Flint configure fails when using system GMP in certain cases #28409

@embray

Description

@embray

The hand-written configure script for flint has a clause like this:

if [ -d "${GMP_DIR}/lib" ]; then
   GMP_LIB_DIR="${GMP_DIR}/lib"
   GMP_INC_DIR="${GMP_DIR}/include"
elif [ -d "${GMP_DIR}/lib64" ]; then
   GMP_LIB_DIR="${GMP_DIR}/lib64"
   GMP_INC_DIR="${GMP_DIR}/include"
elif [ -d "${GMP_DIR}/.libs" ]; then
   GMP_LIB_DIR="${GMP_DIR}/.libs"
   GMP_INC_DIR="${GMP_DIR}"
else
   echo "Invalid GMP directory"
   exit 1
fi

By default, if --with-gmp is not given, it just arbitrarily defaults to GMP_DIR=/usr/local. This means that if none of the directories /usr/local/lib, /usr/local/lib64, or /usr/local/.libs exist (note: this has nothing directly to do with detecting GMP), the script will exit with an error code.

It does something similar with MPFR and NTL.

I don't have a strong opinion on how to deal with this. We could either patch it out. Or we could point it to a directory that does exist (e.g. $SAGE_LOCAL/lib, even if GMP is not actually installed there). Or write some more sophisticated detection code for GMP, though I feel that such efforts are often overkill: The way autoconf works w.r.t. system packages is if the headers and libraries are in the default paths searched by the compiler/linker then it shouldn't be necessary to provide additional flags.

In other words, flint's configure, without an explicit --with-gmp, shouldn't and needn't do anything to try to provide an otherwise bogus path for GMP...

CC: @dimpase @slel @wbhart @zerline

Component: build: configure

Keywords: flint

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/28409

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions