Static Build fails on Ubuntu at linking stage

Hi there,

Tried both on Ubuntu 18.04, Zorin OS 12

I was compiling Blender just fine on different machines until recently. But now OpenImageDenoise was added, and I had to run make deps again. This worked well, and afterwards I ran make to compile Blender itself. After compilation phase however, linking to OpenEXR libs produces the following error:

Scanning dependencies of target blender
[100%] Building C object source/creator/CMakeFiles/blender.dir/buildinfo.c.o
[100%] Linking CXX executable ../../bin/blender
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::compress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'compressBound'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::compress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'compress2'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::compress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'compressBound'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::compress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'compress2'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::compress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'compressBound'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::compress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'compress2'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::uncompress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'uncompress'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::uncompress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'uncompress'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::uncompress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'uncompress'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfDwaCompressor.o):ImfDwaCompressor.cpp:function Imf_2_3::DwaCompressor::initializeBuffers(unsigned long&): Fehler: undefined reference to 'compressBound'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfPxr24Compressor.o):ImfPxr24Compressor.cpp:function Imf_2_3::Pxr24Compressor::compress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'compress'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfPxr24Compressor.o):ImfPxr24Compressor.cpp:function Imf_2_3::Pxr24Compressor::uncompress(char const*, int, Imath_2_3::Box<Imath_2_3::Vec2<int> >, char const*&): Fehler: undefined reference to 'uncompress'
/home/renderman/blender-git/lib/linux_x86_64/openexr/lib/libIlmImf.a(ImfZip.o):ImfZip.cpp:function Imf_2_3::Zip::compress(char const*, int, char*): Fehler: undefined reference to 'compress'
collect2: error: ld returned 1 exit status
source/creator/CMakeFiles/blender.dir/build.make:428: recipe for target 'bin/blender' failed
make[3]: *** [bin/blender] Error 1
CMakeFiles/Makefile2:7688: recipe for target 'source/creator/CMakeFiles/blender.dir/all' failed
make[2]: *** [source/creator/CMakeFiles/blender.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make[1]: *** [all] Error 2
GNUmakefile:292: recipe for target 'all' failed
make: *** [all] Error 2

This is consistent on both computers / OSes. It sounds very similar to this already handled bug report, so maybe the issue is linking order again?

Have now reinstalled Zorin OS 15 on one of the machines. make deps completes just fine, but the error persists. No idea what could possibly be wrong here.

I had the same problem recently, and the root cause is that “make deps” is made for the release team, thus supposed to be used with “make full”, not “make”.

You should try “make deps; make full” instead of “make deps; make”. Indeed, it looks like the ordering problem (because it chokes at the same place), but this is a red-herring.

Note that unless you want to use you created blender only in the same distribution, you should instead use a build environment with controlled libraries (especially glib which should be older than each run environment you are targetting).

What I did is that I essentially ran https://developer.blender.org/P1013 in an lxc container created with “lxc-create -t download -n $VM – -d centos -r 7 -a amd64”.

The full script I came up with is https://gitlab.com/snippets/1888862 if you want to check.

1 Like

The devil is in the details, as always. On one of the systems, using ZorinOS 15, I managed to get the build working again. I am not sure if make full is really required. I do recall just using make on the ZorinOS 12 system at all times, and it worked just fine until recently. However, on the ZorinOS 15 system, I had to run install_deps.sh as well as make deps. Afterwards, the compilation would finish.

On the ZorinOS 12 system it was more tricky. After investigation, it turned out that install_deps.sh was producing an error message at a point where it was updating bzip2 I believe. That resulted in an apt error, because I had a specific version of DarkTable on my system, that required a different version of said lib, and prevented the installation. After solving that by uninstalling DarkTable, I still cannot get Blender to build there neither with make or make full, further investigations follow.

According to the discussion I had with the Windows maintainer of the build system, make deps is only made robust enough for the buildbots to work, and is only tested in those environments. That is, for Linux, Centos 7 since not long ago (there was an announcement on the mailing lists and on Blender Today).
Furthermore, the buildbots only do make full so the other codepaths are neither tested nor supported.

I believe you should not mix install_deps.sh and make deps, especially if you end up using make and not make full, since the former is far more easily fooled by the presence of libraries as system ones.

That’s the goal of the centos script, which installs the bare minimum so that make deps works. As long as make deps finished sucessfully, make full should not miss any library. If you have to install_deps.sh still, that’s probably because the make system is searching for a system lib instead of a static one and you’ll have problems if you use that blender on another system.

1 Like

Ah that makes sense, thanks for sharing the insights. As there are currently issues with the buildbot on Linux, that might be linked even. Guess I better wait for Sergey to return then.

Indeed, I didn’t try building Blender for two weeks, so maybe it is currently broken.
Edit: I successfully built latest master in my Debian (but in the Centos LXC, which is a somewhate accurate copy of the official buildbot).