'Errors due to vowpal wabbit's dependencies on boost library

I'm trying real hard to install vowpal wobbit and it fails when i run the make file, throwing:

    cd library; make; cd .. 
    g++ -g -o ezexample temp2.cc -L ../vowpalwabbit -l vw -l allreduce -l boost_program_options -l z -l pthread 
    ld: library not found for -lboost_program_options collect2: ld returned 1   exit status make[1]: *** [ezexample] Error 1'

I then added the links to the boost library here by specifying -L/usr/local/lib

Now I get the following error:

    g++ -g -o ezexample temp2.cc -L/usr/local/lib ../vowpalwabbit -l vw -l  allreduce -l boost_program_options -l z -l pthread 
    ld: library not found for -lvw
    collect2: ld returned 1 exit status   
    make: *** [ezexample] Error 1


Solution 1:[1]

I happened to get everything working on OS X 10.7 as follows:

  1. Make sure you have a working Boost installation. As indicated on the Getting started page, usually we only need header files, but some Boost libraries must be built separately, including the program_options library which is used to process options from command line or config file. Go into your boost folder, and then at your shell prompt:

    $ ./bootstrap.sh
    $ ./bjam
    

    This will compile and build everything. You should now have a bin.v2/ directory in your boost directory, with all built libraries for your system (static and threaded libs).

    $ ls bin.v2/libs/
    date_time       iostreams       python          serialization   test
    filesystem      math            random          signals         thread
    graph           program_options regex           system          wave
    

    More importantly, extra Boost libraries are made available in the stage/lib/ directory. For me, these are Mach-O 64-bit dynamically linked shared library x86_64.

    The include path should be your_install_dir/boost_x_xx_x, where boost_x_xx_x is the basename of your working Boost. (I personally have boost_1_46_1 in /usr/local/share/ and I symlinked it to /usr/local/share/boost to avoid having to remember version number.) The library path (for linking) should read your_install_dir/boost_x_xx_x/stage/lib. However, it might be best to symlink or copy (which is what I did) everything in usual place, i.e. /usr/local/include/boost for header files, and /usr/local/lib for libraries.

  2. Edit the Makefile from the vowpal_wabbit directory, and change the include/library paths to reflect your current installation. The Makefile should look like this (first 12 lines):

    COMPILER = g++
    UNAME := $(shell uname)
    
    ifeq ($(UNAME), FreeBSD)
    LIBS = -l boost_program_options -l pthread -l z -l compat
    BOOST_INCLUDE = /usr/local/include
    BOOST_LIBRARY = /usr/local/lib
    else
    LIBS = -l boost_program_options -l pthread -l z
    BOOST_INCLUDE = /usr/local/share/boost            # change path to reflect yours
    BOOST_LIBRARY = /usr/local/share/boost/stage/lib  # idem
    endif
    

    Then, you are ready to compile vowpal_wabbit (make clean in case you already compiled it):

    $ make
    $ ./vw --version
    6.1
    $ make test
    

Solution 2:[2]

You can also install vowpal wabbit on OS X using brew:

brew install vowpal-wabbit

Or you can just install boost, and then install vw from the github repo.

brew install boost

Solution 3:[3]

For installation on CentOS 7 (6.5 perl version is too old for latest vw source code), I've found the instructions at http://wkoplitz.blogspot.be/2012/12/vowpal-wabbit-on-centos.html to work fine:

yum install zlib-devel boost-devel

yum groupinstall "Development Tools"

git clone git://github.com/JohnLangford/vowpal_wabbit.git

cd vowpal_wabbit

./autogen.sh

make

make test

Solution 4:[4]

Good news:

As of the latest release VowpalWabbit version 9.1.0, vw no longer relies on Boost program_options

From the release highlights:

Removal of Boost Program Options dependency

For a long time we have depended on Boost Program Options for command line options parsing. In this release, we have > replaced this dependency with our own implementation of command line parsing. Apart from one place where we depend > on Boost Math in standalone mode, this means that VW core and the command line tool are free of Boost dependencies hopefully making the code a bit easier to build and package.

Vowpal Wabbit 9.1.0 release notes

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 chl
Solution 2 Zach
Solution 3 herman
Solution 4 arielf