Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 901099 - media-video/ffmpeg-4.4.3[abi_x86_32]: fails with error: inline assembly requires more registers than available
Summary: media-video/ffmpeg-4.4.3[abi_x86_32]: fails with error: inline assembly requi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-clang
  Show dependency tree
 
Reported: 2023-03-13 22:42 UTC by Alfred Persson
Modified: 2023-03-15 02:18 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log.gz,47.41 KB, application/gzip)
2023-03-13 22:44 UTC, Alfred Persson
Details
emerge --info (ffmpeg-info.txt,8.33 KB, text/plain)
2023-03-13 22:45 UTC, Alfred Persson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alfred Persson 2023-03-13 22:42:18 UTC
This is was hit on a default/linux/amd64/17.1/systemd/clang/merged-usr system. But looking at the forum post it seems to be a problem on amd64/gcc as well.

Reproducible: Always

Steps to Reproduce:
1. emerge media-video/ffmpeg-4.4.3 with USE=abi_x86_32
Actual Results:  
In file included from src/libavcodec/hevc_cabac.c:27:
In file included from src/libavcodec/cabac_functions.h:47:
src/libavcodec/x86/cabac.h:195:9: error: inline assembly requires more registers than available
        BRANCHLESS_GET_CABAC("%0", "%q0", "(%4)", "%1", "%w1",

Expected Results:  
compile without error.

https://forums.gentoo.org/viewtopic-t-1162301.html
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257124: here it seems to be a clang specific bug but looking at the first link this does seem to affect gcc too.
Comment 1 Alfred Persson 2023-03-13 22:44:19 UTC
Created attachment 857537 [details]
build.log
Comment 2 Alfred Persson 2023-03-13 22:45:59 UTC
Created attachment 857539 [details]
emerge --info
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-15 01:00:45 UTC
Suspect this is actually the same as bug 900937 but with a different (better) error message.

Let's use bug 900937 for the GCC hang (which is wrong even on invalid input) and this bug for ffmpeg failing to build with clang (and likely gcc once bug 900937 is fixed).
Comment 4 Larry the Git Cow gentoo-dev 2023-03-15 02:15:52 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60b38d402d8674ea08c9b69cf3147e0b92ab87c2

commit 60b38d402d8674ea08c9b69cf3147e0b92ab87c2
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-03-15 02:13:59 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-03-15 02:14:48 +0000

    media-video/ffmpeg: fix build on register-starved x86
    
    Newer compilers may optimise such that < 7 registers are free on 32-bit x86
    and then we get an "invalid asm" error. This is https://bugs.gentoo.org/901099
    and https://trac.ffmpeg.org/ticket/8903.
    
    Making matters worse, GCC sometimes hangs on invalid asm, so this also
    mitigates a hang with e.g. -O3 -march=znver1. See https://bugs.gentoo.org/900937
    and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109137.
    
    In future, we may want to adjust the definition of HAVE_7REGS to just exclude
    32-bit x86, but that's a big sledgehammer, so let's avoid it for now until we have
    a reply on the upstream ffmpeg bug.
    
    Thanks to Ninpo.
    
    Bug: https://trac.ffmpeg.org/ticket/8903
    Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109137
    Bug: https://bugs.gentoo.org/900937
    Closes: https://bugs.gentoo.org/901099
    Signed-off-by: Sam James <sam@gentoo.org>

 media-video/ffmpeg/ffmpeg-4.4.3.ebuild             |  3 ++-
 media-video/ffmpeg/ffmpeg-5.1.2-r1.ebuild          |  3 ++-
 media-video/ffmpeg/ffmpeg-6.0.ebuild               |  3 ++-
 .../ffmpeg-4.4.3-get_cabac_inline_x86-32-bit.patch | 24 +++++++++++++++++++++
 .../ffmpeg-5.1.2-get_cabac_inline_x86-32-bit.patch | 25 ++++++++++++++++++++++
 5 files changed, 55 insertions(+), 3 deletions(-)