Compiling Blender from branch does not find precompiled libraries

So i was trying to compile blender from a release branch but as soon as a swich from the master/main branch i’m no longer able to compile. And i get following error:

CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindJPEG.cmake:106 (find_package_handle_standard_args)
  build_files/cmake/platform/platform_unix.cmake:87 (find_package)
  build_files/cmake/platform/platform_unix.cmake:101 (find_package_wrapper)
  CMakeLists.txt:1058 (include)

And i’m a little at a loss, following dockerfile reproduces this.

FROM ubuntu:latest

ARG BLENDER_VERSION=3.3
ARG PYTHON_VERSION=3.10.10

RUN apt-get -y update
RUN apt-get -y install wget build-essential zlib1g-dev

# Install Python
WORKDIR /home/tmp/python
RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
RUN tar -xvf Python-$PYTHON_VERSION.tgz
WORKDIR /home/tmp/python/Python-$PYTHON_VERSION
RUN ./configure --enable-optimizations
RUN make
RUN make install
RUN python3 -c "import sys; print(sys.version)"

# Build Blender
RUN apt-get -y install git subversion cmake libx11-dev libxxf86vm-dev libxcursor-dev libxi-dev libxrandr-dev libxinerama-dev libegl-dev zlib1g-dev
# Install blender dependencies
RUN apt-get -y install libwayland-dev wayland-protocols libxkbcommon-dev libdbus-1-dev linux-libc-dev
WORKDIR /home/tmp/blender-git/lib
RUN svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_x86_64_glibc_228

WORKDIR /home/tmp/blender-git/
RUN git clone --branch blender-v$BLENDER_VERSION-release https://git.blender.org/blender.git

WORKDIR /home/tmp/blender-git/blender
RUN make update
RUN make

And like I said if I don’t specify a branch to clone everything works fine.

I suspect maybe the precompiled libs are incorrect, but I could not find any hint as to how I could correct them. Maybe I missed something in the documentation but I could not find anything. Any help would be appreciated. :slight_smile:

I figured it out.
Apparently, I was not reading the docu close enough.

I was trying to build blender 3.3 but the precompiled libs changed between 3.4 and 3.5 and the documentation shows how to build the current master which is ahead of 3.5.

So to summarize I used new libs and tried to compile an older version.
To fix the issue just use blender release 3.5+ or use the centos7 libs.

How did you fix this, I’ve been getting the same error, idk how to help it find the libdir?