Compile blender/mantaflow for share linux builds (need help)

I’m trying to compile the mantaflow build with static libraries so I can share the build.

In Ubuntu trusty 14.04

These are the steps I’m doing

$ sudo apt-get install git build-essential
$ git clone https://git.blender.org/blender.git

$ cd blender/build_files/build_environment/

$ sed -i "s/STATIC\=OFF/STATIC\=ON/g" install_deps.sh 
$ sed -i "s/STATIC_BOOST\=OFF/STATIC_BOOST\=ON/g" install_deps.sh 
$ sed -i "s/STATIC_HDF5\=OFF/STATIC_HDF5\=ON/g" install_deps.sh

$ ./install_deps.sh

$ cd ../../../
$ sudo apt-get install checkinstall
$ wget https://cmake.org/files/v3.11/cmake-3.11.1.tar.gz
$ tar zxvf cmake-3.11.1
$ cd cmake-3.11.1
$ ./configure
$ make
$ sudo checkinstall
$ cd ../

$ cd blender
$ git branch 
$ git checkout fluid-mantaflow
$ git branch 
$ vim CMakeLists.txt and add this:
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "$ORIGIN/lib")


$ cd ../
$ mkdir blenderBuild
$ cd blenderBuild

$ cmake -WITH_STATIC_LIBS=ON -DWITH_CXX11=ON -DGUI=OFF -DOPENMP=ON -DWITH_FFTW3=ON -DWITH_MOD_OCEANSIM=ON -DWITH_ALEMBIC=ON ../blender
$ make
$ make install

the whole process works and ends up compiling mantaflow without problems. The problem is when I try to share the blenderBuild folder with someone else who uses linux, for example when they are told that the libpng library is missing.

Example error:
error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

and when run: ldd blender:
libpng12.so.0 => not found

Any suggestions or help? Thank you.

Unfortunately we don’t have an officially support way to build a static Blender. A few edits to the build script are unlikely to work.

There is a system to build static libraries that we use for our Windows and macOS builds, but it hasn’t been tested on many Linux distributions. Basically you just run:

make deps && make

And if it finishes succesfully you should have static libraries in ../lib/linux_x86_64 and a Blender build using them. It’s likely to need some edits to work on Ubuntu 14.04 though.

That missing library is quite common on some versions of Ubuntu.
I’ve encountered the same problem with DJV View in the past.

You can get the .deb for it from here: https://packages.ubuntu.com/xenial/amd64/libpng12-0/download
It’s an official Ubuntu repo, but as always use it at your own risk.

Installing it does the trick for me though when I get that error.

1 Like