Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Build error and patch(s) for Allegro 4.4.X from git

Credits go to SiegeLord and Thomas Fjellstrom for helping out!
This thread is locked; no one can reply to it. rss feed Print
Build error and patch(s) for Allegro 4.4.X from git
Edgar Reynaldo
Major Reynaldo
May 2007
avatar

wsystem.c fails to build with an error about conflicting types for the DllMain function. wsystem.c defines one, and so does winbase.h. I don't know which is correct so I don't know how to patch this. Anyone know?

c:\mingw\LIBS\Alleg44X_git\allegro\build>mingw32-make install
[  1%] Building C object CMakeFiles/allegro.dir/src/win/wsystem.c.obj
C:\mingw\LIBS\Alleg44X_git\allegro\src\win\wsystem.c:35:15: error: conflicting types for 'DllMain'
 BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason, LPVOID lpReserved)
               ^
In file included from C:/mingw/include/windows.h:62:0,
                 from C:/mingw/LIBS/Alleg44X_git/allegro/include/winalleg.h:54,
                 from C:/mingw/LIBS/Alleg44X_git/allegro/include/allegro/platform/aintwin.h:31,
                 from C:\mingw\LIBS\Alleg44X_git\allegro\src\win\wsystem.c:27:
C:/mingw/include/winbase.h:1051:13: note: previous declaration of 'DllMain' was here
 BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID);
             ^
CMakeFiles\allegro.dir\build.make:3072: recipe for target 'CMakeFiles/allegro.dir/src/win/wsystem.c.obj' failed
mingw32-make[2]: *** [CMakeFiles/allegro.dir/src/win/wsystem.c.obj] Error 1
CMakeFiles\Makefile2:62: recipe for target 'CMakeFiles/allegro.dir/all' failed
mingw32-make[1]: *** [CMakeFiles/allegro.dir/all] Error 2
Makefile:105: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

c:\mingw\LIBS\Alleg44X_git\allegro\build>

Also, here is a patch to enable building of the addons as shared libraries :

#SelectExpand
1--- CMakeLists.old.txt 2015-01-03 16:35:21.895331800 -0600 2+++ CMakeLists.txt 2015-01-03 16:35:51.803573800 -0600 3@@ -918,12 +918,17 @@ 4 option(WANT_LOGG "Enable logg" on) 5 option(WANT_JPGALLEG "Enable JPGAlleg" on) 6 7-if(WANT_FRAMEWORKS) 8+if (BUILD_SHARED_LIBS) 9 set(ADDON_LINKAGE SHARED) 10 else() 11 set(ADDON_LINKAGE STATIC) 12 endif() 13 14+if(WANT_FRAMEWORKS) 15+ set(ADDON_LINKAGE SHARED) 16+endif() 17+ 18+ 19 if(WANT_ALLEGROGL) 20 add_subdirectory(addons/allegrogl) 21 endif()

SiegeLord
Member #7,827
October 2006
avatar

The comment about DLL main says that it's necessary for DMC. I and most people couldn't care less what builds on DMC, so could you just test if removing it fixes the issue for you? Make sure it all still links and runs etc. Specifically, try the attached patch.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Thomas Fjellstrom
Member #476
June 2000
avatar

Removing it is a good test, but if its dead simple to keep the compatibility, say an ifdef DMC or just make the decl the same as windows's then it would be best to do that. imo.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

SiegeLord
Member #7,827
October 2006
avatar

Yeah, I added the patch that does that.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Everything builds with the patch, static or dynamic, but I'm getting a bunch of weird errors - "Warning: corrupt .drectve at end of def file". It appears 4 times in a row for each executable linked. A static release build did that anyway, maybe others too.

SiegeLord
Member #7,827
October 2006
avatar

That's a bit worrying, but I think it might be an issue with your MinGW setup (judging by my quick searches on the internets). I'll look into on my MinGW and see if I get this. Never thought I'd be compiling Allegro 4 on Windows in 2015 :P.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I'm sure it's probably something I did or have left over somewhere that is doing it. It's troubling there is no uninstall target, or is there? I can't remember. Because I don't want an already pre-installed version of allegro to interfere with the compilation of the newer version (already hit that one once).

SiegeLord
Member #7,827
October 2006
avatar

::sigh:: I can't seem to manage to build it. For whatever reason dat.exe is not linking (the linking order is wrong).

Actually... the reason it's not building is because of the shared addons... can you verify that it actually builds with SHARED=on with a clean build directory?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: