Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 885095 - media-video/vlc-3.0.18: fails compilation with Atlivec support (video_chroma/i420_yuy2.c:213:13: error: implicit declaration of function ‘vec_ld’ [-Werror=implicit-function-declaration])
Summary: media-video/vlc-3.0.18: fails compilation with Atlivec support (video_chroma/...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: Normal normal
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: c99-porting gcc-14-stable
  Show dependency tree
 
Reported: 2022-12-09 22:47 UTC by Josh Cantwell
Modified: 2024-10-22 10:39 UTC (History)
1 user (show)

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


Attachments
Build log (build.log,276.04 KB, text/plain)
2022-12-09 23:34 UTC, Josh Cantwell
Details
emerge --info (emergeInfo,6.17 KB, text/plain)
2022-12-09 23:36 UTC, Josh Cantwell
Details
config log file (autoconf.out,4.33 KB, text/plain)
2022-12-09 23:37 UTC, Josh Cantwell
Details
Config.log (config.log,354.63 KB, text/x-log)
2022-12-10 01:37 UTC, Josh Cantwell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Josh Cantwell 2022-12-09 22:47:12 UTC
VLC fails to compile as the function vec_ld is not implemented, yet is referenced in i420_yuy2.c. This function should be being implemented by the configure.ac file which checks for altivec support (line 1774 in configure.ac) yet fails to implement the function. I think the package isn't getting configured correctly or that this configure.ac file isn't being used by portage/the build system.

I have observed this with default use flags,
I also have just to be sure, I have global use flags and cpu flags setting altivec.

During the configuration phase this is run:

./configure --prefix=/usr --build=...yadayada... ---enable-altivec ...yadayada ...

So during ./configure it sees altivec.


Then later during the config I see this:
checking if powerpc64-unknown-linux-gnu-gcc groks AltiVec inline assembly... yes
checking if $CC groks AltiVec C extensions... -maltivec
checking for altivec.h... no
architecture          : powerpc64 altivec

I'm quite new to the way portage works and invokes parts of the config and compilation process so I don't know how to investigate what is happening however under directions I don't mind investigating further.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-09 22:59:33 UTC
Please include the full build.log (and config.log) as attachments without truncation.

Please also run 'emerge --info' and include its output in a comment here.
Comment 2 Josh Cantwell 2022-12-09 23:34:44 UTC
Created attachment 841191 [details]
Build log

Build log showing error during compilation
Comment 3 Josh Cantwell 2022-12-09 23:36:58 UTC
Created attachment 841193 [details]
emerge --info

output of emerge --info
Comment 4 Josh Cantwell 2022-12-09 23:37:20 UTC
Created attachment 841195 [details]
config log file

config log file I hope
Comment 5 Josh Cantwell 2022-12-09 23:37:39 UTC
I've attached the requested files.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-09 23:51:43 UTC
../doltlibtool  --tag=CC   --mode=compile powerpc64-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..  -DMODULE_STRING=\"$(p="audio_filter/converter/libaudio_format_plugin_la-format.lo"; p="${p##*/}"; p="${p#lib
}"; p="${p%_plugin*}"; p=$(echo "$p"|sed 's/-/_/g'); p="${p%.lo}"; echo "$p")\" -D__PLUGIN__  -I./access -I./codec -I../include -I../include   -O2 -pipe  -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -
Wvolatile-register-var -Wformat -Wformat-security -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Werror-implicit-function-declaration -Winit-self -Wlogical-op -Wshadow=local -fvisibility=hidden -c
-o audio_filter/converter/libaudio_format_plugin_la-format.lo `test -f 'audio_filter/converter/format.c' || echo './'`audio_filter/converter/format.c
../doltlibtool  --tag=CC   --mode=compile powerpc64-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..  -DMODULE_STRING=\"$(p="video_chroma/libi420_yuy2_altivec_plugin_la-i420_yuy2.lo"; p="${p##*/}"; p="${p#lib}"
; p="${p%_plugin*}"; p=$(echo "$p"|sed 's/-/_/g'); p="${p%.lo}"; echo "$p")\" -D__PLUGIN__  -I./access -I./codec -DMODULE_NAME_IS_i420_yuy2_altivec -I../include -I../include   -O2 -pipe  -Wall -Wextra -Wsign-
compare -Wundef -Wpointer-arith -Wvolatile-register-var -Wformat -Wformat-security -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Werror-implicit-function-declaration -Winit-self -Wlogical-op -Wsha
dow=local -fvisibility=hidden -c -o video_chroma/libi420_yuy2_altivec_plugin_la-i420_yuy2.lo `test -f 'video_chroma/i420_yuy2.c' || echo './'`video_chroma/i420_yuy2.c
video_chroma/i420_yuy2.c: In function ‘I420_YUY2’:
video_chroma/i420_yuy2.c:213:13: error: implicit declaration of function ‘vec_ld’ [-Werror=implicit-function-declaration]
  213 |     u_vec = vec_ld( 0, p_u ); p_u += 16; \
      |             ^~~~~~
video_chroma/i420_yuy2.c:239:17: note: in expansion of macro ‘VEC_LOAD_UV’
  239 |                 VEC_LOAD_UV( );
      |                 ^~~~~~~~~~~
video_chroma/i420_yuy2.c:213:13: error: incompatible types when assigning to type ‘__vector unsigned char’ {aka ‘__vector(16) unsigned char’} from type ‘int’
  213 |     u_vec = vec_ld( 0, p_u ); p_u += 16; \
      |             ^~~~~~
video_chroma/i420_yuy2.c:239:17: note: in expansion of macro ‘VEC_LOAD_UV’
  239 |                 VEC_LOAD_UV( );
      |                 ^~~~~~~~~~~
video_chroma/i420_yuy2.c:214:13: error: incompatible types when assigning to type ‘__vector unsigned char’ {aka ‘__vector(16) unsigned char’} from type ‘int’
  214 |     v_vec = vec_ld( 0, p_v ); p_v += 16;
      |             ^~~~~~
video_chroma/i420_yuy2.c:239:17: note: in expansion of macro ‘VEC_LOAD_UV’
  239 |                 VEC_LOAD_UV( );
      |                 ^~~~~~~~~~~
video_chroma/i420_yuy2.c:240:28: error: implicit declaration of function ‘vec_mergeh’ [-Werror=implicit-function-declaration]
  240 |                 VEC_MERGE( vec_mergeh );
      |                            ^~~~~~~~~~
[...]
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-10 01:15:16 UTC
(In reply to Josh Cantwell from comment #4)
> Created attachment 841195 [details]
> config log file
> 
> config log file I hope

This isn't config.log -- can you attach /var/tmp/portage/media-video/vlc-3.0.18/work/vlc-3.0.18/config.log?
Comment 8 Josh Cantwell 2022-12-10 01:37:31 UTC
Created attachment 841201 [details]
Config.log
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-10 01:42:11 UTC
configure:32405: checking for altivec.h
configure:32405: powerpc64-unknown-linux-gnu-gcc -c -O2 -pipe  -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -Wformat -Wformat-security -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Werror-implicit-function-declaration -Winit-self -Wlogical-op -Wshadow=local -fvisibility=hidden  conftest.c >&5
In file included from conftest.c:190:
/usr/lib/gcc/powerpc64-unknown-linux-gnu/11.3.0/include/altivec.h:34:2: error: #error Use the "-maltivec" flag to enable PowerPC AltiVec support
   34 | #error Use the "-maltivec" flag to enable PowerPC AltiVec support
      |  ^~~~~
configure:32405: $? = 1
Comment 10 Josh Cantwell 2022-12-10 13:24:38 UTC
(In reply to Sam James from comment #9)
> configure:32405: checking for altivec.h
> configure:32405: powerpc64-unknown-linux-gnu-gcc -c -O2 -pipe  -Wall -Wextra
> -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -Wformat
> -Wformat-security -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes
> -Werror-implicit-function-declaration -Winit-self -Wlogical-op
> -Wshadow=local -fvisibility=hidden  conftest.c >&5
> In file included from conftest.c:190:
> /usr/lib/gcc/powerpc64-unknown-linux-gnu/11.3.0/include/altivec.h:34:2:
> error: #error Use the "-maltivec" flag to enable PowerPC AltiVec support
>    34 | #error Use the "-maltivec" flag to enable PowerPC AltiVec support
>       |  ^~~~~
> configure:32405: $? = 1

I saw that however -maltivec has been supplied. This error occurs when __VEC__ or __ALIVEC__ hasn't been defined. The assumption is that passing -maltivec to the compiler will define one of these two symbols.
Comment 11 Josh Cantwell 2022-12-12 21:45:31 UTC
I've been looking into this an in the file i420_yuy2.c in modules/video_chroma during the includes this #if fails:

#if defined (MODULE_NAME_IS_i420_yuy2_altivec) && defined(HAVE_ALTIVEC_H)
#   include <altivec.h>
#endif

Looking at the above #if, we can see it is composed of a definition check for MODULE_NAME_IS_i420_yuy2_altivec and a definition check for HAVE_ALTIVEC_H.
I think I have found the cause of HAVE_ALTIVEC_H not being included:

the definition for HAVE_ALTIVEC_H fails as when ./configure is run (which generates config.h), there are a pair of lines in config.h commented out which are as follows: 
/* Define to 1 if you have the <altivec.h> header file. */
/* #undef HAVE_ALTIVEC_H */

I can only assume that the ./configure script looks for altivec.h, fails to find it and does not generate the symbol HAVE_ALTIVEC_H therefore causing the compilation of i420_yuy2.c to fail.

By manually modifying config.h to defin  HAVE_ALTIVEC_H, the preprocessor finds HAVE_ALTIVEC_H when looking at i420_yuy2.c therefore leaving the only issue now to be the definition check for MODULE_NAME_IS_i420_yuy2_altivec.

This is puzzling as on my x86-64 machine the same line of code does not reference MODULE_NAME_IS_i420_yuy2_altivec but instead looks for the definition of PLUGIN_ALTIVEC yet the source code came from the same source. Either way neither PLUGIN_ALTIVEC or MODULE_NAME_IS_i420_yuy2_altivec are defined on the PowerPC machine., i'm currently looking into it.
Comment 12 Josh Cantwell 2022-12-12 21:50:46 UTC
This definition for PLUGIN_ALTIVEC/MODULE_NAME_IS_i420_yuy2_altivec comes from the Makefile.am at line 60. on my x86-64 it looks like this:

58) # AltiVec
59) libi420_yuy2_altivec_plugin_la_SOURCES = video_chroma/i420_yuy2.c video_chroma/i420_yuy2.h
60) libi420_yuy2_altivec_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DPLUGIN_ALTIVEC

on my PowerPC it looks like this:
58) # AltiVec
59) libi420_yuy2_altivec_plugin_la_SOURCES = video_chroma/i420_yuy2.c video_chroma/i420_yuy2.h
60) libi420_yuy2_altivec_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
61)         -DMODULE_NAME_IS_i420_yuy2_altivec
Comment 13 A. Wilcox (awilfox) 2022-12-12 22:10:06 UTC
(In reply to Josh Cantwell from comment #10)
> (In reply to Sam James from comment #9)
> > configure:32405: checking for altivec.h
> > configure:32405: powerpc64-unknown-linux-gnu-gcc -c -O2 -pipe  -Wall -Wextra
> > -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -Wformat
> > -Wformat-security -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes
> > -Werror-implicit-function-declaration -Winit-self -Wlogical-op
> > -Wshadow=local -fvisibility=hidden  conftest.c >&5
> > In file included from conftest.c:190:
> > /usr/lib/gcc/powerpc64-unknown-linux-gnu/11.3.0/include/altivec.h:34:2:
> > error: #error Use the "-maltivec" flag to enable PowerPC AltiVec support
> >    34 | #error Use the "-maltivec" flag to enable PowerPC AltiVec support
> >       |  ^~~~~
> > configure:32405: $? = 1
> 
> I saw that however -maltivec has been supplied. This error occurs when
> __VEC__ or __ALIVEC__ hasn't been defined. The assumption is that passing
> -maltivec to the compiler will define one of these two symbols.

-maltivec was not supplied during conftest, which is why it fails to #include <altivec.h>, which is why HAVE_ALTIVEC_H is not defined.

There should probably be something in the ebuild to add "-maltivec" when USE= contains cpu_flags_ppc_altivec.
Comment 14 Andreas K. Hüttel archtester gentoo-dev 2024-10-22 10:39:40 UTC
Is this still happening with current stable?