Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 728602 - media-video/ffmpeg-4.3 USE=altivec - src/libswscale/ppc/yuv2rgb_altivec.c:339:18: error: implicit declaration of function ‘vec_xl’; did you mean ‘vec_rl’? [-Werror=implicit-function-declaration]
Summary: media-video/ffmpeg-4.3 USE=altivec - src/libswscale/ppc/yuv2rgb_altivec.c:339...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Media-video project
URL: https://github.com/FFmpeg/FFmpeg/blob...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-18 01:01 UTC by David Michael
Modified: 2020-10-07 19:46 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Michael 2020-06-18 01:01:04 UTC
The altivec code in libswscale unconditionally uses VSX extensions.  This breaks the build for CPUs like the G4 (32-bit BE with altivec and no VSX).  It looks like altivec should require vsx in REQUIRED_USE unless upstream fixes it.

Reproducible: Always

Steps to Reproduce:
1. emerge -v =media-libs/ffmpeg-4.3  # using a PPC compiler with +altivec -vsx

Actual Results:  
A bunch of errors like these:

src/libswscale/ppc/yuv2rgb_altivec.c: In function ‘altivec_yuv2_abgr’:
src/libswscale/ppc/yuv2rgb_altivec.c:339:18: error: implicit declaration of function ‘vec_xl’; did you mean ‘vec_rl’? [-Werror=implicit-function-declaration]
  339 |             y0 = vec_xl(0, y1i);                                              \
      |                  ^~~~~~
src/libswscale/ppc/yuv2rgb_altivec.c:438:1: note: in expansion of macro ‘DEFCSP420_CVT’
  438 | DEFCSP420_CVT(yuv2_abgr,  out_abgr)
      | ^~~~~~~~~~~~~
src/libswscale/ppc/yuv2rgb_altivec.c:339:18: error: incompatible types when assigning to type ‘__vector unsigned char’ {aka ‘__vector(16) unsigned char’} from type ‘int’
  339 |             y0 = vec_xl(0, y1i);                                              \
      |                  ^~~~~~
src/libswscale/ppc/yuv2rgb_altivec.c:438:1: note: in expansion of macro ‘DEFCSP420_CVT’
  438 | DEFCSP420_CVT(yuv2_abgr,  out_abgr)
      | ^~~~~~~~~~~~~
src/libswscale/ppc/yuv2rgb_altivec.c:341:18: error: incompatible types when assigning to type ‘__vector unsigned char’ {aka ‘__vector(16) unsigned char’} from type ‘int’
  341 |             y1 = vec_xl(0, y2i);                                              \
      |                  ^~~~~~
src/libswscale/ppc/yuv2rgb_altivec.c:438:1: note: in expansion of macro ‘DEFCSP420_CVT’
  438 | DEFCSP420_CVT(yuv2_abgr,  out_abgr)
      | ^~~~~~~~~~~~~
src/libswscale/ppc/yuv2rgb_altivec.c:438:1: error: can’t convert a value of type ‘int’ to vector type ‘__vector(16) signed char’ which has different size
src/libswscale/ppc/yuv2rgb_altivec.c:438:1: error: can’t convert a value of type ‘int’ to vector type ‘__vector(16) signed char’ which has different size

Expected Results:  
It should build and install.

It builds successfully with all PPC CPU flags disabled.
Comment 1 David Michael 2020-06-18 14:12:41 UTC
A bit more information on this...

Using REQUIRED_USE won't actually help in this case.  It turns out that ffmpeg's configure script will override specified CPU flags settings depending on what it finds in -mcpu, so forcing USE=vsx with a G4 will have no effect and it will fail anyway.

Building for non-VSX hardware can just revert the commit that made the change, but that might result in problems on other CPUs judging by the commit message:

https://github.com/FFmpeg/FFmpeg/commit/3a557c5d88b7b15b5954ba2743febb055549b536

A general fix should probably switch implementations based on if __VSX__ is defined.
Comment 2 Georgy Yakovlev archtester gentoo-dev 2020-06-18 20:00:52 UTC
this is not the first package that calls it altivec but uses vec_xl (other is x265 for instance). It's a common problem.


It gets worse, because in some vector code (vsx and friends) is little-endian only and will get auto-disabled on big-endian targets.

also, the way flags work in ffmpeg ebuild, is that they don't actively enable anything, autodetection from upstream ./configure script does the magic. CPU_FLAGS_PPC only relevant to disable things for ffmpeg.
Comment 3 David Michael 2020-10-07 19:37:41 UTC
It looks like this was fixed in https://github.com/gentoo/gentoo/commit/44b6376a81a1912b0a5337585b694d38521025e9 .
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-10-07 19:46:44 UTC
(In reply to David Michael from comment #3)
> It looks like this was fixed in
> https://github.com/gentoo/gentoo/commit/
> 44b6376a81a1912b0a5337585b694d38521025e9 .

Sorry, I hadn't realised a bug was filed for this. My apologies for not tagging it.