I had this problem yesterday when I switched my python library to
Stackless, which I compiled myself. The problem is that python can
be built two ways - with 2-byte wide chars (USC2), or with 4-byte
wide chars (USC4). In my case it was the case that boost was trying
and failing to link to a USC4 build of python, but mine had built
with USC2. It looks like in your case it's trying and failing to
link to USC2.
If you built python yourself, try again, but in the configure
script, pass:
--enable-unicode=ucs2 --enable-shared
--enable-shared isn't related to this problem, but I found that when
embedding python into my C++ program, it would fail to import
several modules because of undefined symbols, even though it would
work fine running scripts as a standalone. It might work for you
without --enable-shared as well.
In my case I had to pass --enable-unicode=usc4 to get it to link, so
we seem to be having opposite problems. So this may or may not fix
it. But it's worth a shot.
On 12/19/2012 10:47 PM, Hesam wrote:
Hello,
I
am trying to compile and link boost-python hello world example
and I have some linking problems.
OS:
Ubuntu
g++ -fPIC -w Test2.cpp -I ../../../Libs/Python/Python-2.7.3/Include -I ../../../Libs/Python/Python-2.7.3 -I ../../../Libs/Boost/boost_1_52_0 -Wl,-rpath,../../../Libs/Python/Python-2.7.3/build/lib.linux-x86_64-2.7 -L -L../../../Libs/Python/Python-2.7.3/build/lib.linux-x86_64-2.7 -lssl -lcrypto -lpthread -lm -lutil -lpython2.7 -Wl,-rpath, -L../../../Libs/Boost/boost_1_52_0/lib -L../../../Libs/Boost/boost_1_52_0/stage/lib -lboost_python
I
get the following Error
../../../Libs/Boost/boost_1_52_0/stage/lib/libboost_python.so: undefined reference to `PyUnicodeUCS2_AsWideChar'
../../../Libs/Boost/boost_1_52_0/stage/lib/libboost_python.so: undefined reference to `PyUnicodeUCS2_FromEncodedObject'
collect2: ld returned 1 exit status
make: *** [Test2] Error 1
I
heard that it maybe due to incompatible version of python and
the python library used by Boost-python. But whatever I tried I
couldn't solve the problem. It is taking several days and no
success. Appreciate any comment.
Thanks
Hesam
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
|
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig