Can't find bjam in boost homebrew installation - c++

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.

Related

Header file not found when compiling Vowpal Wabbit on Mac OS X

I have downloaded Vowpal Wabbit ( Version 7.4 ) on to my Mac ( OS X Mavericks ) with the following version of g++ :
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include- dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
I modified the Makefile that comes with the installation so that it will pick up Boost ( Version 1.55 ) headers and libraries from the correct folders on my Mac ( I checked by writing and compiling a simple program and everything works ). However, when I run make it cannot find a header file, for example:
In file included from library_example.cc:2:
./../vowpalwabbit/parser.h:15:10: fatal error: 'boost/program_options.hpp' file
not found
Grateful for any help in tracking down the problem.
vowpal wabbit has a dependency on the C++ library+headers boost/program_options.
This dependency must be installed before vowpal wabbit can be built from source.
Since other people may have a similar issue, I will try to answer the more general question:
How to build vowpal wabbit from scratch/source, on Mac OS-X?
The following set of instructions assumes you have no development environment at all. If you do, you may skip any steps you deem unnecessary.
Important: credit where credit is due. These instructions are almost 100% written by Aaron Shumacher: I sourced them from his page following a web-search, with relatively minor modifications, additions, and clarifications.
Stage 0, basic prerequisites needed for developing on Mac OS-X:
Install the Xcode command line tools. This will give you an Apple’s development environment (compiler, make, etc.).
Install the Homebrew package manager.
Once you have Homebrew installed, everything else that's missing, is easy to install.
Install needed tools to build from source:
brew install libtool
brew install automake
brew install boost
brew install git
Now, you're ready to download the vowpal wabbit source tree (latest):
Download:
git clone https://github.com/JohnLangford/vowpal_wabbit.git
cd vowpal_wabbit
You’re now ready to go through the standard build (aka make) process.
Build:
[Edit: 2014-07-20]: ./autogen.sh may not work well in some environments. I recommend trying to build using a simple make first. The included Makefile is already pretty robust and should work just fine in most environments. The problem with running autogen/automake is that it may overwrite the (pretty good) original Makefile with a bad one.
# ./autogen.sh # commented out, use only if 'make' alone doesn't work
make
make test
Note: it is important to verify (using make test) that your binary works as expected. If you see any failure, please report it on the mailing list, and proceed with the installation only if the failure is immaterial to you (e.g. only some rarely used options/tests you don't care about fail). See the test/RunTests script for full details on the tests.
Install:
make install
At this point, you should have vowpal wabbit at /usr/local/bin/vw

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.

How do I install the boost library to my MinGW compiler?

I'm compiling from the command line using g++ on a Windows MinGW installation. How do I get boost...conceptually or if it is easy...what do I need to download and install?
I know this is an old question but for future reference for anybody coming to this page try this website,
http://nuwen.net/mingw.html
They have done all the hard work so you don't have to. The most recent distribution on this page has boost 1_52_0 (which is the latest version on the boost website as I'm writing this) including the separately compiled libraries (e.g. boost thread, boost regex etc) which I beleive you're asking for
I spent hours searching for a good solution for Boost 1.54. If you already have MinGW and you're just looking for instructions on compiling the binary boost libraries, try this:
From your boost_X_XX_X directory, go to
.\tools\build\src\engine
and type:
build.bat mingw
This will create a folder called bin.ntx86 or bin.ntx86_64 depending on your architecture. Add this directory to your PATH environment variable.
Return to your boost_X_XX_X directory and type:
bjam toolset=gcc
This worked for me on my system. I'd be interested to know if other systems have trouble with these instructions.
However there would have been a simpler, yet identical way; your steps until the bjam call are automatically done by bootstrap.bat:
C:\boost_1_52_0> bootstrap.bat mingw
Building Boost.Build engine
...
C:\boost_1_52_0> b2 toolset=gcc
Reference: https://stackoverflow.com/a/13257930/2171309
Thanx to Neal Kruis. This worked for me. I have Qt 5.4 with mingw 4.9 installed. I downloaded boost 1.59. Go to "...\boost_1_59_0\tools\build\src\engine\" folder
set PATH=%PATH%;c:\Qt\Qt5.4.0\Tools\mingw491_32\bin
build.bat mingw
go to "...\boost_1_59_0\" folder, change boost path accordingly
set PATH=%PATH%;c:\boost_1_59_0\tools\build\src\engine\bin.ntx86
bjam toolset=gcc

Mac OS X Lion and Xcode upgraded: missing headers and libs

After upgrading to Lion, and upgrading Xcode, make can't seem to locate headers and libs. I looked in /usr/include. The only thing in there was 'parallels-server'. So, I renamed /usr/include to /usr/include.old, and made a symlink to:
/Developer/SDKs/MacOSX10.6.sdk/usr/include/
This is pretty evil. But, make can now find headers. Still can't locate libs (e.g., lcrt1.10.6.o).
What is the correct way to solve both the include and lib problems?
Thanks!
After downloading Xcode 4 from the App Store, try running "/Applications/Install Xcode.app".
From me, just downloading the Xcode Command line tools did the trick. (For that, of course, I had first to install Xcode itself, which I installed trough App Store.
Start Xcode
Open Xcode→Preferences...
Select the Downloads tab
Install the Command line tools
That installs a few packages, see /var/db/receipts. The package that contains /usr/include is com.apple.pkg.DevSDKLeo.
I don't think xcode-select is needed, but I had run that command before I downloaded the Command line tools, so I don't know for sure.
To get Xcode to populate the /usr/include directory, run the following command:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
You may need to install the Xcode Command Line Tools within Xcode for this to work. Open the Preferences menu, then under Downloads install Command Line Tools.
The above answer by njamesp also addresses the following error:
configure: error: C compiler cannot create executables
I received this error when trying to compile code on my 10.7 system after setting it up from a 10.5 time machine, so I assume the wrong version of xcode was installed on my system.

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.