Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fails on Windows with mingw32 gcc4.8 #361

Closed
gcode-importer opened this issue Jun 22, 2014 · 6 comments
Closed

Compilation fails on Windows with mingw32 gcc4.8 #361

gcode-importer opened this issue Jun 22, 2014 · 6 comments

Comments

@gcode-importer
Copy link

Originally reported on Google Code with ID 361

What steps will reproduce the problem?
1. svn checkout http://openjpeg.googlecode.com/svn/trunk/ openjpeg-read-only

2. run cmake-gui (all defaults but select mingw gcc compiler (4.8) 
3. mingw32-make on command prompt

What is the expected output? What do you see instead?
expected: clean build

[ 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

What version of the product are you using? On what operating system?


Please provide any additional information below.

Windows 7 64bit 
MingW32 gcc 4.8
cmake 2.8.12

Reported by mohammedrashadkm on 2014-06-22 11:08:43

@gcode-importer
Copy link
Author

The issue report mention checking out openjpeg from svn , but the bug report contains
code from third party app: ITK.

You need to check directly with ITK people about there custom version of openjpeg.
Our openjpeg compiles with mingw (w32 & w64).

Reported by malaterre on 2014-06-23 07:25:21

  • Status changed: Invalid

@gcode-importer
Copy link
Author

Hi Mathieu,

I also check out sources from this svn and got the same error. I can post that error
message also.

Reported by mohammedrashadkm on 2014-06-23 07:29:04

@gcode-importer
Copy link
Author

Post the correct compilation output, please.

Reported by malaterre on 2014-06-23 07:34:39

  • Status changed: Accepted

@gcode-importer
Copy link
Author

Using version.2.1 from svn with default cmake options I get:

C:\Users\jf\delmoi\openjpeg-build>mingw32-make
Scanning dependencies of target openjp2
[  2%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/bio.c.obj
[  5%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/cio.c.obj
[  8%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/dwt.c.obj
[ 11%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/event.c.obj
[ 14%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/image.c.obj
[ 17%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/invert.c.obj
[ 20%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/j2k.c.obj
[ 22%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/jp2.c.obj
[ 25%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/mct.c.obj
[ 28%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/mqc.c.obj
[ 31%] Building C object src/lib/openjp2/CMakeFiles/openjp2.dir/openjpeg.c.obj
C:\Users\jf\delmoi\openjpeg-read-only\src\lib\openjp2\openjpeg.c:135: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 C:\Users\jf\delmoi\openjpeg-read-only\src\lib\openjp2\openjpeg.c:35:
c:\mingw\include\winbase.h:1051:13: note: previous declaration of 'DllMain' was here
 BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID);
             ^
src\lib\openjp2\CMakeFiles\openjp2.dir\build.make:294: recipe for target 'src/lib/openjp2/CMakeFiles/openjp2.dir/openjpeg.c.obj'
failed
mingw32-make[2]: *** [src/lib/openjp2/CMakeFiles/openjp2.dir/openjpeg.c.obj] Error
1
CMakeFiles\Makefile2:91: recipe for target 'src/lib/openjp2/CMakeFiles/openjp2.dir/all'
failed
mingw32-make[1]: *** [src/lib/openjp2/CMakeFiles/openjp2.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
mingw32-make: *** [all] Error 2




Replacing openjpeg.c:135 with 
  DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
instead of the original
  DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {

seemed to solve this issue with mingw gcc 4.8.1

Reported by jf.pambrun on 2014-06-25 14:16:28

@gcode-importer
Copy link
Author

Another workaround if to add an ifndef guard for mingw

#if !defined(OPJ_STATIC) && !defined(__MINGW32__)

Reported by mohammedrashadkm on 2014-06-25 14:38:16

@gcode-importer
Copy link
Author

This issue was closed by revision r2878.

Reported by detonin on 2014-09-16 15:38:18

  • Status changed: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants