Yesterday I tried to fix an issue which I think i noted before on my Linux environment in which, Python Boost and LuxRender would compile seemingly fine, however when i try to use pylux in blender 2.5 I am left with an error in the console.
The Error was this
ImportError was: /usr/local/lib/libboost_python.so.1.43.0: undefined symbol: PyUnicodeUCS2_AsUTF8String)
I was helped alot by a member in the luxrender IRC channel, (THANKS ONCE AGAIN! Orbisvicis) and would like to share what we think was the problem and the fix. For my records and for anyone who is unlucky enough to see the same error. I say unlucky because from experience, getting and compiling boost and having it link with everything, can be extremely painful. I lost count of the number of times i compiled python boost and luxrender yesterday.
OK so it appears to be a unicode problem, the exact cause could be a number of things
- unicode support was not included with the python I compiled.
- pylux is linked against an incorrect version of python.
- the python implemented/packaged with blender is causing the issue.
The easist one of these to check is the linking in pylux.so use ldd pylux.so to check the library dependancies. Look for things that look odd or out of place. NOW this is were I had my problem. Despite Boost being built against the correct version of Python, when make finally linked pylux.so, it fell back to my systems pre-installed Python2.6… so it was getting confused by this.
HOWEVER for completeness I will detail the final full solution of building python correct for the job and luxrender.
Python was then built with the following command.
./configure –prefix=/usr –enable-shared –with-threads –with-computed-gotos –enable-ipv6 –with-valgrind –with-wide-unicode –with-system-expat –with-system-ffi; make
I changed –prefix to my desired build location. and did a make install after the above command. NB you might get an error during the compile, however, these shouldnt be anything you need (for LuxBlend or LuxRender) if you need to fix them, unfortunately that will be up to you, sorry.
I also got a later version of boost, 1.46, however the build process is IDENTICAL to that talked about previously however, be sure to check you used the correct include directories, as the normal
directory will have a ‘u’ on the end (signifying unicode?)
Boost should (at least it did on mine) compile perfectly fine.
The next part is LuxRender. The part here is cmake will often default to system directories in case of issues, and unfortunately this causes alot of issues. Cmake in luxrender was reorganised recently, and is likely still undergoing some change. there is a directory, cmake in the head directory of lux which contains a few useful files in which you can change cmake include directories and search paths.
in my case because python was likely my issue when i did the cmake i used the following commands
-DPYTHON_INCLUDE_DIR=<link to include dir>
-DPYTHON_LIBRARY=<link to actual lib file>
A full list of all options can be found in the CMakeCache.txt file which cmake generates… there are MANY MANY MANY and with the new cmake rewrite, if you have problems you can write your own custom config file and load it. Once you have picked out the ones you need you can use them by
cmake -DPYTHON_LIBRARY=<link to actual lib file> .
I was able to use blender with pylux.so and all was right with the world. 😀
Once again thanks to the help i was given in IRC, and I hope these notes can come in handy to anyone suffering similar issues. Even if the error isnt exactly the same as shown here, the cmake notes at the end can fix so many issues. Also for library problems ldd is your friend.