GMP & MPFR not found by cmake, but are installed - macos

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...

Related

Why could GCC find the libraries for GMP, and MPFR, but not for the MPC?

I am trying a build gcc on my Mac it is an intel Mac. I do have these libraries, the libraries are here, so it is usr/local/lib for the libraries and the headers are here usr/local/include. I also successfully compiled and install gmp and mpfr accept the mpc for some reason it is not locating.
gcc error:
configure: error: Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
https://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
Mpc error:
configure: error: gmp.h cannot be found or is unusable.

Clion can't find a library installed using homebrew

I am working on MacOS and using homebrew to install libraries. The library that I am trying to get working is freeImage which installed just fine using homebrew.
In Clion to link library I edited CmakeLists.txt file to contain:
target_link_libraries(Tutorial_2 freeimage)
I get the following output when trying to compile:
ld: library not found for -lfreeimage
Never had issues with this using linux and not sure what i'm doing wrong here?
First, you need to find the installation path of this library by brew info freeimage. My example is /usr/local/Cellar/freeimage/3.18.0:
freeimage: stable 3.18.0 (bottled), HEAD
Library for FreeImage, a dependency-free graphics library
https://sourceforge.net/projects/freeimage
/usr/local/Cellar/freeimage/3.18.0 (16 files, 29.9MB) *
then, modify your CMakeLists.txt to fix the problem:
cmake_minimum_required(VERSION 3.22)
project(libuv_clion C)
set(FREE_IMAGE_DIR /usr/local/Cellar/freeimage/3.18.0) # set the lib path
include_directories(${FREE_IMAGE_DIR}/include/) # include the lib
link_directories(${FREE_IMAGE_DIR}/lib/) # link the lib
set(CMAKE_C_STANDARD 11)
add_executable(libuv_clion main.c)
target_link_libraries(libuv_clion freeimage)

could not detect boost libraries when running ./configure when compiling bitcoin core code

This is the error I get:
checking for boostlib >= 1.58.0 (105800)... configure:
We could not detect the boost libraries (version 1.58.0 or higher).
If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option.
If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.
configure: error: Boost is not available!
I am on the latest version of macOS big sur and I installed boost with homebrew. I believe boost should be installed in usr/local/include, but for me, it is installed in /opt/homebrew/opt/boost. Could this be the issue? I used a symlink to go from usr/local/include to /opt/homebrew/opt/boost but it didn't work when I cded into the bitcoin folder and then ran ./configure.
export BOOST_ROOT=/opt/homebrew/opt/boost
./configure --with-gui=no --without-bdb --with-boost=$BOOST_ROOT
Your options may differ

Octave configure cannot find Qt library on OS X

I have installed QT 4.8 library on my OS X through direct install with .dmg file downloaded from qt-project.org. It seems a framework version. And so far, a lot of tools recognises it well. But when I am building octave on this computer, it gives a warning of "Qt libraries not found". I wonder why. And what can I do to make it recognise the qt lib on my machine.
The command I used for configure is
./configure --prefix=/usr/local --enable-shared F77=gfortran-4.2 LDFLAGS='-L/usr/local/lib'
(further information)
I did tried to find the installation of QT with
find find /Library/ -name QtGui
Returning result being
/Library//Frameworks/QtGui.framework/QtGui
/Library//Frameworks/QtGui.framework/Versions/4/Headers/QtGui
/Library//Frameworks/QtGui.framework/Versions/4/QtGui
Along with the fact that ipython notebook --matplotlib=qt is working well on my system, I assume my Qt Library is successfully installed.
But when performing the check with pkg-config, both pkg-config --cflag QtGui and pkg-config --libs QtGui return no positive result.
Make sure your Qt installation is working. I'll assume it was correctly installed and is visible to the operating system you're using.
The configure command you have pasted accepts two environment variables, QT_CFLAGS and QT_LIBS. Use the pkg-config tool to determine their appropriate values:
pkg-config --cflags QtGui
pkg-config --libs QtGui
and add this information to the command line:
./configure QT_CFLAGS='foo' QT_LIBS='bar' # other stuff...
I think I know the answer now. qt-4.8 installed through .dmg file is a framework version. There is no Qt*.pc file, thus is not able to be found by pkg-config. So, in order to use pkg-config to find qt installed in the system, you need to build qt from source(source downloadable from qt-project.org), specifying that a -no-framework version is to be built:
./configure -no-framework --foo --bar
make
sudo make install
After building and installing, qt would be located in(by default)
/usr/local/Trolltech/Qt-4.8.6/lib/pkgconfig/
Thus adding a line to ~/.bashrc
export PKG_CONFIG_PATH="/usr/local/Trolltech/Qt-4.8.6/lib/pkgconfig/:${PKG_CONFIG_PATH}"
would help pkg-config locating the qt in your system.
If you have installed QT by .run file, you might find pkgconfig folder. For me, I have installed QT to "/opt/qt5.15.x/" and I find this path "/opt/qt5.15.x/5.15.2/gcc_64/lib/pkgconfig". Referencing pkg-config-path-environment-variable, I add it to PKG_CONFIG_PATH by
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/qt5.15.x/5.15.2/gcc_64/lib/pkgconfig/
And then, Octave configure find QT. And it's better to check the .pc file in your pkgconfig folder. "prefix" in the .pc files might be wrong.

configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+

I am attempting to build GCC-4.7.0 on a MacBook Pro running OS X 10.7.4. However, I am continuing to experience the same error:
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
This error occurred after running the following line:
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/
To get rid of this error I have tried the following actions:
Using homebrew I downloaded gmp-5.0.4, mpc-0.21, and mpfr-3.1.0. At this point I attempting to point to where gmp, mpc, and mpfr are located with the following command:
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/ --with-mpfr=/usr/local/Cellar/ --with-mpc=/usr/local/Cellar/
However, this caused the same error. So, I tried pointing gcc to various locations around the Cellar directory:
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/gmp/ --with-mpfr=/usr/local/Cellar/mpfr --with-mpc=/usr/local/Cellar/mpc/
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/gmp/5.0.4/ --with-mpfr=/usr/local/Cellar/mpfr/3.1.0/ --with-mpc=/usr/local/Cellar/mpc/0.21/
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/gmp/5.0.4/include/ --with-mpfr=/usr/local/Cellar/mpfr/3.1.0/include/ --with-mpc=/usr/local/Cellar/mpc/0.21/share/
In the end these all produced the same error. I then downloaded the versions of gmp, mpc, and mpfr linked from the gcc error message (found here: ftp://gcc.gnu.org/pub/gcc/infrastructure/). After building these from the source and running all the same configurations I am left with the same problem. The configurations I have tried with this installation are:
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/ --with-mpfr=/usr/local/ --with-mpc=/usr/local/
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/include/ --with-mpfr=/usr/local/include/ --with-mpc=/usr/local/include/
Then I read somewhere that there could be a problem if I didn't explicitly set the configuration to run in 64-bit mode. So, I tried all of these configurations again with the added setting of 'CC=gcc -m64'. But this didn't change anything. If anyone has any ideas I would be greatly appreciative.
If you don't know how to build and properly direct GCC's configure to the libraries you can put them in the source tree of GCC itself:
/some/dir/source/gcc/[libstdc++|libgomp|gcc|libiberty|....]
/some/dir/source/gcc/gmp/[configure|...]
/some/dir/source/gcc/mpfr/[configure|...]
/some/dir/source/gcc/mpc/[configure|...]
So without the version number appended. Then just run GCC configure without any arguments related to GMP/MPC/MPFR.
I've faced the same issue and it was easily solved by installing the corresponding development packages: gmp-devel, mpfr-devel and libmpc-devel
Yigal
EasyBuild (a tool to make building software easier) can be of help here. It comes with a small easyconfig file that specifies which GCC version to build, and which features to enable (see for example https://github.com/hpcugent/easybuild/blob/master/easybuild/easyconfigs/g/GCC/GCC-4.7.0.eb).
Once you've downloaded EasyBuild and configured it, you can just run
$EBHOME/easybuild.sh myGCC.eb
with EBHOME set to the location where you unpacked EasyBuild, and myGCC.eb a copy of the example GCC easyconfig, which you modified to your needs.
This command will download the GCC source tarball for you and build/install it, after doing the same to any dependencies, for example GMP, MPFR and MPC, saving you a lot of headaches.
For more information on EasyBuild, see https://github.com/hpcugent/easybuild/wiki .

Resources