|
Compiling Allegro 5 examples |
wanton
Member #15,527
March 2014
|
I am attempting to compile the default, unmodified, Allegro 5 examples using MinGW. I have extracted the latest precompiled Allegro build into C:\allegro and am trying to compile an example using the following command: gcc ex_winfull.c -o ex_winfull.exe -DPSAPI_VERSION=1 -DALLEGRO_STATICLINK -LC:\allegro\lib\ -IC:\allegro\include\ -lallegro-5.0.10-static-mt -lallegro_primitives-5.0.10-static-mt -lallegro_acodec-5.0.10-static-mt -lallegro_audio-5.0.10-static-mt -lallegro_color-5.0.10-static-mt -lallegro_dialog-5.0.10-static-mt -lallegro_font-5.0.10-static-mt -lallegro_image-5.0.10-static-mt -lallegro_memfile-5.0.10-static-mt -lallegro_physfs-5.0.10-static-mt -lallegro_ttf-5.0.10-static-mt -ldumb-0.9.3-static-mt -lFLAC-1.2.1-static-mt -lfreetype-2.4.8-static-mt -logg-1.2.1-static-mt -lopenal-1.14-static-mt -lvorbis-1.3.2-static-mt -lvorbisfile-1.3.2-static-mt -lmingw32 -lwinmm -lws2_32 -lopengl32 -lglu32 -lshlwapi -ld3d9 -ldxguid -lpsapi -lwinmm -lole32 -lcomdlg32 -lgdi32 -luser32 -mwindows -lkernel32 This is my output: C:\allegro\lib/liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display Attempting to compile any other examples gives more errors, so I want to compile this simple example first. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
wanton said: undefined reference to `__gxx_personality_v0' This usually means you are linking with a version of allegro compiled with a different version of mingw/gcc. You need the correct binaries for your compiler version. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
wanton
Member #15,527
March 2014
|
I have uninstalled, and installed MinGW 4.7.0 which is the latest, supported version of MinGW. I then downloaded and extracted the Windows Binary for MinGW 4.7.0 from the official download page (https://www.allegro.cc/files/) into C:\allegro. I then downloaded and extracted the examples from the same page. I then run the command from the first post and receive the exact same error. I am sure that I am using MinGW 4.7.0 with Windows Binary for MinGW 4.7.0 which should be compatible. What am I doing wrong and why is there no support for the latest MinGW? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
http://stackoverflow.com/questions/329059/what-is-gxx-personality-v0-for I didn't notice you were linking to the mt versions. When you link to the mt versions you need to statically link the c standard library in as well, because that is how they were compiled. So what you need to do is use the md versions and g++, or link statically to libstdc++ using --static-libstdc++. edit wanton said: What am I doing wrong and why is there no support for the latest MinGW? The latest MinGW compiles allegro just fine as far as I know. The person who provides the binaries probably just hasn't had time to implement the latest version of MinGW in his build system. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
wanton
Member #15,527
March 2014
|
Still getting much of the same: C:\allegro\examples>gcc ex_winfull.c -o ex_winfull.exe -DPSAPI_VERSION=1 -DALLEG Also, I would rather not stoop to using C++ thanks. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Just to see what is going on, try compiling with g++ and --static-libstdc++. I may be entirely mistaken, but I think I remember hearing there was a little c++ in allegro these days. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
wanton
Member #15,527
March 2014
|
Using g++, it gives no compile errors or warnings. g++ ex_winfull.c -o ex_winfull.exe -DPSAPI_VERSION=1 -DALLEGRO_STATICLINK -LC:\allegro\lib\ -IC:\allegro\include\ -lallegro-5.0.10-static-mt -lallegro_primitives-5.0.10-static-mt -lallegro_acodec-5.0.10-static-mt -lallegro_audio-5.0.10-static-mt -lallegro_color-5.0.10-static-mt -lallegro_dialog-5.0.10-static-mt -lallegro_font-5.0.10-static-mt -lallegro_image-5.0.10-static-mt -lallegro_memfile-5.0.10-static-mt -lallegro_physfs-5.0.10-static-mt -lallegro_ttf-5.0.10-static-mt -ldumb-0.9.3-static-mt -lFLAC-1.2.1-static-mt -lfreetype-2.4.8-static-mt -logg-1.2.1-static-mt -lopenal-1.14-static-mt -lvorbis-1.3.2-static-mt -lvorbisfile-1.3.2-static-mt -lmingw32 -lwinmm -lws2_32 -lopengl32 -lglu32 -lshlwapi -ld3d9 -ldxguid -lpsapi -lwinmm -lole32 -lcomdlg32 -lgdi32 -luser32 -mwindows -lkernel32 -static-libstdc++ However I can't run the compiled ex_winfull.exe binary. A window never shows up, and there is no task in task manager. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I'm guessing then that allegro was compiled with g++ or there is now c++ code in allegro. Yeah, there are now cpp source files for dsound and the primitives addon. So if you link to them then you need to link with g++. And try running your compiled example from a console. It should say something or pop up some dialog if things fail. And you need to compile and link common.c to your program as well since it has some functions you're using. You might have to check the processes tab to see if your program is still running or not. If it doesn't create a window it probably won't have a minimized icon. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
wanton
Member #15,527
March 2014
|
I tried running from CMD, no output whatsoever. As I said, no process shows up in task manager either. I didn't think linking to common.c was necessary because line 3 of ex_winfull.c is: #include "common.c" |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Yeah, you're right I mis-read. It's odd that there is no output at all because abort example uses the native dialog addon to pop up an error message if something goes wrong. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
wanton
Member #15,527
March 2014
|
So no one here knows how to compile the examples statically? |
pkrcel
Member #14,001
February 2012
|
SO far seems to me you've done it correcly (?) For the record, here's how my CMAKE builds it (I tested and it works but tells me that I need multple video adapters and aborts prematurely) C:\mingw64\bin\g++.exe -msse -W -Wall -Wpointer-arith -Os -DNDEBUG -mwindows -Wl,-subsystem,windows -Wl,--whole-archive CMakeFiles\ex_winfull.dir/objects.a -Wl,--no-whole-archive -o ex_winfull.exe -Wl,--out-implib,libex_winfull.dll.a -Wl,--major-image-version,0,--minor-image-version,0 ..\lib\liballegro-static.a ..\lib\liballegro_main-static.a ..\lib\liballegro_dialog-static.a ..\lib\liballegro-static.a -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lole32 -lwinmm -lpsapi -lshlwapi C:\Windows\System32\d3d9.dll C:\Windows\System32\dinput8.dll -lstdc++ -lglu32 -lopengl32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 It is unlikely that Google shares your distaste for capitalism. - Derezo |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Your best bet to compile the examples is when compiling allegro from source. Just use cd build cmake -G "Generator" -DWANT_EXAMPLES=On -DSHARED=Off -DCMAKE_BUILD_TYPE=Release -DWANT_MONOLITH=On -DWANT_DOCS=Off -DWANT_DEMOS=Off ..
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
wanton
Member #15,527
March 2014
|
Using your command gives me undefined reference to WinMain. EDIT: That was using pkrcel's command, I'll try compiling from source as a last resort. |
|