Trouble installing Boost C++ - c++

Right now, I am trying to install boost on my computer, a Mac running Mavericks. I have downloaded and decompressed boost into the directory
$HOME/local/src/
After decompressing, I moved it to a new directory inside the boost source directory:
tools/build/v2
I then executed
./boostrap.sh --with-toolset=gcc
This all went fine. The next step is where the problems start: in the src file, I executed the following command:
tools/build/v2/boost_1_57_0/b2 install --prefix=PREFIX --toolset=gcc --with-program_options --with-filesystem
It then returned the following error:
Unable to load Boost.Build: could not find "boost-build.jam"
---------------------------------------------------------------
BOOST_ROOT must be set, either in the environment, or
on the command-line with -sBOOST_ROOT=..., to the root
of the boost installation.
It says it can't find boost-build.jam, but I open up the folder in Finder and I see boost-build.jam right there in my boost_1_57_0 folder. What can I do to execute this command? Am I doing something wrong? If it runs correctly, I should have a PREFIX/include directory with header files for boost. What can I do to get this? Here is a link to the site for Boost if that will help:
http://www.boost.org
Also, I have already found this page on how to install Boost:
How do you install Boost on MacOS?
Will the method this user describes give the same result that the code above would if it was functioning properly? Thank you in advance.

Install brew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then do:
brew install boost-build
After that you will have the bjam executable in /usr/local/bin/bjam.

Thank you to elyase for his response. I have also found a way to solve the problem posted above that doesn't use brew. I was making the mistake of making a new tools/build/v2 folder in my src folder--however, I was supposed to cd into the tools/build folder already in the downloaded boost folder. Also, in the newer versions of boost, there is no v2 folder--so just use
tools/build/b2 install --prefix=PREFIX --toolset=gcc --with-program_options --with-filesystem
Hopefully this will help people who are new to Mac (like me) who are having similar problems.

Related

Change where I installed Cmake initially to usr/local/bin on mac

I am new to the computer and as I wanted to install Cmake instead of installing it in usr/bin or usr/local/bin I installed it in Users/Admin/Source!
Could you help me to figure out how can I change its directory or do I have to uninstall it completely?!
To install Cmake I followed the steps here http://mac-dev-env.patrickbougie.com/cmake/, except the first line.
Thanks
If you successfully went through the steps in the link you provided, cmake is now installed in /usr/local/cmake/bin.
(From what I understand you just did the download in another directory which is fine).
Since the tutorial also tells you to add this directory to your PATH it should be fine. i.e cmake should be accessible from anywhere after sourcing again your .bash_profile or simply opening a new terminal.
If for any other reason you need cmake to be in /usr/local/bin. you can create a symbolic link in this directory:
ln -s /usr/local/cmake/bin/cmake /usr/local/bin/cmake

can't include <X11/Xft/Xft.h> when compiling nana library, no such file or directory

I'm trying to install the nana C++ library in Ubuntu 16.04.
I downloaded and unzipped it into the directory with my helloworld file, and went to the directory with the makefile; nana/build/makefile, and typed make but got the error
X11/Xft/Xft.h: no such file or directory
I checked /usr/include/X11 and yeah, it's not there. Googling has not helped figure out hot to install Xft. How do I do it? Or am I doing something else wrong?
This header seems to be in libxft-dev package. Install it with your package manager. If it is apt, try:
sudo apt install libxft-dev

Boost C++ library Version Issue

After downloading and untar the file "boost_1_56_0.tar.gz", I have installed Boost C++ library version "boost_1_56_0" in CentOS Linux.
I have run the following commands to install:
sudo ./bootstrap.sh --prefix=/usr/local
sudo ./b2 install.
I also added two paths to the PATH variable:
export PATH=$PATH:/usr/local/include/:/usr/local/lib/
It has been successfully installed. However when I checked the version it showed different version:
$ cat /usr/include/boost/version.hpp | grep "BOOST_LIB_VERSION"
#define BOOST_LIB_VERSION "1_33_1"
I have tried to install boost_1_55_0 as well in another folder but unfortunately still it shows version 1_33_1.
Can anyone here tell me how I can fix this issue?
Because of this issue, I am unable to configure Graph_tool; it shows following error:
checking for boostlib >= 1.53.0... configure: error: We could not detect the boost libraries (version 1.53 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 . See http://randspringer.de/boost for more documentation>
Your bootstrap path is /usr/local. Make sure your BOOST_ROOT points to your bootstrapped folder, not the installed 1.33 version.

Installing c++ boost using cygwin: can't find configure file

I'm trying to install Boost for c++. Since I use cygwin (on Windows 7) I follow these instructions for Unix.
I start by downloading boost_1_55_0.zip from sourceforge. The instructions tell me to run tar --bzip2 -xf /path/to/boost_1_55_0.zip but this doesn't work (probably because the downloaded file is .zip and not .tar.bz2; I can't find the latter anywhere to download), so instead I use winrar and unzip it into /usr/local.
After this the header-only libraries work fine, but I need the ones where a build is necessary.
The instructions tells me to go to the boost folder and run./configure --help, but this doesn't work; I get the message -bash: ./configure: No such file or directory. So I locate the file configure in the folder /usr/local/boost_1_55_0/tools/build/v2/engine/boehm_gc, go there and try again, and this time it works: I get the help for configure.
I then try to run ./configure --prefix=/usr/local/boost_1_55_0 --enable-cplusplus but get the error message configure: error: cannot run /bin/sh ./config.sub. I try it with only one or none of the options too but that doesn't help.
Any ideas?
I don't know what guide you're following, but to install boost I have done:
cd boost
./bootstrap.sh
./b2
./b2 install
stop
As report boost doc:
If you plan to build from the Cygwin bash shell, you're actually
running on a POSIX platform and should follow the instructions for
getting started on Unix variants. Other command shells, such as
MinGW's MSYS, are not supported—they may or may not work.

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.