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

Jeffrey italic.rendezvous at gmail.com
Mon Jan 1 22:32:42 CET 2018


Also please make sure you point the python config build options to the
right path. I missed changing --prefix in my snippet. I also had to
disable ffmpeg and opencollada features, but I don't specifically need
those features. You may need to recompile those as dynamic libraries as
well if you need them.

In essence, the error you're reporting is saying the library you're
linking against needs to be recompiled with -fPIC, not blender.

On 12/31/2017 03:27 PM, Daniel Savo wrote:
> *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
> 
> 
> 
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> https://lists.blender.org/mailman/listinfo/bf-python
> 

-- 
Jeffrey "Italic_" Hoover


More information about the Bf-python mailing list