Pybind11 Crashes on Makefile installation

Asked by Sean Boerner

I am installing Pybind11. I have run the following lines:

git clone https://github.com/pybind/pybind11.git
cd pybind11/
mkdir build
cd build/
cmake ..
make install

The installation terminates with:

:
:
[ 78%] Building CXX object tests/CMakeFiles/pybind11_tests.dir/test_pickling.cpp.o
[ 80%] Building CXX object tests/CMakeFiles/pybind11_tests.dir/test_pytypes.cpp.o
[ 82%] Building CXX object tests/CMakeFiles/pybind11_tests.dir/test_sequences_and_iterators.cpp.o
[ 85%] Building CXX object tests/CMakeFiles/pybind11_tests.dir/test_smart_ptr.cpp.o
[ 87%] Building CXX object tests/CMakeFiles/pybind11_tests.dir/test_stl.cpp.o
In file included from /home/stboerne/Programming/ThirdParty/pybind11/tests/test_stl.cpp:24:
/home/stboerne/Programming/ThirdParty/boost/boost/optional.hpp:15:10: fatal error: boost/optional/optional.hpp: No such file or directory
   15 | #include "boost/optional/optional.hpp"
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [tests/CMakeFiles/pybind11_tests.dir/build.make:505: tests/CMakeFiles/pybind11_tests.dir/test_stl.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:430: tests/CMakeFiles/pybind11_tests.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

It appears that the compilation of the test_stl.cpp file requires an include directory of ./boost/libs/optional/include/, which it doesn't have.

How do I resolve this so that the installation completes without a problem?

TIA

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu pybind11 Edit question
Assignee:
No assignee Edit question
Solved by:
Sean Boerner
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

1. Ubuntu provides a pre-compiled version of pybind11 in its repositories.
sudo apt install python3-pybind11
and if needed
sudo apt install pybind11-doc

2. If you try to install a foreign version of software, then this is outside ubuntu support.

Based on the error message that you receive, I assume that you are missing a software package that is required for building that foreign pybind11 package. In your case probably it's libboost(version)-dev, e.g. for jammy libboost1.74-dev, for focal libboost1.71-dev

Revision history for this message
Sean Boerner (sean-boerner) said :
#2

I had tried:

sudo apt-get install python-pybind11

and got the following:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pybind11

I used your suggestion:

sudo apt install python3-pybind11

and that worked.

Thank you