Closed
Description
I am able to build and run boost with python 2 on ubuntu 18.04. I am not able to build and run boost with python 3.
My steps are as follows;
- Download boost
I tried both boost 1.71 and 1.67 both in the end fail. Example here is given for 1.71.
cd /home/user/
wget https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2
tar --bzip2 -xf boost_1_71_0.tar.bz2
- Build boost against python 3
The prefix folder is where the python library gets written
cd /home/user/boost_1_71_0
./bootstrap.sh -with-libraries=python -with-python-version=3.6 --prefix=/home/user/temp/
./b2 &./b2 install
- Download this library
cd /home/user/
git clone https://github.com/TNG/boost-python-examples
- Create a virtual environment so python points to python 3
cd boost-python-examples
python3 -m venv environment
source /environment/bin/activate
- Run cmake with flags
I read this stack over flow post
As a result I run the following commands;
set -x
rm -rf build
mkdir build
cd build
cmake -DPYTHON_VERSION_SUFFIX=-py3 -DCMAKE_BUILD_TYPE=DEBUG -DBOOST_ROOT=/home/user/temp/ -DBoost_NO_SYSTEM_PATHS=TRUE ..
Result -- Could NOT find Boost
Also tried -DBOOST_ROOT=/home/user/temp/boost_1_71_0
and several other options to no avail.
I have also tried to modify the cmakecache.txt from the python 2 configuration into variables suited for python 3.
This eventually leads to the error;
relocation R_X86_64_PC32 against symbol `PyLong_Type' can not be used when making a shared object; recompile with -fPIC
I also obtain this error when i tried to run examples using bjam.
Metadata
Metadata
Assignees
Labels
No labels