Opened 8 years ago

Last modified 5 years ago

#11120 new Bugs

Problem compile with python 3 support.

Reported by: tele Owned by:
Milestone: To Be Determined Component: Building Boost
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

./bootstrap.sh --with-python=/usr/bin/python3 --with-python-root=/usr
./b2 
...
gcc.compile.c++ bin.v2/libs/python/build/gcc-4.9.2/release/threading-multi/object/function_doc_signature.o
In file included from ./boost/python/detail/prefix.hpp:13:0,
                 from ./boost/python/converter/registrations.hpp:8,
                 from libs/python/src/object/function_doc_signature.cpp:9:
./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
 # include <pyconfig.h>
                       ^
compilation terminated.

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthread -fPIC  -DBOOST_ALL_NO_LIB=1 -DBOOST_PYTHON_SOURCE -DNDEBUG  -I"." -I"/usr/include/python3.4" -c -o "bin.v2/libs/python/build/gcc-4.9.2/release/threading-multi/object/function_doc_signature.o" "libs/python/src/object/function_doc_signature.cpp"

...failed gcc.compile.c++ bin.v2/libs/python/build/gcc-4.9.2/release/threading-multi/object/function_doc_signature.o...
...skipped <pbin.v2/libs/python/build/gcc-4.9.2/release/threading-multi>libboost_python.so.1.57.0 for lack of <pbin.v2/libs/python/build/gcc-4.9.2/release/threading-multi>numeric.o...
...skipped <pstage/lib>libboost_python.so.1.57.0 for lack of <pbin.v2/libs/python/build/gcc-4.9.2/release/threading-multi>libboost_python.so.1.57.0...
...skipped <pstage/lib>libboost_python.so for lack of <pstage/lib>libboost_python.so.1.57.0...
...skipped <pbin.v2/libs/python/build/gcc-4.9.2/release/threading-multi>libboost_python3.so.1.57.0 for lack of <pbin.v2/libs/python/build/gcc-4.9.2/release/threading-multi>numeric.o...
...skipped <pstage/lib>libboost_python3.so.1.57.0 for lack of <pbin.v2/libs/python/build/gcc-4.9.2/release/threading-multi>libboost_python3.so.1.57.0...
...skipped <pstage/lib>libboost_python3.so for lack of <pstage/lib>libboost_python3.so.1.57.0...
...
...failed updating 56 targets...
...skipped 12 targets...
...updated 1062 targets...


System: PCLinuxOS 32bit Mate

gcc: 4.92

pkgconfig: 0.28

python2: 2.7.6

python3: 3.4.2

I want add log from compile, but I don't know how.

How I can find pyconfig.h ?

Attachments (5)

boost.log (176.6 KB ) - added by tele 8 years ago.
boost.debug.conf.log (6.7 KB ) - added by tele 8 years ago.
boost.proj.conf.jam.log (52.9 KB ) - added by tele 8 years ago.
project-config.jam (911 bytes ) - added by tele 8 years ago.
python_jam.patch (1.6 KB ) - added by j.r.versteegh@… 7 years ago.
Modification of python.jam to use abiflags

Download all attachments as: .zip

Change History (38)

by tele, 8 years ago

Attachment: boost.log added

comment:1 by tele, 8 years ago

# find /usr -name pyconfig.h /usr/include/python3.4m/pyconfig.h /usr/include/multiarch-i386-linux/python3.4m/pyconfig.h /usr/include/multiarch-i386-linux/python2.7/pyconfig.h /usr/include/python2.7/pyconfig.h

comment:1 by tele, 8 years ago

# find /usr -name pyconfig.h
/usr/include/python3.4m/pyconfig.h
/usr/include/multiarch-i386-linux/python3.4m/pyconfig.h
/usr/include/multiarch-i386-linux/python2.7/pyconfig.h
/usr/include/python2.7/pyconfig.h

comment:2 by tele, 8 years ago

Interesting is g++ option from log

-I"/usr/include/python3.4"

and my path

/usr/include/python3.4m/

comment:3 by Jürgen Hunold, 8 years ago

Most probably Boost.Build fails to parse the include path reported by your python binary. Can you please run "b2 --debug-configuration" and attach the log?

by tele, 8 years ago

Attachment: boost.debug.conf.log added

comment:4 by anonymous, 8 years ago

When I copy files from /usr/include/python3.4m/ to /usr/include/python3.4/

...updated 68 targets...


The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /home/gg/Downloads/DOWNLOAD/test/boost_1_57_0

The following directory should be added to linker library paths:

    /home/gg/Downloads/DOWNLOAD/test/boost_1_57_0/stage/lib

I added also "b2 --debug-configuration" now above :)

comment:5 by tele, 8 years ago

I will try ask on PCLinuxOS forum. I would like add symlinks files from .../python3.4m/ to .../python3.4/ but I don't know if this is good way.

comment:6 by Jürgen Hunold, 8 years ago

The error might also be in bootstrap.sh. Can you add "project-config.jam" too?

by tele, 8 years ago

Attachment: boost.proj.conf.jam.log added

by tele, 8 years ago

Attachment: project-config.jam added

comment:8 by tele, 8 years ago

I checked path /usr/include/python3.4m/

  • Mageia , Fedora , OpenSuse have similar path for pyconfig.h in python3

I tried compile on OpenSuse , I have the same problem with this path.

comment:9 by Steven Watanabe, 8 years ago

The offending code in python.jam is

        includes ?= $(prefix)/include/python$(version) ;

A better workaround is to edit project-config.jam to pass the correct include path explicitly.

using python : 3.4 : /usr : /usr/include/python3.4m ;

comment:10 by tele, 8 years ago

Thanks :)
So I will try edit /boost_1_57_0/tools/build/src/tools/python.jam to add "m"

 includes ?= $(prefix)/include/python$(version)m ;

comment:11 by Steven Watanabe, 8 years ago

A general fix would be more like:

[ path.glob $(prefix)/include : python$(version)* ]

comment:12 by tele, 8 years ago

I don't know python however:

        if  not($(prefix)/include/python$(version)m)
        {   
           debug-message "Used include path: $(prefix)/include/python$(version)m" ;
           includes ?= $(prefix)/include/python$(version)m ;
        }
        else
        {
           debug-message "Used include path: $(prefix)/include/python$(version)" ;
           includes ?= $(prefix)/include/python$(version) ;
        }

        local lib = $(exec-prefix)/lib ;
        libraries ?= $(lib)/python$(version)/config $(lib) ;

I tried add before " path.glob $(prefix)/include : python$(version)* " but python libs missed ( libboost_python ) and I con not find error.

Anyone will update python support ?
I ask because I see ./bootstrap.sh can add only 1 python version to project-config.jam

comment:13 by tele, 8 years ago

You tried add something with if ?

if [ path.glob $(prefix)/include : python$(version)* ]
...

comment:14 by tele, 8 years ago

blee , above what I paste working wrong , if any can fix I will happy.

comment:15 by viboes, 8 years ago

Component: NoneBuilding Boost

comment:16 by anonymous, 8 years ago

I tried also something

        for local file_name in  glob.glob("{prefix}/include/python{version}*/Python.h".format(version=$(version), prefix=$(prefix)))
#  file_name = /usr/include/python3.4m/Python.h

        includes ?= $(file_name)[:-9] ;
#       includes ?= /usr/include/python3.4m ;
          {
          debug-message "Python$(version) path: $(file_name) ;
          }

And also this is wrong and I don't know what is wrong inside this. This is python jam , yes ? Exist IDE for python jam ? How can create fast script and test in python jam ?

comment:17 by marcus.hanwell@…, 7 years ago

This still appears to be an issue in Boost 1.59.0, I found this report when searching for my problem. I guess not all installs symlink the directory without the m. It would be great to resolve as it can take quite a while to get here.

comment:18 by anonymous, 7 years ago

Reporting that this bug is still present. On OSX with python3 installed via brew.

Bootstrap with

./bootstrap.sh --with-python=python3

Here's how to fix this manually for now:

In the file tools/build/v2/tools/python.jam, line 542, change

includes ?= $(prefix)/include/python$(version) ;

to

includes ?= $(prefix)/include/python$(version)m ;

(as proposed by steven_watanabe)

Hoping that a real fix will come for version 1.60.

comment:19 by j.r.versteegh@…, 7 years ago

Still present in 1.60.

python-config should be used to determine the python include path.

by j.r.versteegh@…, 7 years ago

Attachment: python_jam.patch added

Modification of python.jam to use abiflags

comment:20 by j.r.versteegh@…, 7 years ago

python.jam appears to get values from "import sys", so the above patch attempts to get the abiflags from there as well. Tested with python2.7 and python3.4 on linux mint amd64.

comment:21 by anonymous, 5 years ago

Same error exists on OSX due to the difference in folder names. When installing Python3 with brew (brew install python3) Python is installed in this folder: /usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6

Boost configuration detects the folder correctly but sets the include path as: /usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/include/python3.6

While brew installation places include files in: /usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/include/python3.6m

This can be solved by soft linking folder include/python3.6 to include/python3.6m but it's not obvious, and boost library build does not work out of the box.

comment:22 by anonymous, 5 years ago

Are there any plans to fix this bug?

comment:23 by liam.gretton@…, 5 years ago

I just hit this bug in 1.64.0 too, here's another vote for a fix please.

comment:24 by anonymous, 5 years ago

Please fix this already.

comment:25 by ofloveandhate, 5 years ago

october 2017, and i'm beyond eager to have a fix.

comment:26 by ofloveandhate, 5 years ago

maybe this will be fixed after boost moves to cmake for its build system?

comment:27 by Microsamp, 5 years ago

I am waiting for a fix too. Python2.7 on Mint amd64 with 1_16_0/1_65_1(both tested today)

comment:28 by anonymous, 5 years ago

Please fix this

comment:29 by orangesherbet0@…, 5 years ago

pyconfig.h still not found in boost 1.66, building boost on Linux Mint (roughly equal to Ubuntu 16.04).

comment:30 by anonymous, 5 years ago

Facing the same problem Centos 7 boost 1.65

comment:31 by anonymous, 5 years ago

can i do anything here? if i make it use python-config, is there a chance you will merge? this really makes it hard to automate this...

comment:32 by anonymous, 5 years ago

apt-get install python-dev

Note: See TracTickets for help on using tickets.