I have been trying to build blender as python module for a while now on various OS’s and unfortunately i have been unsuccessful.
I am receiving this error on Ubantu:
Linking CXX shared module …/…/bin/bpy.so
/usr/bin/ld: /opt/lib/python-3.3/lib/libpython3.3m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct’ can not be used when making a shared object; recompile with -fPIC
/opt/lib/python-3.3/lib/libpython3.3m.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[3]: *** [bin/bpy.so] Error 1
make[2]: *** [source/creator/CMakeFiles/blender.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2
Any help is appreciated because I am losing hope. Please let me know if we have to repost this question on another thread?
I found a solution, in my case, I download and install Python 3.3 as described here.
Prior make I did ./configure --enable-shared --prefix=/opt/python3.3
Once python is successfully installed, configure cmake to find in the location where you installed python3.3 with --enable-shared argument.
I was able to compile python module this way.
All the best.