Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Fails at main.cpp #5

Closed
LeahBriscoe opened this issue Nov 29, 2015 · 5 comments
Closed

Compilation Fails at main.cpp #5

LeahBriscoe opened this issue Nov 29, 2015 · 5 comments

Comments

@LeahBriscoe
Copy link

I have tried copying the needed boost .hpp's in several locations, but no success.

make
g++ -c -Wall -O3 -funroll-loops -DNDEBUG main.cpp
main.cpp:21:10: fatal error: 'boost/program_options.hpp' file not found
#include <boost/program_options.hpp>
         ^
1 error generated.
make: *** [main.o] Error 1

The compiler does find "boost/program_options.hpp" by using quotes instead of angle brackets, however.

make
g++ -c -Wall -O3 -funroll-loops -DNDEBUG main.cpp
main.cpp:21:10: error: 'boost/program_options.hpp' file not found with <angled>
      include; use "quotes" instead
#include <boost/program_options.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         "boost/program_options.hpp"
In file included from main.cpp:21:
./boost/program_options.hpp:15:10: fatal error: 
      'boost/program_options/options_description.hpp' file not found
#include <boost/program_options/options_description.hpp>
         ^
2 errors generated.
make: *** [main.o] Error 1
@GuyAllard
Copy link
Owner

The error you are seeing occurs when the boost development libraries cannot be found by the compiler. This is typically because they are either not installed on your system, or are not installed correctly.

What linux distro and version are you using?

@LeahBriscoe
Copy link
Author

I had downloaded boost1.59.0 from the Boost C++ website and am using MacOSX10.11.1. It is definitely a problem with where I downloaded the boost library. I used brew install, which placed boost in usr/local/Cellar but I also tried downloading boost into usr/local/include. The g++ is located in the usr/bin but I am not permitted to directly download boost into that directory. How can I link the boost library from my current directory to g++?

@GuyAllard
Copy link
Owner

From the README, SPINGO requires "A modern Linux operating system".
It may be possible to compile and run it on other operating systems such as OSX, but the program is untested on those platforms.

The easiest way to get SPINGO up and running on OSX would be via a virtual machine running debian.

A couple of things you could try in order to compile natively on OSX:

  • Use brew to install boost to the default location (/usr/local/Cellar). This should give you /usr/local/Cellar/boost/1.59.0/lib and /usr/local/Cellar/boost/1.59.0/include
  • The compiler needs to know where to find the boost headers, so edit the spingo makefile (SPINGODIR/source/makefile) and change line 22 to:
    CPPFLAGS = -I/usr/local/Cellar/boost/1.59.0/include -c -Wall
  • The linker needs to know where to find the libraries to link against, so change line 23 of the makefile to:
    LFLAGS = -L/usr/local/Cellar/boost/1.59.0/lib -pthread -lboost_program_options -lboost_thread -lboost_serialization

@LeahBriscoe
Copy link
Author

Thank you Guy for your help. I will try those suggestions above.

@LeahBriscoe
Copy link
Author

I followed all the steps and it seem to be compiling, but I got an error at the very end. I definitely have the lboost_thread library, but still no success.

clang: warning: argument unused during compilation: '-pthread'
ld: library not found for -lboost_thread
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spingo] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants