"src/common.hpp:52:32: fatal error: boost/shared_ptr.hpp: No such file or directory" when building websocket++

16,107

Solution 1

I would suggest making sure the custom place you installed boost is in the include path of the build system.

For the WebSocket++ 0.2.x build system you can set the BOOST_PREFIX (ie /usr/local/) or exact paths to the include and lib dirs if you havent installed them system wide BOOST_LIB_PATH / BOOST_INCLUDE_PATH environment variables to specify custom paths. For 0.3.x there is no library to build, just make sure you use -I/path/to/your/boost and -L/path/to/your/boost/lib/dir or add those paths to your global path. If you use an IDE they usually have ways to add custom include/library paths.

Solution 2

Why build Boost yourself? Just do sudo apt-get install boost-devel and you're done. And it will put the headers in /usr/include/boost so everything will "just work."

Share:
16,107
Admin
Author by

Admin

Updated on June 30, 2022

Comments

  • Admin
    Admin almost 2 years

    I know next to nothing about linux or c++.

    I generally followed these instructions to build boost on ubuntu 12.10 http://piyushparkash.blogspot.com/2012/10/installing-boost-150-in-ubuntu-1210.html. I downloaded 1.53.0.

    I followed the advice of at the end of 1.2.2 and did ./bootstrap.sh --exec-prefix=/usr/local because I wanted all libraries.

    I get this error src/common.hpp:52:32: fatal error: boost/shared_ptr.hpp: No such file or directory when I make outlined here https://github.com/zaphoyd/websocketpp/wiki/Build-Library.

    When I find / -name 'shared_ptr.hpp', it lists

    /root/boost_1_53_0/boost/asio/detail/shared_ptr.hpp /root/boost_1_53_0/boost/interprocess/smart_ptr/shared_ptr.hpp /root/boost_1_53_0/boost/smart_ptr/shared_ptr.hpp /root/boost_1_53_0/boost/serialization/shared_ptr.hpp /root/boost_1_53_0/boost/shared_ptr.hpp

    Shouldn't they have been installed to the default and specified directories as explained in the first link?

    How can I resolve this error?

    (I did this to get "all" libs https://askubuntu.com/questions/259590/libapache2-mod-fastcgi-not-available)

    apt-cache libboost-all-dev

    1.49

    apt-cache search boost | grep dev

    libboost-date-time-dev - set of date-time libraries based on generic programming concepts (default version)
    libboost-date-time1.49-dev - set of date-time libraries based on generic programming concepts
    libboost-dev - Boost C++ Libraries development files (default version)
    libboost-iostreams-dev - Boost.Iostreams Library development files (default version)
    libboost-iostreams1.49-dev - Boost.Iostreams Library development files
    libboost-program-options-dev - program options library for C++ (default version)
    libboost-program-options1.49-dev - program options library for C++
    libboost-python-dev - Boost.Python Library development files (default version)
    libboost-python1.49-dev - Boost.Python Library development files
    libboost-regex-dev - regular expression library for C++ (default version)
    libboost-regex1.49-dev - regular expression library for C++
    libboost-serialization-dev - serialization library for C++ (default version)
    libboost-serialization1.49-dev - serialization library for C++
    libboost-test-dev - components for writing and executing test suites (default version)
    libboost-test1.49-dev - components for writing and executing test suites
    libboost1.49-dev - Boost C++ Libraries development files
    libasio-dev - cross-platform C++ library for network programming
    libboost-all-dev - Boost C++ Libraries development files (ALL) (default version)
    libboost-chrono-dev - C++ representation of time duration, time point, and clocks (default version)
    libboost-chrono1.49-dev - C++ representation of time duration, time point, and clocks
    libboost-chrono1.50-dev - C++ representation of time duration, time point, and clocks
    libboost-date-time1.50-dev - set of date-time libraries based on generic programming concepts
    libboost-exception1.50-dev - set of date-time libraries based on generic programming concepts
    libboost-filesystem-dev - filesystem operations (portable paths, iteration over directories, etc) in C++ (default version)
    libboost-filesystem1.49-dev - filesystem operations (portable paths, iteration over directories, etc) in C++
    libboost-filesystem1.50-dev - filesystem operations (portable paths, iteration over directories, etc) in C++
    libboost-graph-dev - generic graph components and algorithms in C++ (default version)
    libboost-graph-parallel-dev - generic graph components and algorithms in C++ (default version)
    libboost-graph-parallel1.49-dev - generic graph components and algorithms in C++
    libboost-graph-parallel1.50-dev - generic graph components and algorithms in C++
    libboost-graph1.49-dev - generic graph components and algorithms in C++
    libboost-graph1.50-dev - generic graph components and algorithms in C++
    libboost-iostreams1.50-dev - Boost.Iostreams Library development files
    libboost-locale-dev - C++ facilities for localization (default version)
    libboost-locale1.49-dev - C++ facilities for localization
    libboost-locale1.50-dev - C++ facilities for localization
    libboost-math-dev - Boost.Math Library development files (default version)
    libboost-math1.49-dev - Boost.Math Library development files
    libboost-math1.50-dev - Boost.Math Library development files
    libboost-mpi-dev - C++ interface to the Message Passing Interface (MPI) (default version)
    libboost-mpi-python-dev - C++ interface to the Message Passing Interface (MPI), Python Bindings (default version)
    libboost-mpi-python1.49-dev - C++ interface to the Message Passing Interface (MPI), Python Bindings
    libboost-mpi-python1.50-dev - C++ interface to the Message Passing Interface (MPI), Python Bindings
    libboost-mpi1.49-dev - C++ interface to the Message Passing Interface (MPI)
    libboost-mpi1.50-dev - C++ interface to the Message Passing Interface (MPI)
    libboost-program-options1.50-dev - program options library for C++
    libboost-python1.50-dev - Boost.Python Library development files
    libboost-random-dev - Boost Random Number Library (default version)
    libboost-random1.49-dev - Boost Random Number Library
    libboost-random1.50-dev - Boost Random Number Library
    libboost-regex1.50-dev - regular expression library for C++
    libboost-serialization1.50-dev - serialization library for C++
    libboost-signals-dev - managed signals and slots library for C++ (default version)
    libboost-signals1.49-dev - managed signals and slots library for C++
    libboost-signals1.50-dev - managed signals and slots library for C++
    libboost-system-dev - Operating system (e.g. diagnostics support) library (default version)
    libboost-system1.49-dev - Operating system (e.g. diagnostics support) library
    libboost-system1.50-dev - Operating system (e.g. diagnostics support) library
    libboost-test1.50-dev - components for writing and executing test suites
    libboost-thread-dev - portable C++ multi-threading (default version)
    libboost-thread1.49-dev - portable C++ multi-threading
    libboost-thread1.50-dev - portable C++ multi-threading
    libboost-timer-dev - C++ wall clock and CPU process timers (default version)
    libboost-timer1.49-dev - C++ wall clock and CPU process timers
    libboost-timer1.50-dev - C++ wall clock and CPU process timers
    libboost-wave-dev - C99/C++ preprocessor library (default version)
    libboost-wave1.49-dev - C99/C++ preprocessor library
    libboost-wave1.50-dev - C99/C++ preprocessor library
    libboost1.49-all-dev - Boost C++ Libraries development files (ALL)
    libboost1.50-all-dev - Boost C++ Libraries development files (ALL)
    libboost1.50-dev - Boost C++ Libraries development files
    libjson-spirit-dev - C++ JSON Parser/Generator implemented with Boost Spirit
    libmapnik-dev - C++/Python toolkit for developing GIS applications (dummy)
    libmapnik2-2.0 - C++/Python toolkit for developing GIS applications (libraries)
    libmapnik2-dev - C++/Python toolkit for developing GIS applications (devel)
    libpion-common-dev - lightweight HTTP interface library - common development files
    libpion-net-dev - lightweight HTTP interface library - development files
    libroot-tmva-dev - Toolkit for multivariate data analysis - development files
    libtorch3-dev - State of the art machine learning library - development files
    mapnik-doc - C++/Python toolkit for developing GIS applications (doc)
    mapnik-utils - C++/Python toolkit for developing GIS applications (utilities)
    python-mapnik2 - C++/Python toolkit for developing GIS applications (Python)
    
  • Admin
    Admin about 11 years
    Thank-you for looking! Is that the latest version? The creator suggested this method to fully utilize his/her goodies askubuntu.com/a/264700/128334
  • John Zwinck
    John Zwinck about 11 years
    Run apt-cache show boost-devel and you can tell us what version your system offers.
  • John Zwinck
    John Zwinck about 11 years
    Anyway, whatever version it is, try it and see if it works. Ubuntu 12.10 is very recent, so the Boost it offers won't be ancient.
  • John Zwinck
    John Zwinck about 11 years
    Sorry, apparently they call it boost-all-dev or something. It doesn't matter, just do apt-cache search boost | grep dev and find it.
  • John Zwinck
    John Zwinck about 11 years
    Then I'd try installing libboost-all-dev.
  • John Zwinck
    John Zwinck about 11 years
    Doesn't matter. One is a synonym for the other I bet.
  • zaphoyd
    zaphoyd about 11 years
    A reason you would want to use your own compiled copy of boost: libboost-all-dev in Ubuntu 12.10 is version 1.48/49, dated nov 2011/feb 2012. The version scheduled for 13.04 is the same. There have been four major releases since then adding 10 new libraries and numerous c++11 related updates and improvements. It is certainly not ancient, as in many other distributions, but particularly due to the recent release of c++11, a lot has changed in the last 1-2 years and being stuck with 1.49 until 13.10+ is a bit annoying.