Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 318
madCode Avatar asked Jul 11 '12 16:07

madCode


2 Answers

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
    
like image 152
chl Avatar answered Sep 24 '22 00:09

chl


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
like image 43
Zach Avatar answered Sep 27 '22 00:09

Zach