Opened 6 years ago

Closed 6 years ago

#2350 closed defect (fixed)

(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 6 years ago.
log files generated by media-autobuild_suite, MinGW64 compile

Download all attachments as: .zip

Change History (11)

by LigH, 6 years ago

Attachment: logs.zip added

log files generated by media-autobuild_suite, MinGW64 compile

comment:1 by LigH, 6 years ago

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 by LigH, 6 years ago

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 by beastd, 6 years ago

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 by LigH, 6 years ago

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 by LigH, 6 years ago

Are you still interested in my cooperation?

If yes, please give instructions; I am.

comment:6 by reimar, 6 years ago

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 by LigH, 6 years ago

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

comment:8 by beastd, 6 years ago

Owner: changed from beastd to reimar
Status: newopen

comment:9 by beastd, 6 years ago

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.

comment:10 by beastd, 6 years ago

Resolution: fixed
Status: openclosed

Patch was committed by Reimar as MPlayer SVN r38118

Seems it was forgotten to close this bug.

Note: See TracTickets for help on using tickets.