Build error and patch(s) for Allegro 4.4.X from git
Edgar Reynaldo

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

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.

Thomas Fjellstrom

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.

SiegeLord

Yeah, I added the patch that does that.

Edgar Reynaldo

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

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.

Edgar Reynaldo

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

::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?

Edgar Reynaldo

Latest git with a clean build compiles and links fine. No probs with dat.exe or anything else. All shared addon libraries built successfully. MinGW 4.8.1, Vista

Thread #614953. Printed from Allegro.cc