Opened 6 months ago
Last modified 2 weeks ago
#2424 open defect
Fails to build with gcc 14
Reported by: | plorenzo | Owned by: | beastd |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | unspecified | Severity: | blocker |
Keywords: | Cc: | plorenzo | |
Blocked By: | Blocking: | ||
Reproduced by developer: | no | Analyzed by developer: | no |
Description
Hi,
I know you are aware of the problem and it was already discussed
in the devel mailing list, just need an issue to link to the
Debian Bug tracking system.
Also, this is now considered a blocker for the next Debian release so if it isn't fixed around December2024/Gen2025, mplayer will likely miss the next Debian stable release.
links:
Debian bug #1075294
patch on mplayer-dev
https://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2024-April/074173.html
I haven't yet tested the patch, what's the risk if I use that to temporary build the deb package, new bugs or also security holes?
Thanks,
Lorenzo
Change History (22)
comment:1 by , 6 months ago
Status: | new → open |
---|
comment:2 by , 4 months ago
Hi,
I tested a slightly refreshed version of the patch [1] with svn38638; builds fine
on amd64, fails on i386 with the following error
libmpcodecs/vd_qtvideo.c:132:20: error: assignment to 'char (*)(Size)' {aka 'char (*)(int)'} from incompatible pointer type 'OSErr (*)(Size)' {aka 'short int (*)(int)'} [-Wincompatible-pointer-types]
132 | NewHandleClear = (OSErr(*)(Size))GetProcAddress(handler, "NewHandleClear");
|
full build log in [2]
other than that, on amd64 mplayer seems to work fine (tested only few video files though)
Thanks,
Lorenzo
[1] https://salsa.debian.org/multimedia-team/mplayer/-/blob/next/debian/patches/0205-fix-FTBFS-gcc14.patch?ref_type=heads
[2] https://salsa.debian.org/multimedia-team/mplayer/-/jobs/6242311/raw
comment:3 by , 4 months ago
Thanks for trying the patch!
Unfortunately I was not able to continue work on this yet.
Hope I can make some time for it soon.
comment:4 by , 4 months ago
Since today most stuff is fixed starting with MPlayer SVN r38660 .
There are probably still some problems with x86 32bit and maybe on some other platforms.
Will try to look into the specific build problem you quoted above next.
comment:5 by , 4 months ago
I see this issue with r38660 Debian unstable amd64 gcc 14.2.0
In file included from libvo/vo_mga.c:52: libvo/mga_template.c: In function 'draw_slice_g200': libvo/mga_template.c:80:28: error: passing argument 2 of 'sws_scale' from incompatible pointer type [-Wincompatible-pointer-types] 80 | sws_scale(sws_ctx, image, stride, y, height, dst, dst_stride); | ^~~~~ | | | uint8_t ** {aka unsigned char **} In file included from libvo/mga_template.c:22:
comment:6 by , 4 months ago
I see this issue with r38660 Debian unstable i386 gcc 14.2.0
with mga driver disabled
libmpcodecs/ve_nuv.c: In function 'put_image': libmpcodecs/ve_nuv.c:155:34: error: passing argument 4 of 'lzo1x_1_compress' from incompatible pointer type [-Wincompatible-pointer-types] 155 | zdata,&zlen,vf->priv->zmem); | ^~~~~ | | | size_t * {aka unsigned int *} In file included from libmpcodecs/ve_nuv.c:41: /usr/include/lzo/lzo1x.h:75:58: note: expected 'lzo_uint *' {aka 'long unsigned int *'} but argument is of type 'size_t *' {aka 'unsigned int *'} 75 | lzo_bytep dst, lzo_uintp dst_len, | ^ libmpcodecs/ve_nuv.c:180:43: error: passing argument 4 of 'lzo1x_1_compress' from incompatible pointer type [-Wincompatible-pointer-types] 180 | r = lzo1x_1_compress(data,len,zdata,&zlen,vf->priv->zmem); | ^~~~~ | | | size_t * {aka unsigned int *} /usr/include/lzo/lzo1x.h:75:58: note: expected 'lzo_uint *' {aka 'long unsigned int *'} but argument is of type 'size_t *' {aka 'unsigned int *'} 75 | lzo_bytep dst, lzo_uintp dst_len, | ^ make: *** [Makefile:729: libmpcodecs/ve_nuv.o] Error 1
comment:7 by , 3 months ago
Hi, quick update:
I've applied the patch from
https://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2024-October/074231.html
and the error I reported for vd_qtvideo.c is fixed.
The build on i386 now fails with the same error in ve_nuv.c reported by Marillat
comment:8 by , 3 months ago
Try:
--- a/libmpcodecs/ve_nuv.c +++ b/libmpcodecs/ve_nuv.c @@ -125,7 +125,7 @@ uint8_t* data = vf->priv->buffer + FRAMEHEADERSIZE; uint8_t* zdata = vf->priv->zbuffer + FRAMEHEADERSIZE; int len = 0, r; - size_t zlen = 0; + lzo_uint zlen = 0; memset(header, 0, FRAMEHEADERSIZE); // Reset the header if(vf->priv->lzo)
comment:9 by , 3 months ago
Issue in comment 5 has been fixed with a rebuild of r38664
Proposed patch from plorenzo fix the build with 32 bits arches
But I see one issue with powerpc arch :
libmpcodecs/vf_scale.c: In function 'scale': libmpcodecs/vf_scale.c:432:16: error: assignment to 'uint8_t *' {aka 'unsigned char *'} from incompatible pointer type 'uint32_t *' {aka 'unsigned int *'} [-Wincompatible-pointer-types] 432 | src2[1]= pal2; | ^ libmpcodecs/vf_scale.c: At top level: libmpcodecs/vf_scale.c:733:50: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 733 | {"presize", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, &size_preset}, | ^ make: *** [Makefile:729: libmpcodecs/vf_scale.o] Error 1
follow-up: 11 comment:10 by , 3 months ago
Hi Ingo, yes with your patch I can build on i386.
Thanks :)
comment:11 by , 3 months ago
follow-up: 13 comment:12 by , 3 months ago
The problem for powerpc come from commit 38647 "explicit pointer casts"
Index: libmpcodecs/vf_scale.c =================================================================== --- libmpcodecs/vf_scale.c (révision 38201) +++ libmpcodecs/vf_scale.c (révision 38647) @@ -439,14 +439,14 @@ int src_stride2[MP_MAX_PLANES]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2], 2*src_stride[3]}; int dst_stride2[MP_MAX_PLANES]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2], 2*dst_stride[3]}; - sws_scale(sws1, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2); + sws_scale(sws1, (const uint8_t *const *)src2, src_stride2, y>>1, h>>1, dst2, dst_stride2); for(i=0; i<MP_MAX_PLANES; i++){ src2[i] += src_stride[i]; dst2[i] += dst_stride[i]; } - sws_scale(sws2, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2); + sws_scale(sws2, (const uint8_t *const *)src2, src_stride2, y>>1, h>>1, dst2, dst_stride2); }else{ - sws_scale(sws1, src2, src_stride, y, h, dst, dst_stride); + sws_scale(sws1, (const uint8_t *const *)src2, src_stride, y, h, dst, dst_stride); }
But as powerpc is bigendian the code above these changes have not been modified.
#if HAVE_BIGENDIAN uint32_t pal2[256]; if (src[1] && !src[2]){ int i; for(i=0; i<256; i++) pal2[i]= bswap_32(((uint32_t*)src[1])[i]); src2[1]= pal2; } #endif
comment:13 by , 3 weeks ago
Replying to marillat@…:
[...]
But as powerpc is bigendian the code above these changes have not been modified.
#if HAVE_BIGENDIAN uint32_t pal2[256]; if (src[1] && !src[2]){ int i; for(i=0; i<256; i++) pal2[i]= bswap_32(((uint32_t*)src[1])[i]); src2[1]= pal2; } #endif
So appying the following diff fixes the build for powerpc?
-
libmpcodecs/vf_scale.c
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index 39deb59c2..fd4511283 100644
a b static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src 429 429 int i; 430 430 for(i=0; i<256; i++) 431 431 pal2[i]= bswap_32(((uint32_t*)src[1])[i]); 432 src2[1]= pal2;432 src2[1]= (uint8_t *)pal2; 433 433 } 434 434 #endif 435 435
follow-up: 15 comment:14 by , 3 weeks ago
Thanks beastd this patch fix this issue.
comment:15 by , 3 weeks ago
Replying to marillat@…:
Thanks beastd, this patch fix this issue.
OK, thanks for confirming.
Committed as SVN r38668 .
comment:16 by , 3 weeks ago
Lorenzo and Christian,
with current MPlayer SVN r38668 are there still problems to build with GCC 14?
On some specific os/arch, maybe?
comment:18 by , 3 weeks ago
Hi,
I think patch from KO Myung-Hun in mplayer-dev list is still missing and it was necessary to build on i386
https://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2024-October/074231.html
other than that this issue looks fixed.
Thanks!
Lorenzo
comment:19 by , 3 weeks ago
I did this morning a SVN r38668 build for i386 without problem.
Also Debian did a SVn r38638 build 2 days ago without problem.
https://buildd.debian.org/status/package.php?p=mplayer&suite=sid
follow-up: 21 comment:20 by , 3 weeks ago
Hi,
Debian svn r38638 has the patch from KO Myung-Hun applied (it's 0207):
https://salsa.debian.org/multimedia-team/mplayer/-/tree/master/debian/patches?ref_type=heads
for testing I just removed the patch and pushed in Salsa to trigger the CI, and it still fails on i386
https://salsa.debian.org/multimedia-team/mplayer/-/jobs/6802333
Not sure why it fails in Debian builds but not in Marillat's, maybe there are different config switches or there is a slightly different build environment?
Lorenzo
follow-up: 22 comment:21 by , 2 weeks ago
Hi Lorenzo!
Replying to plorenzo:
Debian svn r38638 has the patch from KO Myung-Hun applied (it's 0207):
https://salsa.debian.org/multimedia-team/mplayer/-/tree/master/debian/patches?ref_type=heads
for testing I just removed the patch and pushed in Salsa to trigger the CI, and it still fails on i386
https://salsa.debian.org/multimedia-team/mplayer/-/jobs/6802333
Hmm. Maybe I'm missing something, but do you have specific reason to build from r38638?
After that came most of GCC14 fixes:
- configure: disable Vulkan encoders
- configure: remove -ffast-math
- configure: enable DOVI encoder
- configure: replace AV*putFormat with FF*
- libaf/af_lavcresample: explicit pointer casts
- libmpcodecs/ad_spdif: fix type of argument
- libmpcodecs/vd_ffmpeg: explicit pointer casts
- libmpcodecs/vf_pp: explicit pointer casts
- libmpcodecs/vf_scale: explicit pointer casts
- libmpcodecs/vf_screenshot: explicit pointer casts
- libmpdemux/demux_film: explicit pointer casts
- libmpdemux/demux_lavf: explicit pointer casts
- libmpdemux/muxer_avi: explicit pointer casts
- libvo/vo_aa: explicit pointer casts
- libvo/vo_matrixview: explicit pointer casts
- libvo/vo_x11: explicit pointer casts
- loader/qtx/qtxsdk/components: explicit pointer casts
- mp_msg: explicit pointer casts
- mplayer: explicit pointer casts
- sub/sub: explicit pointer casts
- sub/spudec: explicit pointer casts
- libvo/gl_common: fix incompatible pointer types
- ao_dart, ao_kai: fix compilation due to switch from AVFifoBuffer to AVFifo
- osdep/mmap.h: define MAP_FAILED if necessary
- configure: define _EMX_SOURCE on OS/2
- Check the return value of malloc() to avoid a NULL pointer dereference.
- Use correct type to define the variable passed to lzo1x_1_compress().
- configure: remove -Zomf from flags when checking extern symbol prefix on OS/2
- M_PI is not mandated by the C standard.
- libmpcodecs/vf_scale: Fix a build problem on big endian
Could you try a build from r38668 possibly with the mentioned patch from KO Myung-Hun applied on top?
comment:22 by , 2 weeks ago
Hi beastd,
Hmm. Maybe I'm missing something, but do you have specific reason to build from r38638?
After that came most of GCC14 fixes:
There is some overhead in fetching a new upstream svn snapshot in Debian packaging (people need to review it but also git workflow is more complex) so I was waiting for all gcc14 patches to be merged upstream before that (ideally I would like to wait as close as possible to the start of the Debian release process)
The Debian r38638 version is misleading, it's in fact r38638 + all gcc14 patches posted in mplayer dev list and here, sorry for confusion.
Could you try a build from r38668 possibly with the mentioned patch from KO Myung-Hun applied on top?
I did, patch from komh is still needed on i386; with patch applied on top of r38668 it builds fine on amd64 and i386.
i386 build logs, with patch:
https://salsa.debian.org/Lorenzo.ru.g-guest/mplayer/-/jobs/6827271
without patch:
https://salsa.debian.org/Lorenzo.ru.g-guest/mplayer/-/jobs/6827787
Lorenzo
Hi Lorenzo,
thanks for opening this ticket.
I'm optimistic we can get MPlayer to compile with GCC14.
As I'm really low on time at least for a month from now, it will probably take about 2 months minimum to fix. Maybe more realistically 3 months with review, rework, commits...
TL;DR: Would be good if you give the patch a chance. Maybe there is more missing in regard to the Debian builds and their configuration. I would be glad to hear about it should it work or not! I would not recommend to distribute the results though.
plorenzo wrote:
That's a bit hard to say. I see mainly 2 risks
Regarding risk 2 I hope the patch itself shouldn't really introduce newly undefined behavior that wasn't there previously. Just makes it more visible in the code and less visible in the compiler output because the warnings/errors are silenced.
So there is only the general risk that GCC14 will lay out the UB in ways that are less favorable for us or even dangerous.