Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Have not yet found a way to compile modern allegro5 in Win 10

This thread is locked; no one can reply to it. rss feed Print
Have not yet found a way to compile modern allegro5 in Win 10
Mitch Randall
Member #16,706
July 2017

In July I started a thread about installing allegro 5.2.2 in a clean win 10 machine.

There were lots of great suggestions, and I am really appreciative.

But ultimately, I was unable to get it to work with the information posted.

I eventually, used the old mingw, sol.h, reinstalling MSVC, and installing the absolutely huge huge huge Direct X SDK. That left me with an outdated but working mingw compiler and an allegro library and a deficit of disk space (because of DXSDK).

I published what I had done, to the dismay of the the helpful people on the forum.

In July, Edgar Reynaldo wrote:

******************************************************************************

@Mitch

I told you you would have problems if you used old mingw and the DXSDK. Do NOT uninstall your MSVC runtimes. Programs will stop working. The DXSDK from Jun 2010 works if you use sal.h from liballeg.org. But it's a MASSIVE download, and the most recent version of DX now comes with the Windows SDK, which is even more massive. mingw claims to have POSIX support, but it's spotty at best, and there are unimplemented standard functions and structs, which is unacceptable if you want to live in the real world and use a modern version of C or C++.

I've done the exact same thing as you to get my binaries to build in the past.

That is the EXACT reason I said to use MinGW-W64. They provide binary distributions of their compiler that you can just plop into place and compile with. They COME with DX headers, libs, and work perfectly with the DirectX 9, 10, and 11 runtimes that people have installed on their computers.

See https://sourceforge.net/projects/mingw-w64/files/ for downloads (scroll down to the links).

PLUS, the most recent version of gcc supported by vanilla mingw.org is 5.3. That is ANCIENT. It can't even properly compile (much less support) C++11. The version of the compiler that I used is made for gcc version 7.1, and 8 will be out in the near future. Full support for C++11,14,17 etc...

See https://wiki.allegro.cc/index.php?title=Installing_MinGW for details.

********************************************************************************

So now I have another brand new win 10 machine, and I want to do it "right".

I installed mingw64 according to Edgar Reynaldo. I downloaded allegro 5.2.2. I installed the latest 64-bit Cmake.

I have not installed msys explicitly, and I don't have a path to it. I just have a path to c:\mingw\mingw64\bin. (I changed the environment variable via win10 control panel). I am also running in a cmd window.

Right off the bat, cmake gui gives me the error message:
CMake Error at CMakeLists.txt:703 (message):
Windows port requires DirectInput (not found).

The problems with DirectInput are related to the old sol.h fix, and to the DXSDK. Without trying, I know I can anticipate that if I worked around this problem, I would get a bunch of errors relating to XIN and XOUT, which also relates to the DXSDK.

So, the issue remains - I am not able to install and compile allegro 5.2.2 on a clean win 10 machine. (Unless I do a bunch of things the smart forum users are appalled by.)

This is a brand dew Dell Latitude 7480 laptop with win10 right out of the box.

I am willing to try suggestions if anyone out there believes they can help me.

Should I put sol.h into the mingw64 included directory? Should I install msys2? What do you propose?

As before, I greatly appreciate any help.

I would hope this is one of the most simple problems, because it seems that I run into exactly this issue with three brand new windows 10 computers. Because the computers have no history (they are completely clean), it's not like I should represent a special case. This would be the default case?

Help!

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Which version of MinGW did you download? That's important.

Your errors about missing DINPUT are because you haven't correctly configured cmake. Use cmake-gui, not cmake from the command line. It comes with CMake.

You have to set all the directories for DX because Allegro's CMake file isn't smart enough to detect non-standard installations of DX.

Don't worry, we'll get it working.

Edgar

Mitch Randall
Member #16,706
July 2017

I installed from mingw-w64-install.exe from the link you provided in your post snippet.

When I type gcc --version, it is
gcc (x86_64-posix-seh-rev2, Built by MinGW-W64 project) 7.1.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I ran the cmake windows program - not through the command line.

The cmake file I installed from was cmake-3.9.1-win64-x64.msi

My allegro directory is C:\allegro

In cmake, I answered "Where is the source code:" with c:/allegro
I answered "Where to build the bin:" with c:/allegro

Okay... so what do I do next?

(P.S. I am very appreciative of your help!!!)

SiegeLord
Member #7,827
October 2006
avatar

https://wiki.allegro.cc/index.php?title=Building_with_msys2 has worked to build Allegro on Windows for years, and I just re-tried it successfully on my Win10 VM.

"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

You don't need MSYS2 to compile Allegro. :P You only need MSYS (1.0 for that matter) to compile some of the dependencies.

You need to use cmake-gui to FULLY configure Allegro before building.

Also, create a build directory under c:\allegro and build there. That way you can start over if you mess up.

Also, read README_CMake.txt in the source directory for instructions on CMake configuration.

dhia hassen
Member #16,240
March 2016

what about working on a new crossplatform build system https://www.allegro.cc/forums/thread/617031/1032395#target ?

SiegeLord
Member #7,827
October 2006
avatar

Sure you don't need MSYS2, but it's one of the easiest methods to compile Allegro on Windows. To deviate from that is to declare that you know what you're doing, and that you can resolve the associated difficulties yourself.

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

Mitch Randall
Member #16,706
July 2017

To seiglord, Edgar Reynaldo: It doesn't matter to me if I do or do not use msys2. What I am hoping for is exact instructions that actually work.

I'm pretty dumb, but not totally dumb. I have been building Allegro since the mid 90's, and it's never been a problem. But now, I can't build Allegro 5.2.2 on a clean windows machines.

I think once some special things are in place, it builds easily. But when one starts with a clean win10 machine, something is not quite in place.

What I am hoping is that someone can take me through the minimum steps to put allegro 5.2.2 on a clean win10 machine.

seiglord, Do you have step by step instructions more detailed than "use msys2"? I'm too dumb to fill in all those gaps.

Edgar, Can we please pick up where we left off? I started with a clean win10 machine. I installed MinGW64 (latest version), I installed CMake 64-bit (latest version), I downloaded the allegro 5.2.2 source into c:\allegro. When I run cmake, I get:

A bunch of good stuff, then
Could NOT find DINPUT (missing: DINPUT_INCLUDE_DIR)
Could NOT find D3D9 (missing: D3D9_INCLUDE_DIR)
Could NOT find D3DX9 (missing: D3DX9_INCLUDE_DIR D3DX9_LIBRARY)
Could NOT find DSOUND (missing: DSOUND_INCLUDE_DIR)
Could NOT find XINPUT (missing: XINPUT_INCLUDE_DIR XINPUT_LIBRARY)
CMake Error at CMakeLists.txt:703 (message):
Windows port requires DirectInput (not found).

Where do I go from here? Anyone?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Try and read what I said - (cmake-gui, not cmake); Allegro doesn't configure itself properly when the libraries aren't exactly where they're expected to be.

cd allegro
cd build
>cmake-gui ..

Configure....

Generate....

mingw32-make && mingw32-make install (or make && make install if mingw32-make is not available in your distribution of MinGW). The DX headers and libraries are in your compiler's include and lib directories. Those are what you need to specify inside of CMake for the DIRECTX_* variables.

Mitch Randall
Member #16,706
July 2017

Edgar Reynaldo,

As I mentioned I am using cmake-gui. (When I run it from windows, it is just called cmake, but it is obviously not the command line version, it is a window that pops up.)

It gives me the error message:

Could NOT find DINPUT (missing: DINPUT_INCLUDE_DIR)
Could NOT find D3D9 (missing: D3D9_INCLUDE_DIR)
Could NOT find D3DX9 (missing: D3DX9_INCLUDE_DIR D3DX9_LIBRARY)
Could NOT find DSOUND (missing: DSOUND_INCLUDE_DIR)
Could NOT find XINPUT (missing: XINPUT_INCLUDE_DIR XINPUT_LIBRARY)
CMake Error at CMakeLists.txt:703 (message):
Windows port requires DirectInput (not found).

So I am doing exactly what I think you are suggesting, yet, it doesn't work.

I am using a clean win10 machine. It is nothing unusual. It is a Dell right out of the box. Last month it was an HP laptop right out of the box.

SiegeLord
Member #7,827
October 2006
avatar

seiglord, Do you have step by step instructions more detailed than "use msys2"? I'm too dumb to fill in all those gaps.

I posted a link. Here it is again: https://wiki.allegro.cc/index.php?title=Building_with_msys2

"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

So I am doing exactly what I think you are suggesting, yet, it doesn't work.

You have to put a value in each and every one of the fields in the cmake GUI. If it says not found, put the path to it inside the correct entry.

{"name":"611028","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/1\/c16e1594c5af5b561412352044de9345.png","w":1920,"h":760,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/1\/c16e1594c5af5b561412352044de9345"}611028

DirectX and D3D should have come along with mingw-w64. Look for a subfolder of mingw named i686 or x64 or whatever corresponding to your specific compiler type. Look at the above screenshot for pointers.

There is a guide for building without MSYS as well. :/

https://wiki.allegro.cc/index.php?title=Install_Allegro5_From_Git/Windows

You have to fully configure all of the libraries yourself. CMakeLists.txt isn't smart enough to figure everything out on its own. You may have to delete CMakeCache.txt. You may also have to run configure repeatedly until everything is acceptable. You will want to edit the SHARED CMake variable, as well as CMAKE_BUILD_TYPE. Valid values are 'Debug' 'Release' and 'RelWithDebInfo'.

Mitch Randall
Member #16,706
July 2017

Edgar Reynaldo,

Thank you for the extra information. I did get Allegro 5.2.2 to compile with a non-cringeworthy setup (i.e. not having to revert to the old mingw, and not having to install direct x sdk, and not having to undo MSVC runtime.)

It amounted to learning how to use CMake better by setting the search directory variables.

The only thing that I didn't like is during compile for RelWithDebInfo, it treated warnings as errors. I had to compile with Debug. This had the ripple effect that now all my makefiles for my own C programs need to look for -lmallegro_monolith_debug, which is a pain. I'd like to figure out how to get the RelWithDebInfo to not treat warnings as errors.

SiegeLord,

Thank you for your link on how to build allegro. I didn't use your allegro building method, but much of your post you link to has to do with setting up msys2. It turns out that if you just install msys2 via the convenient link from www.msys2.org, lots of the functions are not installed, such as make!!!

So I am up and running, and I appreciate the assistance. I am so glad that experts like yourselves take the time to watch these boards and help us less gifted find our way.

Thanks

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Mitch Randall
Member #16,706
July 2017

Thanks. That's the first thing I did, is to look for -werror in the flags.

I was looking in the cmake gui under CMAKE (and everywhere else in cmake gui).

There are indeed several CFLAGS and CXXFLAGS variables - a set for each of the build configurations RelWithDebInfo, Release, Debug, None... but none of them have -werror in them.

They are combinations of O2, O3, -g -DNDEBUG

I couldn't find the string werror anywhere in the window.

I concluded that it must be a layer deeper, but I struggle to find it.

I did not change the makefile itself, because that seemed like an ill-advised route.

My cringe-worthy, short term solution was to rename allegro_monolith_debug-5.2.dll to allegro_monolith-5.2.dll so I don't have to change a history of a dozen of my project makefiles.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Mitch Randall
Member #16,706
July 2017

"Release" mode has the -werror flag set (somewhere).

I am still not able to find how to turn that off, because I can't find how that flag is getting set.

I am satisfied with this thread. I got allegro 5 to build on a clean windows 10 machine by using CMake-gui - but I had to learn first that I was supposed to set all those paths manually.

My only issue is still this -werror flag, but I found a workaround where I just renamed my monolith file so I didn't have to change 20 makefiles for my projects.

Thanks. If anyone can help specifically to compile in Release mode but turn off the -werror flag so that it actually compiles the allegro 5 source, I would be glad to hear it.

Otherwise, thank you everyone for helping! I love this community and the spirit of people who spend a lot of time helping those of us in need.

Thanks!

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: