[ITK] [ITK-dev] cannot build itk with mingw32 (gcc4.8) on windows 7

Rashad M mohammedrashadkm at gmail.com
Sun Jun 22 07:04:49 EDT 2014


Hi all,

Compilation of ITK fails on Windows7 with mingw32 gcc4.8.  Error was when
building libopenjpeg thirdpary. please see the below log on command prompt.

[ 40%] Building C object
Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeFiles/itk
openjpeg.dir/openjpeg.c.obj
D:\sources\InsightToolkit-4.5.2\Modules\ThirdParty\OpenJPEG\src\openjpeg\openjpe
g.c:155:1: error: conflicting types for 'DllMain'
 DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
 ^
In file included from c:\mingw\include\windows.h:62:0,
                 from
D:\sources\InsightToolkit-4.5.2\Modules\ThirdParty\OpenJPE
G\src\openjpeg\openjpeg.c:29:
c:\mingw\include\winbase.h:1051:13: note: previous declaration of 'DllMain'
was
here
 BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID);
             ^
Modules\ThirdParty\OpenJPEG\src\openjpeg\CMakeFiles\itkopenjpeg.dir\build.make:3
45: recipe for target
'Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeFiles/itkop
enjpeg.dir/openjpeg.c.obj' failed
mingw32-make[2]: ***
[Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeFiles/itkope
njpeg.dir/openjpeg.c.obj] Error 1
CMakeFiles\Makefile2:3812: recipe for target
'Modules/ThirdParty/OpenJPEG/src/op
enjpeg/CMakeFiles/itkopenjpeg.dir/all' failed
mingw32-make[1]: ***
[Modules/ThirdParty/OpenJPEG/src/openjpeg/CMakeFiles/itkope
njpeg.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

This Dllmain conflict can be fixed by adding an ifdef guard for MingW32
along with OPJ_STATIC. Since the error is from thirdparty and must be fixed
in their upstream I am not sure about wheather ITK will be patching it in
the internal library. I can also confirm that this error is present in
trunk version of openjpeg[1].

[1] http://openjpeg.googlecode.com/svn/trunk/ openjpeg-read-only


-- 
Regards,
   Rashad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140622/ea94ca87/attachment.html>
-------------- next part --------------
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-developers


More information about the Community mailing list