Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » directX download for setting up A5

This thread is locked; no one can reply to it. rss feed Print
directX download for setting up A5
William Labbett
Member #4,486
March 2004
avatar

Hi,

does anyone know where I can get the Direct X files for use with compiling allegro
with MinGW ?

Also, does anyone know why allegro 5 is built with Direct X 9 (seeing as Direct X had moved on a lot since then) ?

Elias
Member #358
May 2000

If you use msys2 it comes with all the DirectX files you need.

--
"Either help out or stop whining" - Evert

William Labbett
Member #4,486
March 2004
avatar

Thanks Elias.

I'm trying to compile allegro with CMake. I don't understand where MSYS2 would come into it.

What would I use MSYS2 for?

l j
Member #10,584
January 2009
avatar

Windows XP doesn't support anything higher than DX9; DX10 and DX11 won't improve performance much unless you know what you're doing as far as I know. I guess that's why allegro 5 only supports DX9.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

William Labbett
Member #4,486
March 2004
avatar

Thanks.

I've compiled zlib.

Cmake says the library is missing.

I copied

libzlibstatic.a

and

libzlib.dll.a

to the deps/lib folder in my allegro installation.

I copied the header zlib.h to the deps/include folder.

Can someone help ? I don't know what CMake is looking for.

Elias
Member #358
May 2000

Check the CMakeError log file in your build folder... it may be that your zlib is the wrong version or not compatible (or indeed not found). Again a reason to go with msys2 instead - someone already compiled all the dependencies for you there :)

This is how you'd compile with msys2: https://wiki.allegro.cc/index.php?title=Building_with_msys2

Should be completely straightforward, just make sure to stick to the 64 bit version of everything.

--
"Either help out or stop whining" - Evert

William Labbett
Member #4,486
March 2004
avatar

Thanks a lot Elias.

I've gone the way you suggested.

I've followed all the instructions on that page and I'm sorry to say that although it's straightfoward I've gotten stuck.

I got as far as the part where I have to compile allegro.

I created a directory called

C:\allegro_build_folder

(which is where I'm calling CMake from).

and Cmake says that the source

directory C:\allegro does not exist.

Someway before that point in the instructions there's a call to git which downloads
the master branch of allegro. After the command the instructions say that "This will make a folder called allegro."

...but it doesn't say where it'll be. I've looked around but can't find it.

Elias
Member #358
May 2000

It should be in the same folder you called git from, inside msys2. After the step where you call git..., type this:

pwd -w

And it will tell you where it is. You can just continue like on the wiki normally though. The cd into the build folder means that ../allegro should work. Maybe paste the output of the commands here. (You can select text in the msys2 console and it will automatically copy it to the clipboard.)

--
"Either help out or stop whining" - Evert

William Labbett
Member #4,486
March 2004
avatar

Thanks again Elias.

Elias said:

It should be in the same folder you called git from,

I used this piece of info to work out where it was.

Where I was calling from was

C:\msys64\home\William or somewhere back up that path.

I ran dir there and found it.

I switched to

C:\allegro_build_folder

and put the full path of the allegro dir in place of ../allegro

I'm pleased to say that everything has gone well (compilation).

Thanks a lot for your attention.

The orignal reason I wanted to use mingw-w64 over the old set up I was used to using was because I get a compiled version of libgmp (the GNU big number library)
with mingw-w64.

I noticed it was in the lib folder of the first installation I downloaded. This installation was from another way but I'm fairly sure it will be there :)

kenmasters1976
Member #8,794
July 2007

This thread's title made me remember a small, perhaps offtopic, issue when building Allegro with MinGW.

You can download the DirectX SDK from Microsoft to get the DirectX header files. The installation path will default to something like C:\Program Files (x86)\Microsoft DirectX SDK. I know it's typically suggested to install in a path without spaces but if you happen to install it on the default path, Allegro 5 will build correctly until it reaches the examples, then the build process will fail, I guess due to the spaces in the path, but since everything builds correctly up to that point then the problem is not with the path itself, maybe a small configuration detail on the cmake files?.

William Labbett
Member #4,486
March 2004
avatar

but since everything builds correctly up to that point then the problem is not with the path itself

If everthing builds correctly up to that point, and then stops, wouldn't that indicate that the problem IS with the path?

kenmasters1976
Member #8,794
July 2007

If everthing builds correctly up to that point, and then stops, wouldn't that indicate that the problem IS with the path?

Hmmm... Defining the path to the DirectX header files works fine for the first part of the build process, so the problem is that the linker doesn't like paths with spaces?.

Elias
Member #358
May 2000

Could be a bug in cmake. Can you find any error message about what is going wrong?

--
"Either help out or stop whining" - Evert

kenmasters1976
Member #8,794
July 2007

I just tried building a fresh copy of Allegro 5.1. cmake detects the DirectX headers as follows:

-- Found DINPUT: E:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include
-- Found XINPUT: E:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include
-- Found D3D9: E:/MinGW/include
-- Found D3DX9: E:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include
-- Found GDIPLUS: E:/MinGW/include
-- Performing Test SUPPORT_GDIPLUS
-- Performing Test SUPPORT_GDIPLUS - Success
-- Found DSOUND: E:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include

Then, running mingw32-make starts the build process which fails at this point:

[ 41%] Building CXX object demos/cosmic_protector/CMakeFiles/cosmic_protector.dir/src/sound.cpp.obj
[ 41%] Building CXX object demos/cosmic_protector/CMakeFiles/cosmic_protector.dir/src/wave.cpp.obj
Linking CXX executable cosmic_protector.exe
[ 41%] Built target cosmic_protector
Scanning dependencies of target speed
[ 41%] Building C object demos/speed/CMakeFiles/speed.dir/a4_aux.c.obj
[ 42%] Building C object demos/speed/CMakeFiles/speed.dir/badguys.c.obj
[ 42%] Building C object demos/speed/CMakeFiles/speed.dir/bullets.c.obj
[ 42%] Building C object demos/speed/CMakeFiles/speed.dir/explode.c.obj
[ 42%] Building C object demos/speed/CMakeFiles/speed.dir/hiscore.c.obj
[ 42%] Building C object demos/speed/CMakeFiles/speed.dir/main.c.obj
[ 43%] Building C object demos/speed/CMakeFiles/speed.dir/message.c.obj
[ 43%] Building C object demos/speed/CMakeFiles/speed.dir/player.c.obj
[ 43%] Building C object demos/speed/CMakeFiles/speed.dir/sound.c.obj
[ 43%] Building C object demos/speed/CMakeFiles/speed.dir/title.c.obj
[ 44%] Building C object demos/speed/CMakeFiles/speed.dir/view.c.obj
mingw32-make[2]: *** No rule to make target `x86)/Microsoft DirectX SDK (June 2010)/Lib/x86/d3dx9.lib)', needed by `demos/speed/speed.exe'.  Stop.
mingw32-make[1]: *** [demos/speed/CMakeFiles/speed.dir/all] Error 2
mingw32-make: *** [all] Error 2

As you can see, it stops at speed.exe but it builds cosmic_protector.exe correctly. Since at this point the Allegro libs are already built, I never bothered to report this and even then I'm pretty sure it can be solved by placing the DirectX headers on a path without spaces or symbols. However, it might still annoy some users following this configuration.

William Labbett
Member #4,486
March 2004
avatar

Doesn't look like a big job to sort it out. Are you sure that your idea for the fix really works?

kenmasters1976
Member #8,794
July 2007

I guess it should but, as I said, I never really bothered looking into it.

Elias
Member #358
May 2000

It looks like the problem has more to do with the opening parenthesis than with spaces. The "x86)/Microsoft DirectX SDK (June 2010)/Lib/x86/d3dx9.lib)" probably should be "E:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86/d3dx9.lib" - without the closing parenthesis at the end. It's strange, it's missing all text up to and including the (, and instead has an extra ) at the end. Or maybe CMake just is truncating filenames in a weird way when displaying error messages?

My guess right now is that it's a bug in CMake and not Allegro, but hard to be sure. Definitely looks like something that will take time (and a Windows installation) to figure out.

--
"Either help out or stop whining" - Evert

William Labbett
Member #4,486
March 2004
avatar

I could do it tommorrow. I've already got windows installed, Elias. Let me know.

kenmasters1976
Member #8,794
July 2007

I have cmake version 2.8.8. Will try updating it and attempt to build Allegro again. If it works it might just require bumping the minimum required cmake version.

[EDIT:] Nope, same thing with cmake 3.1.3.

Digging a bit more on the cmake files I found that by removing/commenting line 58 of demos\speed\CMakeLists.txt then the build process goes on and completes without problems. That line adds ALLEGRO_MAIN_LINK_WITH to the target link libraries. It seems totally random, though, since that same setting doesn't affect other targets.

#SelectExpand
52if(WANT_MONOLITH) 53 target_link_libraries(speed 54 ${ALLEGRO_MONOLITH_LINK_WITH} 55 ) 56else(WANT_MONOLITH) 57 target_link_libraries(speed 58# ${ALLEGRO_MAIN_LINK_WITH} # Now the build process completes successfully 59 ${AUDIO_LINK_WITH} 60 ${PRIMITIVES_LINK_WITH} 61 ${FONT_LINK_WITH} 62 ) 63endif(WANT_MONOLITH)

Go to: