[SOLVED] Error when importing bpy after compiling it in ArchLinux

Hello,
I am getting this error: ImportError: /usr/lib/python3.8/site-packages/bpy.so: undefined symbol: BKE_main_idmap_lookup_id
when importing compiled bpy from master branch.
I also tried with Python 3.7.4 but it didn’t help.
I am compiling bpy in Docker using this Dockerfile:

FROM archlinux:latest

RUN pacman -Sy archlinux-keyring --noconfirm 
RUN yes | pacman -Syu
ADD blender/ /blender/ 
RUN pacman -Sy git sudo gcc cmake make wget opencv libtheora libvorbis libogg x264 openjpeg2 openshadinglanguage openimageio clang llvm --noconfirm
RUN cd /blender && build_files/build_environment/install_deps.sh --skip-osl --skip-python --skip-oiio --skip-llvm --ver-python=3.8.0 --no-confirm
RUN cd blender && BUILD_DIR=/blender/build make bpy -j8 BUILD_CMAKE_ARGS="-U *SNDFILE* -U *PYTHON* -U *BOOST* -U *Boost* -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES* -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -D WITH_CODEC_SNDFILE=ON -D PYTHON_VERSION=3.8 -D WITH_OPENCOLORIO=ON -D WITH_CYCLES_OSL=OFF -D WITH_LLVM=OFF -D WITH_OPENSUBDIV=ON -D WITH_OPENVDB=ON -D WITH_OPENVDB_BLOSC=ON -D WITH_ALEMBIC=ON -D WITH_CODEC_FFMPEG=ON -D WITH_MOD_OCEANSIM=OFF -D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;' -D WITH_PYTHON_INSTALL=OFF -D WITH_AUDASPACE=OFF -D WITH_PYTHON_MODULE=ON -D WITH_INSTALL_PORTABLE=OFF"
#RUN cd blender/build_bpy && make install

RUN pacman -U https://archive.archlinux.org/packages/j/jemalloc/jemalloc-4.5.0-1-x86_64.pkg.tar.xz --noconfirm

`
Am I doing anything wrong?

I was getting the same error on Ubuntu Server. Then I changed the build script to clone the main Blender git at tag “v2.80” and it went away.

I think it might be something to do with the master branch but I’m not sure.

v2.80 isn’t so long ago.
You could bisect to find the cause.

Well v2.80 is crashing for me at 81% - it probably has something to do with Boost…I think it needs older version, but that’s not to easy to achieve in Arch.
v2.81/v2.81a crashes for me while installing language package - it doesn’t get compiled.
I would like to check the different, but I am not C++ aware…

You can disable boost & translations, in general if you’re running into problems building, try disable all options, you can do this by running: make bpy lite

It’s better to first get the basics working before tackling issues in 3rd party libraries.

Fixed the linking issue with BKE_main_idmap_lookup_id
http://developer.blender.org/rBdaf290dcc80ce5b0904cb92c1696184e8c319ff9

@matous If you are still having any issues building maybe you could try my build script and see if it works for you?

Then I’d at least know the build process is somewhat the same on Arch… (?)

Thank you both for help!
It is working now except something changed in bpy API so I have to refactor my script.
@TylerGubala
Well at start I tried your bpy building but it had several issues on Arch so it’s much easier for me to install it manually. For example I need to use python3.8 and disable several libraries that are being built by install_deps.

@TylerGubala
I found your repo on github:https://github.com/TylerGubala/bpy-build
I can help you with testing/script for archlinux if you want.

1 Like