Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSYS2/MinGW, GCC14.1 fails building #33

Open
LigH-de opened this issue May 16, 2024 · 7 comments
Open

MSYS2/MinGW, GCC14.1 fails building #33

LigH-de opened this issue May 16, 2024 · 7 comments

Comments

@LigH-de
Copy link

LigH-de commented May 16, 2024

Describe the bug

Building in media-autobuild suite, GCC 14.1 throws several errors:

G:/MABS/build/xavs2-git/source/encoder/parameters.c: In function 'get_param_name':
G:/MABS/build/xavs2-git/source/encoder/parameters.c:447:18: warning: passing argument 1 of 'strtok' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  447 |     str = strtok(param_item, "_");
      |                  ^~~~~~~~~~
In file included from G:/MABS/build/xavs2-git/source/encoder/parameters.c:47:
G:/MABS/msys64/mingw64/include/string.h:97:44: note: expected 'char * restrict' but argument is of type 'const char *'
   97 |   char *__cdecl strtok(char * __restrict__ _Str,const char * __restrict__ _Delim) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
      |                        ~~~~~~~~~~~~~~~~~~~~^~~~
G:/MABS/build/xavs2-git/source/encoder/parameters.c: In function 'xavs2_encoder_opt_set':
G:/MABS/build/xavs2-git/source/encoder/parameters.c:632:45: error: passing argument 2 of 'xavs2_get_configs' from incompatible pointer type [-Wincompatible-pointer-types]
  632 |     if ((contents = xavs2_get_configs(argc, argv)) == NULL) {
      |                                             ^~~~
      |                                             |
      |                                             char **
G:/MABS/build/xavs2-git/source/encoder/parameters.c:531:62: note: expected 'const char * const*' but argument is of type 'char **'
  531 | static char *xavs2_get_configs(int argc, const char * const *argv)
      |                                          ~~~~~~~~~~~~~~~~~~~~^~~~
G:/MABS/build/xavs2-git/source/encoder/parameters.c:626:11: warning: unused variable 'map_index' [-Wunused-variable]
  626 |     int   map_index;
      |           ^~~~~~~~~
ccache gcc -Wno-maybe-uninitialized -Wshadow -O3 -ffast-math -m64 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -mthreads -Wall -I. -I/build/xavs2-git/source -D_POSIX_C_SOURCE=200112L -DARCH_X86_64=1 -std=gnu99 -D_GNU_SOURCE -fomit-frame-pointer -fno-tree-vectorize -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -I. -I/build/xavs2-git/source -I/build/xavs2-git/source/common -I/build/xavs2-git/source/common/x86 -I/build/xavs2-git/source/common/vec -I/build/xavs2-git/source/encoder -I/build/xavs2-git/source/test -mmmx -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -msse4a -c -o common/vec/intrinsic.o /build/xavs2-git/source/common/vec/intrinsic.c
make: *** [Makefile:265: encoder/parameters.o] Error 1
make: *** Waiting for unfinished jobs....
\033[33m [Compiling]: /build/xavs2-git/source/encoder/parameters.c \033[0m
ccache gcc -Wno-maybe-uninitialized -Wshadow -O3 -ffast-math -m64 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -mthreads -Wall -I. -I/build/xavs2-git/source -D_POSIX_C_SOURCE=200112L -DARCH_X86_64=1 -std=gnu99 -D_GNU_SOURCE -fomit-frame-pointer -fno-tree-vectorize -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8 -I. -I/build/xavs2-git/source -I/build/xavs2-git/source/common -I/build/xavs2-git/source/common/x86 -I/build/xavs2-git/source/common/vec -I/build/xavs2-git/source/encoder -I/build/xavs2-git/source/test -mmmx -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -msse4a -c -o encoder/parameters.o /build/xavs2-git/source/encoder/parameters.c
G:/MABS/build/xavs2-git/source/encoder/parameters.c: In function 'get_param_name':
G:/MABS/build/xavs2-git/source/encoder/parameters.c:447:18: warning: passing argument 1 of 'strtok' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  447 |     str = strtok(param_item, "_");
      |                  ^~~~~~~~~~
In file included from G:/MABS/build/xavs2-git/source/encoder/parameters.c:47:
G:/MABS/msys64/mingw64/include/string.h:97:44: note: expected 'char * restrict' but argument is of type 'const char *'
   97 |   char *__cdecl strtok(char * __restrict__ _Str,const char * __restrict__ _Delim) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
      |                        ~~~~~~~~~~~~~~~~~~~~^~~~
G:/MABS/build/xavs2-git/source/encoder/parameters.c: In function 'xavs2_encoder_opt_set':
G:/MABS/build/xavs2-git/source/encoder/parameters.c:632:45: error: passing argument 2 of 'xavs2_get_configs' from incompatible pointer type [-Wincompatible-pointer-types]
  632 |     if ((contents = xavs2_get_configs(argc, argv)) == NULL) {
      |                                             ^~~~
      |                                             |
      |                                             char **
G:/MABS/build/xavs2-git/source/encoder/parameters.c:531:62: note: expected 'const char * const*' but argument is of type 'char **'
  531 | static char *xavs2_get_configs(int argc, const char * const *argv)
      |                                          ~~~~~~~~~~~~~~~~~~~~^~~~
G:/MABS/build/xavs2-git/source/encoder/parameters.c:626:11: warning: unused variable 'map_index' [-Wunused-variable]
  626 |     int   map_index;
      |           ^~~~~~~~~
make: *** [Makefile:266: encoder/parameters.o] Error 1

To Reproduce

CPPFLAGS: 
CFLAGS: -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -mthreads
CXXFLAGS: -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1
LDFLAGS: -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++
make -j4 install

Expected behavior

Successful compilation.

Screenshots

logs.zip contains several probably useful log files collected by M-AB-S

Desktop (please complete the following information):

  • OS: Windows10, MSYS2/MinGW
  • Compiler: GCC 14.1
  • yasm 1.3.0-6

Additional context

m-ab-s/media-autobuild_suite#2677
https://raw.githubusercontent.com/mojie126/ma/main/patch/xavs2/0001_xavs2_encoder_parameters.patch

@dbermond
Copy link
Contributor

This is happening due to gcc 14 now defaulting to use -Werror=incompatible-pointer-types, which makes this warning to become an error. See porting to gcc 14 for details.

If you want to build xavs2 with gcc 14 before a fix from the developers arrives, add -Wno-incompatible-pointer-types to your CFLAGS environment variable.

@Jamaika1
Copy link

I see the discarded-qualifiers message.

parameters.c: In function 'get_param_name':
parameters.c:447:18: warning: passing argument 1 of 'strtok' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  447 |     str = strtok(param_item, "_");
      |                  ^~~~~~~~~~
In file included from parameters.c:47:
C:/gcc1500/x86_64-w64-mingw32/include/string.h:97:44: note: expected 'char * restrict' but argument is of type 'const char *'
   97 |   char *__cdecl strtok(char * __restrict__ _Str,const char * __restrict__ _Delim) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
      |                        ~~~~~~~~~~~~~~~~~~~~^~~~

Fix:
void get_param_name(char *name, char *param_item)

@Jamaika1
Copy link

parameters.c: In function 'xavs2_encoder_opt_set':
parameters.c:632:45: error: passing argument 2 of 'xavs2_get_configs' from incompatible pointer type [-Wincompatible-pointer-types]
  632 |     if ((contents = xavs2_get_configs(argc, argv)) == NULL) {
      |                                             ^~~~
      |                                             |
      |                                             char **
parameters.c:531:62: note: expected 'const char * const*' but argument is of type 'char **'
  531 | static char *xavs2_get_configs(int argc, const char * const *argv)
      |                                          ~~~~~~~~~~~~~~~~~~~~^~~~

Fix:
if ((contents = xavs2_get_configs(argc, (const char * const *)argv)) == NULL) {

@Jamaika1
Copy link

encoder.c:2041:56: error: passing argument 2 of 'xavs2_threadpool_run' from incompatible pointer type [-Wincompatible-pointer-types]
 2041 |         xavs2_threadpool_run(h->h_top->threadpool_aec, encoder_aec_encode_one_frame, h, 0);
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                        |
      |                                                        void * (*)(xavs2_t *)
In file included from wrapper.h:41,
                 from encoder.c:39:
threadpool.h:46:65: note: expected 'void * (*)(void *)' but argument is of type 'void * (*)(xavs2_t *)'
   46 | void  xavs2_threadpool_run   (xavs2_threadpool_t *pool, void *(*func)(void *), void *arg, int wait_sign);
      |                                                         ~~~~~~~~^~~~~~~~~~~~~

Fix:
xavs2_threadpool_run(h->h_top->threadpool_aec, (void * (*)(void *)) encoder_aec_encode_one_frame, h, 0);

@Jamaika1
Copy link

Why is there pthread here if there is not a single pthread function?

xlist.c:42:10: fatal error: pthread.h: No such file or directory
   42 | #include <pthread.h>
      |          ^~~~~~~~~~~

Fix:
#if !(defined(_MSC_VER) || defined(MINGW32))
#include <errno.h>
#include <pthread.h>
#endif

@LigH-de
Copy link
Author

LigH-de commented Jun 15, 2024

Would be lovely if you could pack all of your fixes into a Pull Request when complete...

@Jamaika1
Copy link

Adds pull links
#34
#35

Problem with non monotonically increasing dts
[out#0/avs2 @ 00000255e36fe850] Starting thread...
[avs2 @ 00000255e3a51ad0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8 >= 4
[avs2 @ 00000255e3a51ad0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8 >= 2
[avs2 @ 00000255e3a51ad0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8 >= 1
[avs2 @ 00000255e3a51ad0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8 >= 3
[avs2 @ 00000255e3a51ad0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8 >= 6
[avs2 @ 00000255e3a51ad0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8 >= 5
[avs2 @ 00000255e3a51ad0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 8 >= 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants