|
From: Ulrich K. <ul...@ch...> - 2013-01-13 10:57:54
|
Finally got around to read this not-too-recent thread ... Motiejus Jak?tys <des...@gm...>: > Reason: it did not compile on mingw32 4.2.1: > [ 1%] Building C object src/CMakeFiles/libsox.dir/formats_i.obj > In file included from > /home/motiejus/code/stuff/sox/src/formats_i.c:23: > /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/sys/stat.h:122: error: redefinition of ?struct > _stati64? > make[2]: *** [src/CMakeFiles/libsox.dir/formats_i.obj] Error 1 > make[1]: *** [src/CMakeFiles/libsox.dir/all] Error 2 > make: *** [all] Error 2 > The way I see it is that on _certain_ systems (those that have _stati64 > defined), the following snippet of util.h takes effect > #ifdef _stati64 > #define stat _stati64 > #else > #define stat _stat > #fi I found a hint on the mythtv-dev mailing list how this may cause the double definition of struct _stati64: When the #define is in effect, the preprocessor turns a definition of "struct stat" into a (second) definition of "struct _stati64". It certainly looks from http://paste.ubuntu.com/1256655/ like this is the case. However ... Jan Stary <ha...@st...>: > On Oct 02 15:48:14, des...@gm... wrote: > > So as far as I see it includes "util.h" _before_ <sys/stat.h>. At > least > in formats_i.c. > Then again, "util.h" itself includes <sys/stat.h> at the top. ... this is true, so I didn't understand at first either how this could cause the problem. But then I noticed that the include in util.h is conditional: It only includes sys/stat.h if HAVE_SYS_STAT_H is set. And it seems we don't check for sys/stat.h at all when using cmake, but only when using the GNU build system. Motiejus, could you verify that this is indeed the problem? I've prepared a small patch, but you could also simply remove the #ifdef around the include in util.h. Ulrich |