Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Installing 4.9.3 on Windows using MinGW

This thread is locked; no one can reply to it. rss feed Print
Installing 4.9.3 on Windows using MinGW
wiseguy
Member #44
April 2000
avatar

I had a lot of trouble getting 4.9.3 to compile, so I thought I would post this to let everyone else who wants to try it know how I got things to work.

First, I had to download the technology preview version of MinGW to get gcc 4, because I still haven't been able to successfully build all of the shared library under windows. Here are the files I got, but you may not need them all:

gcc-core-4.2.1-sjlj-2.tar.gz
gcc-g++-4.2.1-sjlj-2.tar.gz
libgcc_sjlj_1.dll.gz
binutils-2.18.50-20080109-2.tar.gz
mingw32-make-3.81-20080326-2.tar.gz
gdb-6.8-mingw-3.tar.bz2
w32api-3.11.tar.gz
mingw-runtime-3.14.tar.gz
mingw-utils-0.3.tar.gz

If you download the MinGW 5.1.4 installer that will only install gcc 3.4.5, so you will need to manually download these and extract them into a MinGW directory. Don't forget to change your MINGDIR variable and the path to MinGW/bin. You then have to go into the MinGW/bin directory and remove the -sjlj from all of the exe files.

Next you'll need CMake. You can get version 2.4 from
here.

You'll also need the DirectX 9 header files and libraries, which can be found
here.

Extract the allegro-4.9.3 sources to a directory and open up a command prompt window. Make sure gcc works by typing gcc -v. You should see this:

Quote:

D:\PROGRA~1\allegro5\allegro>gcc -v
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.2.1-2-src/configure --with-gcc --enable-libgomp --host
=mingw32 --build=mingw32 --target=mingw32 --program-suffix=-sjlj --with-arch=i48
6 --with-tune=generic --disable-werror --prefix=/mingw --with-local-prefix=/ming
w --enable-threads --disable-nls --enable-languages=c,c++,fortran,objc,obj-c++,a
da --disable-win32-registry --enable-sjlj-exceptions --enable-libstdcxx-debug --
enable-cxx-flags=-fno-function-sections -fno-data-sections --enable-version-spec
ific-runtime-libs --disable-bootstrap
Thread model: win32
gcc version 4.2.1-sjlj (mingw32-2)

It's a good idea to make a build directory. Go to your allegro directory, and type this:

md build
cd build
cmake .. -G "MinGW Makefiles" -DSHARED=off

once cmake finishes, type mingw32-make and wait...

If everything went right, when it's done compiling just type mingw32-make install

Now you've got a working Allegro 4.9.3 installation. To use it, you need to
#include <allegro5/allegro.h>

and link with these libraries:

-lalleg_s-4.9.3 -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lole32 -ldinput -lddraw -ldxguid -lwinmm -ldsound -ld3d9 -lopengl32

Hopefully that all works. If you used the build directory, you'll have to run the examples from inside the directory where the .c files are, or they won't find the datafiles and other things they need to run. For example:

cd \allegro5\allegro\examples
..\build\examples\exnewapi.exe

Alternatively, you can simply copy all of the datafiles and other things into your build/examples directory

Hope this helps.

WG

Milan Mimica
Member #3,877
September 2003
avatar

Quote:

You then have to go into the MinGW/bin directory and remove the -sjlj from all of the exe files.

No need to rename them all, just gcc.exe and g++.exe. In fact, in my experience renaming them all results in broken MinGW installation.

wiseguy
Member #44
April 2000
avatar

hmmm maybe that's what is causing me problems...

Neil Walker
Member #210
April 2000
avatar

I don't mean to sound rude, and I know 4.9.3 is in beta, but it seems quite ridiculous that in order to compile allegro you have to dump your stable version of gcc and use an unstable 'future' version. Surely there's no code in allegro that your average c compiler can't compile?

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Goalie Ca
Member #2,579
July 2002
avatar

Well I'm sure it works with gcc 3 (gcc4 is a few years old now and is much more strict and standards compliant). As far as I know, the main problem with mingw based on gcc3 is its relatively poor ability to handle dll's.

-------------
Bah weep granah weep nini bong!

wiseguy
Member #44
April 2000
avatar

My earlier post was a bit of an overkill, as a couple couple of the guys really helped me out with getting things working. The only thing I can say is to give it a try with the stable releases, but just keep in mind with those you can only build the shared library...

I just got the sound stuff working today and the whole thing is pretty darn cool. I'm really looking forward to a non WIP version

Thanks to everyone who helped me get it to compile for me.

WG

aj5555
Member #9,033
September 2007

Well done! :D I've spent much time also getting the most recent mingw system set up, i know how much of an ordeal it is. Thanks for taking the time to explain it and documenting it here.

Milan Mimica
Member #3,877
September 2003
avatar

Quote:

Surely there's no code in allegro that your average c compiler can't compile?

Readme says: Note: For MinGW with gcc < 4, you cannot build a static library because TLS (thread local storage, using __thread) support was not introduced until version 4.
So gcc3 doesn't have the required feature.

And gcc4 is not a "future" release.

UCL057
Member #9,720
April 2008

About building allegro5

Now I got this error:

allegro/src/win/d3d_disp.c error: 'D3D9b_SDK_VERSION' undeclared

Milan Mimica
Member #3,877
September 2003
avatar

Your d3d9.h is wrong.

aj5555
Member #9,033
September 2007

using the latest DirectX SDK is not likely to work. there have been several posts around this forum about which directX SDK to use.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

UCL057
Member #9,720
April 2008

I have the right DX9
but there are errors in building allegro
One of the errors was something with the header
dsound.h error: redefinition of struct D3DVECTOR
The latest version of gcc 4 wont work (gcc --broken)
but the gcc in my Dev-Cpp/bin works except
of all these errors.....

Goalie Ca
Member #2,579
July 2002
avatar

dsound.h?

That must be from the old audio. You can safely disable that in the cmake all the sound options like digi off. The new audio engine (still a wip) is an addon and appears as "WANT_AUDIO" in the configure and it require OpenAL to be installed (no directsound backend yet).

-------------
Bah weep granah weep nini bong!

UCL057
Member #9,720
April 2008

About dsound.h
Tell me how to disable the
sound options

Is it CmakeCachelist or???

I have found some undeclared functions in allegro5,
strange...

Go to: