I got it to build. Now I have to dig through my notes and find all the changes I made.
Briefly, there are three packages that have moved on through rolling releases and broken compatibility: FFMpeg (4.4 -> 5.0), Python (3.9 -> 3.10) and OpenImageIO (still works but needs a couple of tweaks.)
FFmpeg has deprecated a number of functions for a long time, and in release 5.0 finally removed them, which caused projects to break all across the web. ffmpeg4.4 is in the repos (at least in Manjaro, which is what I'm on) and until there's a compatibility patch we need to get blender2.7 to use ffmpeg4.4 instead. For now, I used,
-DCMAKE_CXX_FLAGS="-I /usr/include/ffmpeg4.4/ -L /usr/lib/ffmpeg4.4/" \
in the cmake command line in the PKGBUILD, and
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include/ffmpeg4.4)
in src/blender/build_files/cmake/platform/platform_unix.cmake (search for "# lame" to find where to put it.)
Simply patching all the #include lines in the blender source isn't good enough because the ffmpeg header files also include each other. We need to get /usr/include/ffmpeg4.4 ahead of the default search directories so we don't get a mishmash of 4.4 and 5.0 headers which causes compilation to fail. These don't really need to be applied to the whole project, they can just be patched into the CMakeLists.txt files for the source files that actually need them, and I'll do that later.
Python 3.10: Only two changes needed. https://github.com/bartoszek/AUR-blender-2.7/issues/4
From PKGBUILD directory, cd to src and run,
$ grep -rIlZ _PyUnicode_AsStringAndSize . | xargs -0 sed -i 's/_PyUnicode_AsStringAndSize/PyUnicode_AsUTF8AndSize/g'
$ sed -i '/s/_Py_HashDouble((double)/_Py_HashDouble(NULL, (double)/' ./blender/source/blender/python/mathutils/mathutils.c
OpenImageIO: Now needs minimum C++ version 14, and needs to link against OpenImageIO_Util in addition to OpenImageIO. In src/blender/intern/cycles/CMakeLists.txt
and src/blender/source/blender/imbuf/intern/oiio/CMakeLists.txt
we need to add set(CMAKE_CXX_STANDARD 14)
. I added it at the start of the # Build Flags
section and in if(WITH_OPENIMAGEIO)
, respectively.
In src/blender/build_files/cmake/Modules/FindOpenImageIO.cmake
, we need to add a second FIND_LIBRARY block right below the first one.
FIND_LIBRARY(OPENIMAGEIO_UTIL_LIBRARY
NAMES
OpenImageIO_Util
HINTS
${_openimageio_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
and after IF(OPENIMAGEIO_FOUND)
, change the next line to
SET(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY} ${OPENIMAGEIO_UTIL_LIBRARY})
EDIT 09.17: Updated to apply a python 3.9 -> 3.10 patch instead which removes about 2/3 of the hassle of my first approach, which was patching it to use python39. Improved OIIO patch.
Pinned Comments
bartus commented on 2022-03-14 10:30 (UTC)
Sorry lads, I'm at the Polish Ukraine border helping allocate refugees. Expect no update until this hell is over, wish us luck. Have no time nor access to my rig and AUR keys to test/post updates. If you have a patch, ping me on email - I'll add you as co-maintainer. Posted with my old script - https://github.com/bartoszek/aur-post
bartus commented on 2019-07-17 07:07 (UTC) (edited on 2019-08-25 12:20 (UTC) by bartus)
Please report
issues
andpatches
to blender-2.7/github.com<img alt="Build Status" src="https://travis-ci.org/bartoszek/AUR-blender-2.7.svg?branch=master" />
Use env vars to control build process:
DISABLE_CUDA=1
to skip cuda kernel build (cycles+compositor)DISABLE_NINJA=1
to switch build system to make (default:ninja)Usage cases:
export DISABLE_CUDA=1
before buildDISABLE_CUDA=1 ~your-aur-helper~
makepkg DISABLE_CUDA=1
yay -S blender-2.7 --mflags "DISABLE_CUDA=1"
Note for
yay
users:Since yay relies solely on
aur-rpc
to solve dependencies instead of callingmakepkg --sync
it can't follow dependencies logic defined inPKGBUILD
. That's why it's up to the user to provide dependencies to enable features.tl;dr; If you want to prebuild cycles kernels, you have to install CUDA beforehand. If you don't have CUDA installed,
PKGBUILD
will silently skip cycles kernel build.