Opened 2 months ago

Last modified 3 days ago

#2350 open defect

(MSYS2, MinGW, GCC) build error: redefinition of 'struct pollfd' etc. in libavformat/3dostr.c

Reported by: LigH Owned by: reimar
Priority: normal Component: build system
Version: HEAD Severity: blocker
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

Summary of the bug: build error: redefinition of 'struct pollfd' and many more in libavformat/3dostr.c

How to reproduce:
Trying to build using media-autobuild_suite

MSYS2, MinGW32 + GCC 7.3.0 or MinGW64 + GCC 8.3.0

CFLAGS: -mthreads -mtune=generic -O2 -pipe
LDFLAGS: -pipe -static-libgcc -static-libstdc++
make install

...
CC	libavfilter/avfilter.o
In file included from libavformat/internal.h:28:0,
                 from libavformat/3dostr.c:23:
libavformat/os_support.h:115:8: error: redefinition of 'struct pollfd'
 struct pollfd {
        ^~~~~~
In file included from libavformat/os_support.h:112:0,
                 from libavformat/internal.h:28,
                 from libavformat/3dostr.c:23:
H:/development/media-autobuild_suite-master/msys64/mingw32/i686-w64-mingw32/include/winsock2.h:1155:16: note: originally defined here
 typedef struct pollfd {
                ^~~~~~
In file included from libavformat/internal.h:28:0,
                 from libavformat/3dostr.c:23:
libavformat/os_support.h:122:0: warning: "POLLIN" redefined
 #define POLLIN     0x0001  /* any readable data available */
 
In file included from libavformat/os_support.h:112:0,
                 from libavformat/internal.h:28,
                 from libavformat/3dostr.c:23:
H:/development/media-autobuild_suite-master/msys64/mingw32/i686-w64-mingw32/include/winsock2.h:1144:0: note: this is the location of the previous definition
 #define POLLIN    (POLLRDNORM | POLLRDBAND)
 
In file included from libavformat/internal.h:28:0,
                 from libavformat/3dostr.c:23:
libavformat/os_support.h:123:0: warning: "POLLOUT" redefined
 #define POLLOUT    0x0002  /* file descriptor is writeable */
 
In file included from libavformat/os_support.h:112:0,
                 from libavformat/internal.h:28,
                 from libavformat/3dostr.c:23:
H:/development/media-autobuild_suite-master/msys64/mingw32/i686-w64-mingw32/include/winsock2.h:1148:0: note: this is the location of the previous definition
 #define POLLOUT   (POLLWRNORM)
...

Attachments (1)

logs.zip (55.6 KB) - added by LigH 2 months ago.
log files generated by media-autobuild_suite, MinGW64 compile

Download all attachments as: .zip

Change History (10)

Changed 2 months ago by LigH

log files generated by media-autobuild_suite, MinGW64 compile

comment:1 Changed 8 weeks ago by LigH

I guess a part of the reason may be that config.h contains

#define HAVE_STRUCT_POLLFD 0

but it still includes winsock2.h which makes os_support.h redefine it accidently.

comment:2 Changed 5 weeks ago by LigH

I got sent a theory:

»In winsock2.h the pollfd is defined inside #if (_WIN32_WINNT>=0x0600)
For me it (/usr/share/mingw-w64/include/_mingw.h) is _WIN32_WINNT=0x502. I guess it's 0x0600 or higher for you. So... patch mingw header, or add -D_WIN32_WINNT=0x502 to --extra-cflags='...'. Or fix mplayer's ./configure to actually check if pollfd is defined by <winsock2.h>.«

comment:3 Changed 4 weeks ago by beastd

Hi,

is it possible for you to try to compile MPlayer without media-autobuild_suite?

We can't support third-party build tools here, but if we can reproduce this without media-autobuild_suite, we will look into it.

comment:4 Changed 4 weeks ago by LigH

Hi. I can run commands in an interactive shell. But I don't know much about the commands I would have to execute, so I may need verbose instructions.

The suite doesn't do much more than pre-building and installing all the libraries to be linked later, then configuring its primary target, the meta tools (foremost ffmpeg, but also mplayer if desired), to link the desired selection of libraries, and eventually call the make process. No magic, only batch. AFAICS, it does not even add custom diff patches to the building of mplayer.

So if you agree that mplayer is possibly well-configured (according to the log files you can inspect), then tell me the parameters to make it in a way that valuable logs for you are produced, and I will do it in an interactive shell.

But if you also need me to start with a custom kind of configuration, the required amount of instructions will probably get a lot longer...

I already tried to run a default configuration and build with instructions from debianuser in the IRC channel #mplayerdev - with the same results. He gave me the theory in the previous reply.

comment:5 Changed 2 weeks ago by LigH

Are you still interested in my cooperation?

If yes, please give instructions; I am.

comment:6 Changed 12 days ago by reimar

I haven't pushed it yet as more thorough testing would be good, but I expect http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2018-November/073746.html should fix it.

comment:7 Changed 10 days ago by LigH

Confirming patch, can be applied in media-autobuild_suite, building finishes. Hope it will be pushed.

comment:8 Changed 5 days ago by beastd

  • Owner changed from beastd to reimar
  • Status changed from new to open

comment:9 Changed 3 days ago by beastd

Did some quick build testing:

  • I tested the patch on my MSYS2 setup, it still builds fine.
  • A build on Ubuntu also worked as expected.
Note: See TracTickets for help on using tickets.