[Bf-python] Blender as a Python Module - Ubuntu

Daniel Savo dksavo at gmail.com
Mon Jan 1 00:27:55 CET 2018


*Note*
Apologies if this is not the right mailing list for this. I went through
the archives and found some similar questions, but nothing that could help
me with this issue. Willing to get simple feedback or to pay someone to
just do it for me.

*Problem*
I've been trying to compile Blender as a python module (following these
instructions:
https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Linux/Ubuntu/CMake)
to no avail. I'm able to make an out-of-source build, but once I do the
changes in the "Building" section of those instructions (and running "make"
in the /build directory), the build fails, and I'm unable to find a
solution. I'm running a 64-bit machine with Linux (Ubuntu 16.04.3).  and
this is the relevant info that is outputted:

*[ 98%] Building C object
source/creator/CMakeFiles/blender.dir/buildinfo.c.o*
*[ 98%] Linking CXX shared module ../../bin/bpy.so*
*/usr/bin/ld.gold: error:
/opt/lib/python-3.6/lib/libpython3.6m.a(abstract.o): requires dynamic
R_X86_64_PC32 reloc against 'PyType_IsSubtype' which may overflow at
runtime; recompile with -fPIC*
*/usr/bin/ld.gold: error:
/opt/lib/python-3.6/lib/libpython3.6m.a(boolobject.o): requires dynamic
R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC*
*/usr/bin/ld.gold: error:
/opt/lib/python-3.6/lib/libpython3.6m.a(bytearrayobject.o): requires
dynamic R_X86_64_32 reloc against '_PyByteArray_empty_string' which may
overflow at runtime; recompile with -fPIC*
*.*
*.*
*. (same error for other .o files)*
*.*
*.*
*/usr/bin/ld.gold: error:
/opt/lib/python-3.6/lib/libpython3.6m.a(getcompiler.o): requires dynamic
R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC*
*collect2: error: ld returned 1 exit status*
*source/creator/CMakeFiles/blender.dir/build.make:363: recipe for target
'bin/bpy.so' failed*
*make[2]: *** [bin/bpy.so] Error 1*
*CMakeFiles/Makefile2:7766: recipe for target
'source/creator/CMakeFiles/blender.dir/all' failed*
*make[1]: *** [source/creator/CMakeFiles/blender.dir/all] Error 2*
*Makefile:160: recipe for target 'all' failed*
*make: *** [all] Error 2*

*Attempted Solutions*
I tried adding -fPIC to the /blender/CMakeLists.txt file as discussed here
https://stackoverflow.com/questions/36779834/compiling-blender-bpy-recompile-with-fpic
I tried adding the CMAKE_POSITION_INDEPENDENT_CODE to ON in
/blender/CMakeLists.txt as discussed here
https://stackoverflow.com/questions/38296756/what-is-the-idiomatic-way-in-cmake-to-add-the-fpic-compiler-option
I tried changing everything to static linking as discussed in the "Manual
CMake Setup / Static Linking" section here
https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Linux/Ubuntu/CMake
This caused different issues with the boost library I tried to address, but
ended up giving up on this possible path, thinking there isn't a specific
need to static link all dependencies, and avoid overcomplicating the
situation for myself.

*Final Note*
Given how I failed at all my attempts so far and I've been able to waste 4
days on this, I'd be happy for any insight I can get, or pay someone of the
Blender community to do this so I can get over this issue and continue with
the work I need to do. Just let me know.

Regards,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20171231/64ab13bb/attachment.html>


More information about the Bf-python mailing list