Rocky Linux 8¶
Note
These instructions explain how to set up the build environment we use for our official builds. You can use other Linux distributions to build both Blender and its Libraries. If you want to set up Rocky Linux on your existing Linux Distribution without any virtualization, you can go to the Setting Up the Chroot Environment section.
The official Linux builds are done on Rocky Linux 8. This makes it possible to have a portable build which will work on VFX reference platform compatible systems.
Here we describe how the official setup is created. The setup allows us to compile Blender itself, as well as the Blender dependencies.
Preparing the System¶
When provisioning a new system the following details may help:
Disk Usage
At the time of writing (Blender 4.2) disk usage is as follows:
- ~2.5 GB: Rocky8 installation.
- ~34 GB: Packages installed by
linux_rocky8_setup.sh
. - ~42 GB: Blender's GIT repository & result of running
make deps
. - Some extra space for GIT LFS & building Blender is needed too.
Leaving some extra room to build Blender & run tests, a 100 GB volume is sufficient.
System Memory
The amount of memory needed to build packages depends on the number of simultaneous jobs, it is recommended no less than 16 GB of memory is used.
For building with 32 jobs requires about 64 GB of memory, although there are rough numbers to get an idea of what you may need.
CPU Cores
On Linux make deps
builds dependencies one at a time with each build using all available cores.
In general the more cores available, the faster the build will complete.
Installing Rocky 8¶
If you already know how you want to install Rocky 8, you can head over to the download page and get your preferred install medium: https://rockylinux.org/download
You can then skip the following Setting Up the Chroot Environment section.
However, if you already are on Linux and don't want to have to install Rocky and boot into it. (Or set it up instead of a virtual machine) Setting up a chroot environment might be a nice solution as you can then easily access the files from within your current Linux environment.
If you want to set up a chroot environment for Rocky 8, follow the next section.
Setting Up the Chroot Environment¶
First make sure that you have guestfs-tools installed. Then download the
qcow2 image from the Rocky 8 download site. After this create a
folder where your Rocky 8 install will live. We will refer to the folder as /root/chroot_rocky8
from
now on.
The folder can be put anywhere, but here we put it in the home folder of the root user as you
usually need to be root to use the chroot
and mount
commands. So it felt fitting to put it in
the root home folder.
Next we mount the qcow2 image and extract its contents into our /root/chroot_rocky8
folder:
mkdir /mnt/rocky_mnt
guestmount -a Rocky-8-GenericCloud-Base.latest.x86_64.qcow2 -i --ro /mnt/rocky8_mnt/
rsync -auv /mnt/rocky8_mnt/ /root/chroot_rocky8
Next we use the following script to chroot into our chroot environment:
#!/bin/bash
# Stop execution if any command fails
set -e
cd /root/chroot_rocky8
echo "Mounting chroot directories"
mount -o rbind /dev dev > /dev/null &
mount -t proc none proc > /dev/null &
mount -o bind /sys sys > /dev/null &
mount -o bind /tmp tmp > /dev/null &
# Fix term into issues
mount --bind -o ro /usr/share/terminfo usr/share/terminfo
# Make network work
cp /etc/resolv.conf etc
chroot . /bin/bash -l
rocky8.sh
and set it as executable with chmod +x
rocky8.sh
. If you now run ./rocky8.sh
, you should now be in your Rocky8 chroot environment!
As we don't need the kernel or qemu-guest packages inside the chroot, we can remove them:
yum remove kernel qemu-guest-agent
Setting Up the Rocky 8 Environment¶
Before we do anything else, it is usually a good idea to make sure that your Rocky 8 install is
up-to-date. Run yum update
and install any updates if there are any available.
Once you are inside the Rocky 8 Environment, we need to install and setup Git LFS before we can clone the Blender repository:
We will use the linux_rocky8_setup.sh script to care of installing all dependencies need dependencies to build Blender on Rocky 8.
Note
Some system-wide changes are performed, so it is recommended to use a dedicated virtual machine for the release build environment.
Once you have Git LFS installed we are ready to clone the Blender git repository and install all dependencies needed on Rocky8:
mkdir ~/blender-git/
cd ~/blender-git/
git clone https://projects.blender.org/blender/blender.git
chmod +x build_files/build_environment/linux/linux_rocky8_setup.sh
Congratulations, the base system is now ready!
Follow the Building Cycles with GPU Binaries for the instructions related to installing the GPU compute tool-kits.
Building Blender and the Blender Libraries¶
Blender is built from sources using the pre-compiled Rocky 8 libraries. Follow the Download Sources and Download Libraries sections from the Linux Quick Setup. Note that all packages have already been installed, so that step from the Quick Setup should be skipped. Also make sure to get pre-compiled libraries for Rocky 8.
The build is to be performed using gcc-11 tool-chain. It is activated
using the scl
command:
If you want to avoid having to run scl enable gcc-toolset-11 bash
each time you go into the Rocky
8 environment, you can create /etc/profile.d/enablegcc11.sh
and put the following inside of it:
Building the Libraries from Scratch¶
To work around some quirks with some libraries run the following:
# Fix cuda build error for oidn (Update this in the linux_rocky8_setup.sh comments
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
# Fix flac extract error
export LANG=en_US.UTF-8
If you don't want to run these every time, you can put the commands above into the ~/.bashrc
file.
Finally, to build the libraries, you simply run make deps
in the ~/blender-git/blender
folder.
This make take a few hours... After it has finished the libraries will be in the lib/linux_x64
folder.