Compiling VLC with cegcc : redefinition of 'struct fd_set'

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
junkie_crew
Blank Cone
Blank Cone
Posts: 35
Joined: 31 Jul 2007 15:28

Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby junkie_crew » 01 Oct 2007 10:40

Hi,

I am trying to compile VLC for WinCE with cegcc. I have got all the libs and contrib and I read somewhere that cegcc was the appriopriate compiler to compile the 0.8.6c version of VLC.

But this error occurs, and I cannot find how to solve it...
gcc -mcpu=xscale -DHAVE_CONFIG_H -I. -I. -I.. -D_OFF_T_ -D_off_t=long -DSYS_MINGWCE -I../include `top_builddir=".." ../vlc-config --cflags vlc pic` -Wsign-compare -Wall -D__stdcall= -D_OFF_T_ -DWIN32 -DUNDER_CE -D__VLC__ -I/opt/cegcc/arm-wince-cegcc/include -pipe -c -o stream_output/libvlc_a-sap.o `test -f 'stream_output/sap.c' || echo './'`stream_output/sap.c
<command line>:1:1: warning: "__stdcall" redefined
<built-in>: warning: this is the location of the previous definitionIn file included from stream_output/sap.c:30:
/opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:65: error: redefinition of 'struct fd_set'
/opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:366: error: redefinition of 'struct sockaddr'
The problem seems to come from several headers dependencies, and I do not know what to change to avoid such problems. maybe I also forgot to define some switches.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby Jean-Baptiste Kempf » 01 Oct 2007 11:02

Yes, that can happen, you have to check where it has been included two times...
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

junkie_crew
Blank Cone
Blank Cone
Posts: 35
Joined: 31 Jul 2007 15:28

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby junkie_crew » 01 Oct 2007 13:24

Just one question. How do I find which included header causes the redefinition ? I am quite sure that it comes from sys/types.h, but I cannot find in which file it is called...

Thanks !

junkie_crew
Blank Cone
Blank Cone
Posts: 35
Joined: 31 Jul 2007 15:28

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby junkie_crew » 01 Oct 2007 15:52

As I could not found where the definition was called twice, I have put the header winsock2.h at the beginning of the sap.c file. The previous error disapeared, but I have got a new one...
gcc -mcpu=xscale -DHAVE_CONFIG_H -I. -I. -I.. -D_OFF_T_ -D_off_t=long -DSYS_MINGWCE -I../include `top_builddir=".." ../vlc-config --cflags vlc pic` -Wsign-compare -Wall -D__stdcall= -D_OFF_T_ -D__CEGCC__ -D_WIN32_WCE -DUNDER_CE -I/opt/cegcc/arm-wince-cegcc/include -pipe -c -o stream_output/libvlc_a-sap.o `test -f 'stream_output/sap.c' || echo './'`stream_output/sap.c
<command line>:1:1: warning: "__stdcall" redefined
<built-in>: warning: this is the location of the previous definition
stream_output/sap.c: In function 'announce_SAPAnnounceAdd':
stream_output/sap.c:282: error: 'struct sockaddr_storage' has no member named 'sa_family'
stream_output/sap.c:353: error: 'struct sockaddr_storage' has no member named 'sa_family'
I do not know if what I have done is dead-ended, or if I must try to solve this on to go further...

Actually, I am unable to solve this one as well :(

Thanks for your help !

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby Jean-Baptiste Kempf » 01 Oct 2007 16:42

You shouldn't compile those parts on a portable device, I think. So you shouldn't build stream_output --disable-sout --disable-sap.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

junkie_crew
Blank Cone
Blank Cone
Posts: 35
Joined: 31 Jul 2007 15:28

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby junkie_crew » 01 Oct 2007 17:13

My configure is the one following :
./configure --host=arm-wince-pe --target=arm-wince-pe --build=i686-linux --prefix=/usr/local/wince --includedir=/opt/cegcc/arm-wince-cegcc/include --includedir=/home/giraulte/vlc-0.8.6c/include --disable-sdl --disable-gtk --disable-dvdnav --disable-dvdread --disable-nls --disable-sout --disable-sap --disable-vlm --disable-wxwindows --disable-a52 --disable-libmpeg2 --disable-freetype --disable-fribidi --disable-mad --disable-plugins --enable-optimize-memory --enable-tremor --disable-faad --disable-ffmpeg --disable-gnomevfs --enable-shared-libvlc
But the --disable-sap option does not seem to be considered, because the compiler still tries to compile sap.c, which causes the errors... Is there an other way to disable this part of compiling ?

junkie_crew
Blank Cone
Blank Cone
Posts: 35
Joined: 31 Jul 2007 15:28

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby junkie_crew » 02 Oct 2007 10:53

The problem is that even if I manage not to compile the stream_output plugin, I will have the same error compiling win32_specific.c

It seems that the problem comes from the include of sys/types.h somewhere. And I think both headers (winsock[2].h and types.h) are necessary to compile those files. So I need to change something to the definition way of struct fd_set...

Any ideas ?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby Jean-Baptiste Kempf » 02 Oct 2007 12:37

No idea, I need to test it myself. But yes, some parts shouldn't be included twice.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

junkie_crew
Blank Cone
Blank Cone
Posts: 35
Joined: 31 Jul 2007 15:28

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby junkie_crew » 02 Oct 2007 14:42

I managed to pass through these problems, I hope what I have done is right :

First of all, to avoid the problem in sap.c, I added the preprocessor definition __USE_W32_SOCKETS to the compiling command.

Then, I faced other errors :

In file network.h, I took the definitions of the WIN_32 switch, as following :

Code: Select all

#if defined( WIN32 ) || defined(UNDER_CE) # if defined(UNDER_CE) && defined(sockaddr_storage) # undef sockaddr_storage # endif # if defined(UNDER_CE) # define HAVE_STRUCT_ADDRINFO # else # include <io.h> # endif # include <winsock2.h> # include <ws2tcpip.h> # define ENETUNREACH WSAENETUNREACH # define net_errno (WSAGetLastError()) #else # if HAVE_SYS_SOCKET_H # include <sys/socket.h> # endif # if HAVE_NETINET_IN_H # include <netinet/in.h> # endif # if HAVE_ARPA_INET_H # include <arpa/inet.h> # elif defined( SYS_BEOS ) # include <net/netdb.h> # endif # include <netdb.h> # define net_errno errno # define net_strerror strerror #endif
And in file getaddrinfo.c, I changed the call of other headers, which were the source of several redefinition errors :

Code: Select all

#if !defined(UNDER_CE) #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif*/ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif*/ #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif #endif

luyv
New Cone
New Cone
Posts: 5
Joined: 09 Oct 2007 08:56

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby luyv » 10 Oct 2007 08:42

Hi,
I also try to use Cegcc to compile VLC for WinCE. My configure is the same as jukie_crew, and referencing to jukie_crew's solution, I have added the prepocessor definition __USE_W32_SOCKETS to the compiling command.But I still get the error like follows:

Code: Select all

if gcc -mcpu=xscale -DHAVE_CONFIG_H -I. -I. -I.. -D_OFF_T_ -D_off_t=long -DSYS_MINGWCE -I../include `top_builddir=".." ../vlc-config --cflags vlc pic` -Wsign-compare -Wall -I/opt/cegcc/arm-wince-cegcc/include -I/usr/local/wince/contrib-xscale/include -pipe -MT stream_output/libvlc_a-sap.o -MD -MP -MF "stream_output/.deps/libvlc_a-sap.Tpo" \ -c -o stream_output/libvlc_a-sap.o `test -f 'stream_output/sap.c' || echo './'`stream_output/sap.c; \ then mv -f "stream_output/.deps/libvlc_a-sap.Tpo" "stream_output/.deps/libvlc_a-sap.Po"; \ else rm -f "stream_output/.deps/libvlc_a-sap.Tpo"; exit 1; \ fi In file included from ../include/network.h:39, from stream_output/sap.c:37: /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:66: error: redefinition of 'struct fd_set'
Can somebody help me out? Thanks!

luyv
New Cone
New Cone
Posts: 5
Joined: 09 Oct 2007 08:56

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby luyv » 10 Oct 2007 08:51

And I have checked sys/types.h,

Code: Select all

# if !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS) || defined (UNDER_CE)) # define _SYS_TYPES_FD_SET # define NBBY 8 /* number of bits in a byte */ /* * Select uses bit masks of file descriptors in longs. * These macros manipulate such bit fields (the filesystem macros use chars). * FD_SETSIZE may be defined by the user, but the default here * should be >= NOFILE (param.h). */ # ifndef FD_SETSIZE # define FD_SETSIZE 64 # endif typedef long fd_mask; # define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ # ifndef howmany # define howmany(x,y) (((x)+((y)-1))/(y)) # endif /* We use a macro for fd_set so that including Sockets.h afterwards can work. */ typedef struct _types_fd_set { fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; } _types_fd_set; #define fd_set _types_fd_set # define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) # define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) # define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) # define FD_ZERO(p) (__extension__ (void)({ \ size_t __i; \ char *__tmp = (char *)p; \ for (__i = 0; __i < sizeof (*(p)); ++__i) \ *__tmp++ = 0; \ })) # endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) */
I notice that when __USE_W32_SOCKETS or UNDER_CE is predefined ,the definition of 'fd_set' here works! So it will be a redefinition because 'fd_set' definition in winsock2.h. I am a little confused. Which definition of 'fd_set' should I use, in types.h or winsock2.h? Can somebody give me some hint? Thanks a lot!

junkie_crew
Blank Cone
Blank Cone
Posts: 35
Joined: 31 Jul 2007 15:28

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby junkie_crew » 10 Oct 2007 10:52

I have not finished to compile it yet, but as I said I decided not to include the types.h file and it goes through this...

I can give you all the preprocessor definition I use to compile mine, it could help :

Here are my environment settings :
setenv CFLAGS "-D__stdcall= -D_OFF_T_ -D__USE_W32_SOCKETS -D__CEGCC__ -D_WIN32_WCE -DUNDER_CE -D_UNICODE -I/opt/cegcc/arm-wince-cegcc/include"
setenv CXXFLAGS "-D__stdcall= -D_OFF_T_ -D__USE_W32_SOCKETS -D__CEGCC__ -D_WIN32_WCE -DUNDER_CE -D_UNICODE -D__cplusplus -I/opt/cegcc/arm-wince-cegcc/include -I/opt/cegcc/include/c++/4.1.0/"
setenv LD_LIBRARY_PATH /opt/cegcc/arm-wince-cegcc/lib:$LD_LIBRARY_PATH
setenv PATH /opt/cegcc/bin:$PATH
setenv PATH /opt/cegcc/arm-wince-cegcc/bin:$PATH
setenv LDFLAGS "-L/opt/cegcc/arm-wince-cegcc"
setenv "$LDFLAGS -L/opt/cegcc/arm-wince-cegcc"
setenv CC "gcc -mcpu=xscale"
setenv WINDRES "arm-wince-cegcc-windres"

luyv
New Cone
New Cone
Posts: 5
Joined: 09 Oct 2007 08:56

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby luyv » 11 Oct 2007 06:32

Thank you junkie_crew! Your advice did help! I comment the 'fd_set' definition in sys/type.h, and comment
# include <sys/type.h>
in sys/wcesocktypes.h, but then I get these errors:

Code: Select all

In file included from /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/include/netinet/in.h:212, from /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/include/arpa/inet.h:23, from network/getaddrinfo.c:37: /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/include/bits/socket.h:163: error: redefinition of 'struct sockaddr' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:136: error: redefinition of 'struct linger' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:232: error: redefinition of 'struct in_addr' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:263: error: redefinition of 'struct sockaddr_in' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:352: error: redefinition of 'struct sockaddr' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:560: error: conflicting types for 'inet_addr' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/include/arpa/inet.h:35: error: previous declaration of 'inet_addr' was here /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:644: error: expected identifier or '(' before '__extension__' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:645: error: expected identifier or '(' before '__extension__' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:646: error: expected identifier or '(' before '__extension__' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/winsock2.h:647: error: expected identifier or '(' before '__extension__' In file included from ../include/network.h:40, from network/getaddrinfo.c:47: /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/ws2tcpip.h:124: error: redefinition of 'struct ip_mreq' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/ws2tcpip.h:147: error: redefinition of 'struct in_pktinfo' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/ws2tcpip.h:164: error: redefinition of 'struct in6_addr' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/ws2tcpip.h:185: error: redefinition of 'struct sockaddr_in6' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/ws2tcpip.h:272: error: conflicting types for 'socklen_t' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/include/bits/socket.h:36: error: previous declaration of 'socklen_t' was here /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/ws2tcpip.h:274: error: redefinition of 'struct ipv6_mreq' /opt/cegcc/lib/gcc/arm-wince-cegcc/4.1.0/../../../../arm-wince-cegcc/lib/../include/w32api/ws2tcpip.h:280: error: redefinition of 'struct in6_pktinfo' In file included from network/getaddrinfo.c:47: ../include/network.h:41:1: warning: "ENETUNREACH" redefined
There are so many redefinition here, and they are redefined in or conflict with different files, which drive me crazy. Any suggestions? Thank you so much!

junkie_crew
Blank Cone
Blank Cone
Posts: 35
Joined: 31 Jul 2007 15:28

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby junkie_crew » 11 Oct 2007 10:08

My advice would be to use a software like SourceNavigator to browse your source code. Thanks to this tool, you will be able to understand the header's inclusion tree. There are some headers file which include others and indeed, it can drive craizy ;)
But with redefinition the problem often comes from files like winsock.h and winsock2.h.

Just try to find where those types/structures are defined and then add some compiling switches to avoid them. As soon as I manage to compile the whole vlc source code, I will post it somwhere on the wiki...

Good luck !

luyv
New Cone
New Cone
Posts: 5
Joined: 09 Oct 2007 08:56

Re: Compiling VLC with cegcc : redefinition of 'struct fd_set'

Postby luyv » 11 Oct 2007 10:24

Thanks for junkie_crew's suggestion, I'll try to get clear understanding of their dependencies. :roll:


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 54 guests