GMP & MPFR not found by cmake, but are installed
Asked Answered
E

0

8

I'm trying to compile the plll library which require boost, GMP and MPFR on mac os X 10.11.

I've installed boost, GMP and MPFR by homebrew, then i've launched cmake in a dir build in plll, but I get that error :

 By not providing "FindMPFR.cmake" in CMAKE_MODULE_PATH this project has
 asked CMake to find a package configuration file provided by "MPFR", but
 CMake did not find one.

 Could not find a package configuration file provided by "MPFR" with any of
the following names:

MPFRConfig.cmake
mpfr-config.cmake

Add the installation prefix of "MPFR" to CMAKE_PREFIX_PATH or set
"MPFR_DIR" to a directory containing one of the above files.  If "MPFR"
provides a separate development package or SDK, be sure it has been
installed.

And the same for GMP if I change the order of GMP and MPFR in the Librairies.txt used by cmake.

After that i've install the librairies by hand and they are in/usr/local/include. The make check of GMP is perfect so I guess that the installation is ok.

But still the same error message. I've also tried to add a FindMPFR.cmake file but no change at all.

Here is the part of the Libraries.txt which is concerned:

find_package(MPFR REQUIRED)
include_directories(${MPFR_INCLUDES})
if(NOT MPFR_FOUND)
    message(FATAL_ERROR "Could not find MPFR!")
endif(NOT MPFR_FOUND)
set(libraries ${libraries} ${MPFR_LIBRARIES})
set(libraries_shared ${libraries_shared} ${MPFR_LIBRARIES})

find_package(GMP REQUIRED)
include_directories(${GMP_INCLUDE_DIR})
if(NOT (GMP_INCLUDE_DIR AND GMP_LIBRARIES))
    message(FATAL_ERROR "Could not find GMP!")
endif(NOT (GMP_INCLUDE_DIR AND GMP_LIBRARIES))
set(libraries ${libraries} ${GMP_LIBRARIES})
set(libraries_shared ${libraries_shared} ${GMP_LIBRARIES})

The strange part of that is that I've no problem with Boost...

Earthy answered 12/10, 2015 at 9:30 Comment(6)
No idea what the plll library is, but they seem to be missing something... Adding a FindMPFR.cmake (in a suitable location) should have helped though.Peril
Where should I put the FindMPFR.cmake or FINDGMP.cmake? I've tried in the build directory and in the root directory of the lib.Earthy
@MarcGlisse if you can find some more info on that, I think many CMake rookies would be indebted (me included)Hemia
You can always point CMAKE_MODULE_PATH to where you put them. Otherwise, usual technique, strace (well, dtruss on macosx apparently) and see where the program is looking for those files.Peril
Okay, I added the Find... .cmake in the cmake directory, and MPFR is found but still not GMP , I get: Could NOT find Gmp (missing: GMP_INCLUDE_DIR GMP_LIB GMPXX_INCLUDE_DIR GMPXX_LIB) ...Earthy
Is your project type CXX (C++)? The GMP check was not able to find the includes (some -devel packages?) and same for GMPXX which is the GMP library C++ binding. But I am not sure whether homebrew provides packages for them.Instructor

© 2022 - 2024 — McMap. All rights reserved.