Installing sharpSAT on macOS Mojave - "'gmpxx.h' file not found" - c++

By following and installing from sharpSAT, one's suppose to run the setupdev.sh script followed by make command. When running make, I get
'gmpxx.h' file not found error. I did find a lot regarding error 'gmp.h' not found, eg. at here, here and here, but these are when installing some other package with either pip or brew.
I've also tried including usr/local/include (gmpxx.h is located at usr/local/indluce/gmpxx.h) to path variable in .bash_profile as suggested here, but with no good results.
Any suggestions?

Your system is having trouble locating the GNU multiprecision libraries. This answer assumes you used brew install gmp to install the multiprecision library.
In sharpSAT's CMakeLists.txt, change the line:
include_directories(/opt/local/include)
to:
include_directories("/usr/local/Cellar/gmp/X.Y.Z/include")
where X.Y.Z is your version of gmp. To determine which version of gmp you have installed (and in turn where homebrew installed gmp), call:
locate gmp
You may need to build your location database which can take some time.
You should double check that your system no longer has /opt/local/include.

Related

How to change boost path for pip3 install?

I am trying to install a python package using pip3. The python package at some point during installation runs cmake which requires boost (libboost-dev) of version 1.58.
The issue I have is that I have two boost installed, one in /usr/local/include and one in /usr/include. The one in /usr/include is version 1.58, as seen by typing
dpkg -s libboost-dev | grep 'Version'
However, the cmake command finds the version in /usr/local/include, which is 1.54 and too old.
One recommended solution (see How to change boost path) seems to be to set the environmental variable BOOST_ROOT, but running export BOOST_ROOT="/usr/include" before pip does not make a difference.
The other recommended solution is to pass a flag to cmake that sets the path. However, since cmake is run somewhere inside pip3 install, I have no idea how to do that. How to solve this issue, by eg either getting rid of my old boost version or by forcing cmake/pip3 to use my new version (or updating the boost version in /usr/local/include)?
export BOOST_ROOT=/usr
export BOOST_INCLUDE=/usr/include
export BOOST_LIBDIR=/usr/lib
PS. Why don't you remove outdated boost from /usr/local/include and /usr/local/lib?
You can remove (although I recommend renaming it until you are sure) the older boost entry in the global CMake package registry. On Linux it should be here:
~/.cmake/packages/<package>

Unable to import lib tiff after installing Anaconda on Mac OS X 10.9.2

I have developed some software using Python under Windows 7.
I have given it to a colleague to run on a Mac (OS X 10.9.2). I have never used a Mac and am having trouble helping them to get started. I have downloaded and installed Anaconda 1.9.2 on the Mac. According to the continuum documentation, libtiff is included, but when I run my python file using the Spyder IDE I get the following error when it tries to import libtiff:
ImportError: No module named libtiff.
Following one of the answers on Stack Ooverflow, I tried:
conda install libtiff
This runs and returns:
All requested packages already installed.
However on Windows 7 I can see a libtiff folder under \python27\lib\site-packages. On the Mac there is no libtiff folder under /lib/python2.7/site-packages.
Can anyone tell me what I am missing?
This question is answered here:
Installing Python modules with Anaconda or Canopy
If pip install libtiff does not work, you can download the source for PyLibTiff as directed at https://code.google.com/p/pylibtiff/source/checkout and run setup.py with whichever interpreter you would like for PyLibTiff to be installed to.
Also, you do not have to have the the C libraries that Anaconda installs installed for PyLibTiff to work if you have libtiff libraries installed elsewhere.
Unclear on this. But what you can do to begin with is to type echo $PATH from the terminal and see what paths are set. Unclear on how Anaconda interacts with the system, but a good hunch is that if the library file is not in a path then that would cause this.
Also, looking at this thread on Google Groups it seems that Anaconda installs it’s own libraries that might need to be symbolically linked into the main /usr/local/lib directory. The user Denis Engemann—who made the post—posts this bash script in the last response in the thread:
for lib in ~/anaconda/lib/*;
do
ln -s $lib /usr/local/lib/$(basename $lib);
done
I would recommend checking those two directories first before linking to make sure all is as expected.

Does Linux command libboost-all-dev install and compile the header-only libraries?

On Ubuntu there is a command to install boost libraries which is something like this:
sudo apt-get install libboost-all-dev
does this command also install and compile the header-only libraries?
If not, what other terminal command would I need to execute so that I can install the FULL set of boost libraries?
My ultimate aim is to know which linux terminal commands I need to install (and have available) to obtain all of the boost libraries.
As is implied by "header only", one does not need to compile the header-only libraries. They're just headers.
Now, the libbost-all-dev package does install those libraries which need compilation (in addition to the header-only libs), but it does not compile them on the spot. Ubuntu is a so-called binary distribution, which means that it distributes packages in compiled form. Apt downloads the binaries and installs them immediately. This is in contrast to e.g. Gentoo which is a source distribution (and compiles everything on your machine).
In short, no further commands are necessary. Installing libbost-all-dev will install all available Boost libraries on Ubuntu.
Your questions, as posed, makes no sense.
The Debian / Ubuntu package libboost-all-dev has dependencies, and those dependencies do include the few binary library packages (eg Boost Thread, the formatting parts of Boost DateTime, etc pp). All those will get installed.
And yes, the intent of this meta package is to install the rest of the Boost development environment.
But it does not compile anything. All Debian / Ubuntu packages are pre-generated and built-offline and "just installed" at your end.
You can inspect the content of a package by browsing the online database.
But if you are only interested in header-only libraries I suggest to download the latest version of the boost libraries right from the official website; you should also learn how to build boost from the source because it's a know-how that you are very likely to use in a near future if you are relying on that library.
An equivalent step to browsing the online database, it's about using the following command
apt-cache show <package>
so, in your case
apt-cache show libboost-all-dev
and this will give you a very specific idea about what you are about to install.

Can't find bjam in boost homebrew installation

I installed Boost with homebrew(brew install boost) on my Mac running Lion with the purpose of extending python with an existing C++ program I have. Now I can't follow the starting guide because 1 - I don't have 'bjam' installed in my system and 2-I don't see the examples folder anywhere. My question is: how I am supposed to do the the c++-python linking with this homebrew installation without 'bjam'? is there some alternative method I should use or something I am missing here?
The right formula to install boost for linking c++ with python programs is:
brew install boost-build
as pointed out by senderle in the comments to my question. This installs bjam automatically.
For Windows, you go into $(BoostDir)\tools\build\v2\engine and run build.bat which automatically builds bjam (into the bin.ntx86 directory on windows). There is a build.sh file there too, but I've never used a Mac so I don't know if that will work for you. Otherwise, just do a Google search for a precompiled bjam executable for Mac OS X.
It should just be a case of downloading Boost then running "Bootstrap" followed by "Bjam".
Bootstrap should build you a Bjam executable in the Boost folder.

Boost c++ library install

I am not familiar with the usual build technique in linux I am using boost c++ library. Can any body guide me in installing and configuring boost c++ library. Thanks in advance
My environment is Linux Fedora 15. On it, one can easily install boost by typing,
$ yum install boost-devel
After installation, you'll find boost under /usr/include/boost/.
However, if you run,
$yum install boost
you'll only find .so of boost under /usr/lib/, like /usr/lib/libboost_timer.so.1.48.0.
It's OK if you're not familiar with the usual build technique because Boost doesn't use the usual build technique. Follow the instructions in the "getting started" documentation. Make sure you read all the way to the bottom of the page. The link to the Unix-specific instructions is at the very, very bottom.
For most parts of Boost, installation is synonymous with unpacking the tarball into your preferred include directory. Other parts of Boost require compilation, so go to the Boost installation directory, run ./bootstrap.sh, and then run ./bjam install.
depending on the Linux distribution you are using, you'll probably find boost is already built and packaged for you, e.g. on Fedora "yum install boost"
Rob Kennedy's answer is still valid except that is recommended now to install with ./b2 instead of ./bjam.