2

I am trying to compile boost against my custom build of python and getting "undefined reference" errors. Here go details:

1) I build python with support unicode=ucs4 as required by autodesk maya

./configure --prefix=/v/pkgs/python/dep/2.7.14 --enable-unicode=ucs4
make
make install

2) Build boost with this command

b2 -j 4 --layout=versioned --build-type=complete --debug-configuration stage

and config file ./tools/build/src/user-config.jam to use my build of python.

using python
    : 2.7
    : /v/pkgs/python/dep/2.7.14
    ;

This is part of b2 output, to confirm python selection success:

notice: [python-cfg] Configuring python...
notice: [python-cfg]   user-specified version: "2.7"
notice: [python-cfg]   user-specified cmd-or-prefix: "/v/pkgs/python/dep/2.7.14"
notice: [python-cfg] Checking interpreter command "/v/pkgs/python/dep/2.7.14/bin/python2.7"...
notice: [python-cfg] running command '/v/pkgs/python/dep/2.7.14/bin/python2.7 -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1'
notice: [python-cfg] ...requested configuration matched!
notice: [python-cfg] Details of this Python configuration:
notice: [python-cfg]   interpreter command: "/v/pkgs/python/dep/2.7.14/bin/python2.7"
notice: [python-cfg]   include path: "/v/pkgs/python/dep/2.7.14/include/python2.7"
notice: [python-cfg]   library path: "/v/pkgs/python/dep/2.7.14/lib/python2.7/config" "/v/pkgs/python/dep/2.7.14/lib"

3) To verify I try to build following test.cpp

#include <Python.h>
#include <boost/python.hpp>
int main ()
{
    Py_Initialize();
    boost::python::object obj;
    return 0;
}

with this command (new lines for easier reading):

g++ -g -O2 
-I/v/pkgs/python/dep/2.7.14/include/python2.7 
-I/v/pkgs/boost/dep/1_61_0 
-L/v/pkgs/boost/dep/1_61_0/stage/lib 
-lboost_python-gcc48-mt-1_61
-L/v/pkgs/python/dep/2.7.14/lib 
-lpython2.7 
./test.cpp

I am getting following errors:

/v/pkgs/boost/dep/1_61_0/stage/lib/libboost_python-gcc48-mt-1_61.so: undefined reference to `PyUnicodeUCS4_FromEncodedObject'
/v/pkgs/boost/dep/1_61_0/stage/lib/libboost_python-gcc48-mt-1_61.so: undefined reference to `PyUnicodeUCS4_AsWideChar'

Any tips are welcome, thanks !

michal
  • 748
  • 1
  • 7
  • 15

1 Answers1

0

It seems, that the python was not build with UCS-4, it was built with UCS-2. In order to check this, please refer to this answer on the much similar question.

Sergei Danielian
  • 4,938
  • 4
  • 36
  • 58