c++boostosx-mavericksvowpalwabbit

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.


Solution

  • 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:

    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