I come across the same build errors when I try to build the bpy module against the default install_deps.sh version of python. I solved this by building python as a dynamic library instead of the default static library. You can use the same configuration options as in install_deps.sh with the addition of `--enable-shared`:
./configure --prefix=/opt/lib/python-3.6-bpy \ --libdir=/opt/lib/python-3.6.2-bpy/lib \ --enable-ipv6 --enable-loadable-sqlite-extensions \ --with-dbmliborder=bdb --with-computed-gotos --with-pymalloc \ --enable-shared I keep the two python builds separate so I can use both bpy and regular source builds at the same time and just point my build script to the proper directory when I build blender. The cmake variable you would change to set a different python directory is: PYTHON_ROOT_DIR=/opt/lib/python-3.6.2-bpy 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 > [email protected] > https://lists.blender.org/mailman/listinfo/bf-python > -- Jeffrey "Italic_" Hoover _______________________________________________ Bf-python mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-python
