Opened 8 months ago

Last modified 4 weeks ago

#2423 open defect

Undeclared constant 'M_PI' in xvid_vbr macro 'DEG2RAD'

Reported by: bug Owned by: beastd
Priority: normal Component: build system
Version: HEAD Severity: blocker
Keywords: xvid_vbr maths constants Cc: LigH
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description (last modified by bug)

Summary of the bug:
Undeclared constant 'M_PI' in xvid_vbr macro 'DEG2RAD'

How to reproduce:
Compiling mencoder in media-autobuild suite (MSYS2/MinGW, GCC 13.2)

xvid_vbr.c: In function 'vbr_init_2pass2':
xvid_vbr.c:44:18: error: 'M_PI' undeclared (first use in this function)
   44 | #define DEG2RAD (M_PI / 180.0)
      |                  ^~~~
xvid_vbr.c:887:53: note: in expansion of macro 'DEG2RAD'
  887 |                                         (1.0 +  sin(DEG2RAD * (state->average_frame * 90.0 / state->alt_curve_low_diff)));
      |                                                     ^~~~~~~
xvid_vbr.c:44:18: note: each undeclared identifier is reported only once for each function it appears in
   44 | #define DEG2RAD (M_PI / 180.0)
      |                  ^~~~
xvid_vbr.c:887:53: note: in expansion of macro 'DEG2RAD'
  887 |                                         (1.0 +  sin(DEG2RAD * (state->average_frame * 90.0 / state->alt_curve_low_diff)));
      |                                                     ^~~~~~~
xvid_vbr.c: In function 'vbr_getquant_2pass2':
xvid_vbr.c:44:18: error: 'M_PI' undeclared (first use in this function)
   44 | #define DEG2RAD (M_PI / 180.0)
      |                  ^~~~
xvid_vbr.c:1250:84: note: in expansion of macro 'DEG2RAD'
 1250 |                                                                                sin(DEG2RAD * ((dbytes - state->average_frame) * 90.0 / state->alt_curve_high_diff)));
      |                                                                                    ^~~~~~~

Attachments (5)

0001-xvid_vbr-Include-lavu-mathematics.h-to-make-sure-the.patch (610 bytes ) - added by beastd 7 months ago.
mplayer_unpatched.zip (4.4 KB ) - added by LigH 8 weeks ago.
Build and install logs of unpatched mplayer
mplayer_patched.zip (10.1 KB ) - added by LigH 8 weeks ago.
Build and install logs of patched mplayer
0001-Include-lavu-mathematics.h-everywhere-M_PI-is-used.patch (7.0 KB ) - added by beastd 8 weeks ago.
mplayer_patched2.zip (114.4 KB ) - added by LigH 8 weeks ago.
Logs of latest patched build

Download all attachments as: .zip

Change History (21)

comment:1 by bug, 8 months ago

Description: modified (diff)

comment:2 by beastd, 7 months ago

Status: newopen

Thanks for the report!

Do you know what changed so this is a problem now?

For me it always worked so far. Unfortunately M_PI seems to be in not even a single C standard so far...

Does attachment:0001-xvid_vbr-Include-lavu-mathematics.h-to-make-sure-the.patch fix the problem for your builds?

comment:3 by LigH, 6 months ago

The reason might be GCC 14.1 with stricter default warnings-as-errors than 13.2 before.

Patch applied; error moved to libaf/af_equalizer.c

comment:4 by LigH, 6 months ago

Cc: LigH added

comment:5 by beastd, 6 months ago

Ah OK that might be related. GCC 14 will definitely need some more work...

I have put a patch on the mplayer development mailing list:

https://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2024-April/074173.html

But it is not really the way to fix those problems, but if you need GCC 14 build, it should probably work in practice.

comment:6 by LigH, 6 months ago

I may mention it in the M-AB-S issues, but will probably wait for your official commit and the closing of this ticket (there is only little need for mplayer/mencoder in these days). For now, thank you for your efforts.

comment:7 by LigH, 5 months ago

So that was in April ... the mailing list contains a few steps of success but no final result, AFAICS.

And April is the last archived month of this mailing list. May 2024 does not even exist anymore.

Last edited 5 months ago by LigH (previous) (diff)

comment:8 by 4Selur@…, 2 months ago

Any news on this?

comment:9 by beastd, 8 weeks ago

Could you please try to build again with latest MPlayer development version (SVN r38666)?

Edit:
And possibly with attachment:0001-xvid_vbr-Include-lavu-mathematics.h-to-make-sure-the.patch​ applied on top.

Last edited 8 weeks ago by beastd (previous) (diff)

comment:10 by LigH, 8 weeks ago

Building without patch: Same error.

Building with patch: Error moved.

by LigH, 8 weeks ago

Attachment: mplayer_unpatched.zip added

Build and install logs of unpatched mplayer

by LigH, 8 weeks ago

Attachment: mplayer_patched.zip added

Build and install logs of patched mplayer

comment:11 by beastd, 8 weeks ago

Please give it a try with this new patch attachment:0001-Include-lavu-mathematics.h-everywhere-M_PI-is-used.patch I just attached.

comment:12 by LigH, 8 weeks ago

On it. Will attach when done. The logs are huge now, many more warnings and errors...

by LigH, 8 weeks ago

Attachment: mplayer_patched2.zip added

Logs of latest patched build

comment:13 by beastd, 7 weeks ago

@LigH: The latest errors look as if they are because of your LDFLAGS
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++

Not really sure about this, but maybe try to add standard C++ lib to the LDFLAGS:
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++ -lstdc++

Did statically linking standard C++ lib work before?

comment:14 by LigH, 7 weeks ago

I am not really a developer, I only let the media-autobuild suite run and hope that it builds mplayer successfully; if not, I can interpret the errors as halfwit and ask more competent people for opinions.

I mentioned your suggestion in the M-AB-S issue 2702

comment:15 by LigH, 5 weeks ago

I tried a lot (without any real clue) and was not successful yet...

last results

comment:16 by LigH, 4 weeks ago

Solution in M-AB-S: Use gnu11 instead of c11 as C++ version in configure, and CXX instead of CC as compiler and linker

Note: See TracTickets for help on using tickets.