Add support for ffmpeg 6.0 in blender, and other FTBFS fixes

Bug #2029503 reported by Nicola Ferralis
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
blender (Debian)
Fix Released
Unknown
blender (Ubuntu)
Fix Committed
Undecided
Unassigned

Bug Description

Currently blender (3.4.1+dfsg-2build4) fails at compilation with ffmpeg 6.0 (using mantic) and in my custom builds for jammy (https://launchpad.net/~bleedingedge/+archive/ubuntu/jammy-bleed/)

Support for ffmpeg 6.0 can be added by applying a patch developed for freeBSD:

https://cgit.freebsd.org/ports/commit/?id=0ed9c88a8c2de8744cb63163bdff9f9e4a71693e

Compilation is successful with the patch, which is provided with this bug report.

Tags: ftbfs patch
Revision history for this message
Nicola Ferralis (feranick) wrote :
description: updated
description: updated
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "0004-fix-support-ffmpeg6.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Nicola Ferralis (feranick) wrote :

It is a patch.

tags: added: ftbfs
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I'm looking at this

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks for this patch, Nicola!

I located the usptream commit in blender's git at https://projects.blender.org/blender/blender/commit/e0732b640af16668c8bce6fd1cce566912abd7f9. It seems the openbsd patch is missing the ffmpeg_compat.h bit which just redefines AV_CODEC_CAP_OTHER_THREADS to be AV_CODEC_CAP_AUTO_THREADS.

I grepped the source for the old name (AV_CODEC_CAP_OTHER_THREADS), and the patch is indeed addressing all parts, so maybe that compat define isn't needed (maybe it was even removed later: this repo is huge and I'm having a hard time cloning it).

I took the liberty of adding DEP3[1] headers to your patch, based on the upstream commit I found. This is what it looks like now, please take a look to see if you agree, and/or if you would like to change anything:

Description: Fix: Build with FFmpeg 6.0
Author: Timo Gurr <email address hidden>
Origin: upstream, https://projects.blender.org/blender/blender/commit/e0732b640af16668c8bce6fd1cce566912abd7f9
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/blender/+bug/2029503
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1043014
Reviewed-by: Andreas Hasenack <email address hidden>
Last-Update: 2023-08-04

(full patch file in https://git.launchpad.net/~ahasenack/ubuntu/+source/blender/tree/debian/patches/0004-fix-support-ffmpeg6.patch?h=mantic-blender-ftbfs-ffmpeg6)

Finally, I see you filed a debian bug with the same patch. You can also create a PR in salsa[2] if you want, to propose the same fix to debian via that mechanism.

https://salsa.debian.org/multimedia-team/blender/-/merge_requests

Would you like to propose a full debdiff here as well, or a launchpad PR, with a d/changelog entry, or are you ok with me doing that for you, with the above DEP3 header added to the patch?

1. http://dep.debian.net/deps/dep3/
2. https://salsa.debian.org/multimedia-team/blender/-/merge_requests

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I'm afraid that the current mantic build failure, however, seems to be elsewhere:

make[3]: Entering directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
[ 5%] Building CXX object intern/openvdb/CMakeFiles/bf_intern_openvdb.dir/openvdb_capi.cc.o
cd /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/intern/openvdb && /usr/bin/c++ -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -DWITH_ASSERT_ABORT -DWITH_OPENGL -DWITH_OPENVDB -DWITH_OPENVDB_BLOSC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D__LITTLE_ENDIAN__ -D__MMX__ -D__SSE2__ -D__SSE__ -I/<<PKGBUILDDIR>>/intern/openvdb -I/<<PKGBUILDDIR>>/intern/guardedalloc -isystem /usr/include/OpenEXR -isystem /usr/include/Imath -Wuninitialized -Wredundant-decls -Wall -Wno-invalid-offsetof -Wno-sign-compare -Wlogical-op -Winit-self -Wmissing-include-dirs -Wno-div-by-zero -Wtype-limits -Werror=return-type -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings -Wundef -Wformat-signedness -Wrestrict -Wno-suggest-override -Wuninitialized -Wundef -Wmissing-declarations -Wimplicit-fallthrough=5 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/blender-3.4.1+dfsg-2build4 -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG -fopenmp -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -ffp-contract=off -msse2 -fmacro-prefix-map="/<<PKGBUILDDIR>>/"="" -fmacro-prefix-map="/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/"="" -std=c++17 -MD -MT intern/openvdb/CMakeFiles/bf_intern_openvdb.dir/openvdb_capi.cc.o -MF CMakeFiles/bf_intern_openvdb.dir/openvdb_capi.cc.o.d -o CMakeFiles/bf_intern_openvdb.dir/openvdb_capi.cc.o -c /<<PKGBUILDDIR>>/intern/openvdb/openvdb_capi.cc
/<<PKGBUILDDIR>>/intern/cycles/util/thread.cpp: In member function ‘bool ccl::thread::join()’:
/<<PKGBUILDDIR>>/intern/cycles/util/thread.cpp:50:34: error: expected unqualified-id before ‘&’ token
   50 | catch (const std::system_error &) {
      | ^
/<<PKGBUILDDIR>>/intern/cycles/util/thread.cpp:50:33: error: expected ‘)’ before ‘&’ token
   50 | catch (const std::system_error &) {
      | ~ ^~
      | )
/<<PKGBUILDDIR>>/intern/cycles/util/thread.cpp:50:34: error: expected ‘{’ before ‘&’ token
   50 | catch (const std::system_error &) {
      | ^
/<<PKGBUILDDIR>>/intern/cycles/util/thread.cpp:50:35: error: expected primary-expression before ‘)’ token
   50 | catch (const std::system_error &) {
      | ^
make[3]: *** [intern/cycles/util/CMakeFiles/cycles_util.dir/build.make:261: intern/cycles/util/CMakeFiles/cycles_util.dir/thread.cpp.o] Error 1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu'
make[2]: *** [CMakeFiles/Makefile2:3662: intern/cycles/util/CMakeFiles/cycles_util.dir/all] Error 2

Your ppa has a jammy build with ffmpeg 6.0. Have you tried a mantic build with the ffmpeg patch applied?

Revision history for this message
Nicola Ferralis (feranick) wrote :

Unfortunately I didn't.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I found https://projects.blender.org/blender/blender/issues/103960 that fixes the above, but there is another failure after that:

/home/ubuntu/git/packages/blender/blender/extern/quadriflow/src/loader.cpp:31:8: error: ‘uint32_t’ does not name a type
   31 | inline uint32_t str_to_uint32_t(const std::string &str) {
      | ^~~~~~~~
/home/ubuntu/git/packages/blender/blender/extern/quadriflow/src/loader.cpp:12:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
   11 | #include <fstream>
  +++ |+#include <cstdint>
   12 | #include <unordered_map>
/home/ubuntu/git/packages/blender/blender/extern/quadriflow/src/loader.cpp: In function ‘void qflow::load(const char*, Eigen::MatrixXd&, Eigen::MatrixXi&)’:
/home/ubuntu/git/packages/blender/blender/extern/quadriflow/src/loader.cpp:43:17: error: ‘uint32_t’ does not name a type
   43 | uint32_t p = (uint32_t)-1;
      | ^~~~~~~~
/home/ubuntu/git/packages/blender/blender/extern/quadriflow/src/loader.cpp:43:17: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
/home/ubuntu/git/packages/blender/blender/extern/quadriflow/src/loader.cpp:44:17: error: ‘uint32_t’ does not name a type
   44 | uint32_t n = (uint32_t)-1;
      | ^~~~~~~~
/home/ubuntu/git/packages/blender/blender/extern/quadriflow/src/loader.cpp:44:17: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
/home/ubuntu/git/packages/blender/blender/extern/quadriflow/src/loader.cpp:45:17: error: ‘uint32_t’ does not name a type
   45 | uint32_t uv = (uint32_t)-1;
      | ^~~~~~~~
/home/ubuntu/git/packages/blender/blender/extern/quadriflow/src/loader.cpp:45:17: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

That did it, it builds fine now.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I'll put these together and upload, including the ffmpeg patch, which is definitely needed.

Revision history for this message
Nicola Ferralis (feranick) wrote : Re: Add support for ffmpeg 6.0 in blender

Shouldn't the two patches be kept separate? One is related to ffmpeg, the other is for gcc...

Revision history for this message
Nicola Ferralis (feranick) wrote :

In relation to the upstream ffmpeg patch (compared to freebsd), the bits added to ffmpeg_compat.h are not needed here for Mantic. They are added in blender upstream to allow compilation for previous versions of ffmpeg (<6.0). In other words, the source is now set to use AV_CODEC_CAP_OTHER_THREADS as default and as defined in ffmpeg 6.0+, the compat bits are needed when blender is compiled in systems with ffmpeg <6.0, which still use AV_CODEC_CAP_AUTO_THREADS.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

> Shouldn't the two patches be kept separate? One is related to ffmpeg, the other is for gcc...

Yes, and they are. I'm using:
0004-fix-support-ffmpeg6.patch
0005-fix_ftbfs_gcc13-1.patch
0005-fix_ftbfs_gcc13-2.patch

I'm just going to update the DEP3 headers for the gcc13 ones and then upload

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Uploaded:

Uploading blender_3.4.1+dfsg-2ubuntu1.dsc
Uploading blender_3.4.1+dfsg-2ubuntu1.debian.tar.xz
Uploading blender_3.4.1+dfsg-2ubuntu1_source.buildinfo
Uploading blender_3.4.1+dfsg-2ubuntu1_source.changes

Changed in blender (Ubuntu):
status: New → In Progress
status: In Progress → Fix Committed
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I also attached the gcc-13 fixes to the debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1037594

summary: - Add support for ffmpeg 6.0 in blender
+ Add support for ffmpeg 6.0 in blender, and other FTBFS fixes
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

It failed to build on armhf and s390x.

For armhf, it's expected, and I filed https://bugs.launchpad.net/ubuntu/+source/blender/+bug/2030289 and https://code.launchpad.net/~ubuntu-release/britney/+git/hints-ubuntu/+merge/448541

For s390x, I don't have a solution yet, and it warrants a new bug.

Changed in blender (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.