Summary: | Compilation of rasqal fails with error: redefinition of struct 'timezone' | ||
---|---|---|---|
Product: | kde-windows | Reporter: | dasaan.san |
Component: | buildsystem | Assignee: | KDE-Windows <kde-windows> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | dasaan.san, vonreth |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Microsoft Windows | ||
OS: | Microsoft Windows | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
patch against win32_rasqal_config.h to fix unguarded definition of timezone structure
patch against rasqal_expr_numerics.c to fix missing include of inttypes.h patch against rasqal_general.c to fix unnecessary defining of gettimeofday function |
Description
dasaan.san
2013-10-21 18:36:06 UTC
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 |