Whilst trying to emerge kdelibs rasqal fails to compile with the following output: ←[0m←[32mBuilding C object CMakeFiles/rasqal.dir/src/rasqal_algebra.c.obj ←[0m[ 2%] ←[32mBuilding C object CMakeFiles/rasqal.dir/src/rasqal_bindings.c.obj ←[0m←[32mBuilding C object CMakeFiles/rasqal.dir/src/rasqal_dataset.c.obj ←[0mIn file included from c:\kderoot\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.7/../../../../i686-w64-mingw32/include/sys/time.h:10, from C:/kdeRoot/build/win32libs/rasqal-0.9.26-20110726/work/mingw4-RelWithDebInfo-0.9.30/rasqal.h:116, from c:\kdeRoot\build\win32libs\rasqal-0.9.26-20110726\work\rasqal-0.9.30\src\rasqal_algebra.c:39: c:\kderoot\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.7/../../../../i686-w64-mingw32/include/time.h:260: error: redefinition of 'struct timezone' In file included from c:\kderoot\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.7/../../../../i686-w64-mingw32/include/sys/time.h:10, from C:/kdeRoot/build/win32libs/rasqal-0.9.26-20110726/work/mingw4-RelWithDebInfo-0.9.30/rasqal.h:116, from c:\kdeRoot\build\win32libs\rasqal-0.9.26-20110726\work\rasqal-0.9.30\src\rasqal_bindings.c:39: c:\kderoot\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.7/../../../../i686-w64-mingw32/include/time.h:260: error: redefinition of 'struct timezone' In file included from c:\kderoot\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.7/../../../../i686-w64-mingw32/include/sys/time.h:10, from C:/kdeRoot/build/win32libs/rasqal-0.9.26-20110726/work/mingw4-RelWithDebInfo-0.9.30/rasqal.h:116, from c:\kdeRoot\build\win32libs\rasqal-0.9.26-20110726\work\rasqal-0.9.30\src\rasqal_dataset.c:43: c:\kderoot\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.7/../../../../i686-w64-mingw32/include/time.h:260: error: redefinition of 'struct timezone' In file included from c:\kderoot\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.7/../../../../i686-w64-mingw32/include/sys/time.h:10, from C:/kdeRoot/build/win32libs/rasqal-0.9.26-20110726/work/mingw4-RelWithDebInfo-0.9.30/rasqal.h:116, from c:\kdeRoot\build\win32libs\rasqal-0.9.26-20110726\work\rasqal-0.9.30\src\rasqal_data_graph.c:40: c:\kderoot\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.7/../../../../i686-w64-mingw32/include/time.h:260: error: redefinition of 'struct timezone' jom: C:\kderoot\build\win32libs\rasqal-0.9.26-20110726\work\mingw4-RelWithDebInfo-0.9.30\CMakeFiles\rasqal.dir\build.make [CMakeFiles\rasqal.dir\src\rasqal_algebra.c.obj] Error 1 jom: C:\kderoot\build\win32libs\rasqal-0.9.26-20110726\work\mingw4-RelWithDebInfo-0.9.30\CMakeFiles\rasqal.dir\build.make [CMakeFiles\rasqal.dir\src\rasqal_bindings.c.obj] Error 1 jom: C:\kderoot\build\win32libs\rasqal-0.9.26-20110726\work\mingw4-RelWithDebInfo-0.9.30\CMakeFiles\rasqal.dir\build.make [CMakeFiles\rasqal.dir\src\rasqal_data_graph.c.obj] Error 1 jom: C:\kderoot\build\win32libs\rasqal-0.9.26-20110726\work\mingw4-RelWithDebInfo-0.9.30\CMakeFiles\rasqal.dir\build.make [CMakeFiles\rasqal.dir\src\rasqal_dataset.c.obj] Error 1 jom: C:\kderoot\build\win32libs\rasqal-0.9.26-20110726\work\mingw4-RelWithDebInfo-0.9.30\CMakeFiles\Makefile2 [CMakeFiles\rasqal.dir\all] Error 2 jom: C:\kderoot\build\win32libs\rasqal-0.9.26-20110726\work\mingw4-RelWithDebInfo-0.9.30\Makefile [all] Error 2 emerge fatal error: while running make cmd: c:\kderoot\dev-utils\bin\jom.exe emerge fatal error: running python c:\kderoot\emerge\portage\win32libs\rasqal\rasqal-0.9.26-20110726.py compile emerge debug: Task: Emerge stopped after: 0:00:49.740000 rasqal.h contains the following: #if 1 #include <sys/time.h> #endif #if 1 #include <time.h> #endif sys/time.h contains: #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ #define _TIMEZONE_DEFINED ... struct timezone { int tz_minuteswest; /* of Greenwich */ int tz_dsttime; /* type of dst correction to apply */ }; and time.h includes: #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ #define _TIMEZONE_DEFINED struct timezone { int tz_minuteswest; int tz_dsttime; }; it looks like the lines: #ifndef _TIMEZONE_DEFINED #define _TIMEZONE_DEFINED *should* protect against timezone getting defined twice but obviously they're failing for some reason Reproducible: Always Steps to Reproduce: 1. emerge kdelibs Actual Results: see fault details Expected Results: rasqal should compile successfully and then emerge should continue to compile the rest of kdelibs c:\kdeRoot>gcc -v Using built-in specs. Target: i686-w64-mingw32 Configured with: ../gcc44-svn/configure --host=i686-w64-mingw32 --target=i686-w64-mingw32 --disable-multilib --enable-checking=release --prefix=/mingw32 --with-sysroot=/mingw32 --enable-languages=c,c++,fortran,objc,obj-c++ --enable-libgomp --with-gmp=/mingw32 --with-mpfr=/mingw32 --disable-nls --disable-win32-registry Thread model: win32 gcc version 4.4.7 20111023 (prerelease) [svn/rev.180339 - mingw-w64/oz] (GCC)
After some more investigation I spotted that the timezone struct is being redefined in win32_rasqal_config.h (line 58). After wraping the declaration up with with: #ifndef _TIMEZONE_DEFINED #define _TIMEZONE_DEFINED ... #endif the compile process gets further but then fails with: [ 4%] Building C object CMakeFiles/rasqal.dir/src/rasqal_digest.c.obj In file included from c:\kdeRoot\build\win32libs\rasqal-0.9.26-20110726\work\rasqal-0.9.30\src\rasqal_decimal.c:41: c:\kderoot\mingw\bin\../lib/gcc/i686-w64-mingw32/4.4.7/../../../../i686-w64-mingw32/include/math.h:719: error: expected ';', ',' or ')' before '+' token jom: C:\kdeRoot\build\win32libs\rasqal-0.9.26-20110726\work\mingw4-RelWithDebInfo-0.9.30\CMakeFiles\rasqal.dir\build.make [CMakeFiles\rasqal.dir\src\rasqal_decimal.c.obj] Error 1 jom: C:\kdeRoot\build\win32libs\rasqal-0.9.26-20110726\work\mingw4-RelWithDebInfo-0.9.30\CMakeFiles\Makefile2 [CMakeFiles\rasqal.dir\all] Error 2 jom: C:\kdeRoot\build\win32libs\rasqal-0.9.26-20110726\work\mingw4-RelWithDebInfo-0.9.30\Makefile [all] Error 2 I'll keep looking at this to see if I can spot what's going on here before I submit a patch
I think I can see the problem, but I'm not so sure of the best way to fix it without breaking something else. rasqal_decimal.c pulls in win32_rasqal_config.h in line 29 rasqal_decimal.c then pulls in math.h in line 41 win32_rasqal_config.h, line 70: #define round(x) floor(x+0.5) math.h, line 719: extern double __cdecl round (double); some googling suggests that msvc is fine with this but mingw certainly isn't As a test, commenting the define out got the compile to proceed even further. This doesn't feel like the right solution as the define is there to fill in for a missing math.h file but something needs to be put in place so that the two don't clash. It makes me wonder how msvc is actually dealing with the situation, is it simply blocking the round macro from expanding out?
Inserting: #ifdef HAVE_INTTYPES_H #include <inttypes.h> #endif Into rasqal_expr_numerics.c at line: 28 will overcome the next hurdle. I'll put together some patches for the issues I'm confident about fixing later on.
Created attachment 83030 [details] patch against win32_rasqal_config.h to fix unguarded definition of timezone structure
Created attachment 83031 [details] patch against rasqal_expr_numerics.c to fix missing include of inttypes.h
Created attachment 83032 [details] patch against rasqal_general.c to fix unnecessary defining of gettimeofday function
The three patches, along with a fix for the redefining of round() should fix compilation with mingw. Hope that helps.
Hi thx for your patches I applied some of them and modified the timezone patch to use a cmake test. I only tested it with mingw 4.8.2 bu it should also work for your version and hopefully also for msvc. For questions or further contribution you could also join us on irc in #kde-windows Cheers http://quickgit.kde.org/?p=emerge.git&a=commit&h=cffdf0eb0b8ed8f65c640ba33db03b8f7970a6f0