0

I tried to compile Blender BPY in Ubuntu 14.04.4 using :

mkdir ~/blender-git
cd ~/blender-git
git clone http://git.blender.org/blender.git
cd blender
git submodule update --init --recursive
git submodule foreach git checkout master
git submodule foreach git pull --rebase origin master

sudo apt-get update; sudo apt-get install git build-essential

cd ~/blender-git
./blender/build_files/build_environment/install_deps.sh

sudo apt-get install cmake cmake-curses-gui

mkdir ~/blender-git/build
cd ~/blender-git/build

cmake ../blender \
    -DWITH_PYTHON_INSTALL=OFF \
    -DWITH_PLAYER=OFF \
    -DWITH_PYTHON_MODULE=ON

cd ~/blender-git/build
make

It compiles but it ends with an error :

[100%] Building C object source/creator/CMakeFiles/blender.dir/buildinfo.c.o
Linking CXX shared module ../../bin/bpy.so
/usr/bin/ld.gold: error: /opt/lib/python-3.5/lib/libpython3.5m.a(abstract.o): requires dynamic R_X86_64_PC32 reloc against 'PyType_IsSubtype' which may overflow at runtime; recompile with -fPIC

I have the same error during pages...

Any idea ?

Is it possible to download a compiled library of blender BPY somewhere ?

Thanks !

Amir
  • 10,600
  • 9
  • 48
  • 75
hotips
  • 2,575
  • 7
  • 42
  • 59

1 Answers1

1

Well, it tries to link a static library into a dynamic one, and that static library (/opt/lib/python-3.5/lib/libpython3.5m.a) isn't suitable for that (compiled w/o -fPIC what makes it impossible to use it in a shared library). recompile that library with the flag (or simply supply one properly compiled) and re-try with Blender BPY.

I've just checked, Ubuntu-14.04 didn't have python-3.5 in the official repos, but there's a bunch of dedicated PPAs. But since it's the end of April of 16, it'd better to switch your apt sources.list to Xenial and update the system to the next LTS, if you feel brave, or just python if you don't :)

user3159253
  • 16,836
  • 3
  • 30
  • 56
  • Yummy yummy ;-) I tried already to compile on OSX without success, I can reinstall my VM. LOL. Thanks for your help. – hotips Apr 21 '16 at 20:59
  • actually, the source of your problem - is an incorrectly compiled custom python. Take that problem out of the road - and the goal is achieved. BTW the problem belongs to http://superuser.com or alike – user3159253 Apr 21 '16 at 23:39
  • Recompile the python3.5 by adding -fPIC somewhere in the makefile for Python and it worekd for me. – foothill Jan 16 '17 at 05:18
  • @user3159253 I am not able to fully understand how the issue should be resolved. Could you please elaborate more on this? I've been trying to compile Blender for a day without success. Where/how can I set the `-fPIC` flag? – Amir Feb 11 '18 at 01:20
  • First of all, check the OS you currently use. A relatively modern Ubuntu (17.04 in my case) already has python-3.5 and its library is compiled properly, no need to recompile it. Check the following QA: https://stackoverflow.com/a/1794136/3159253 you need to check your python-3.5 library, e.g. with a command like this: `readelf -a /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0 | grep TEXT` – user3159253 Feb 11 '18 at 16:48