Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Building allegro5 with addons from source on Windows

This thread is locked; no one can reply to it. rss feed Print
Building allegro5 with addons from source on Windows
Aldrik
Member #16,925
December 2018
avatar

When I run my game with the precompiles dll's everything works fine, but when I run my game with the dll's I compiled from source I can't load any assets. Is this because I am missing some libraries used by these addons? How would I fix this? I don't have this problem when running my game on linux with the libs I compiled from source.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Replacing DLLs is not recommended these days. There are often incompatibilities between them.

You should be checking for errors in allegro init routines. As well as checking to see if your assets are NULL upon loading.

If you don't init the image addon, it won't load any formats recognized by allegro. Same for the font and ttf addons.

Also, if those addons aren't enabled in the build, they won't be present in the binary.

Aldrik
Member #16,925
December 2018
avatar

I made some changes to the audio addon so I can play audio in reverse, how am I supposed to test this if I can't use my own compiled dll's?

I am checking for errors in allegro init routines but this is not the problem. The assets load fine with the precompiled dll's but the assets are returning NULL upon loading when I use my source compiled dll's.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Aldrik
Member #16,925
December 2018
avatar

It generates allegro_image-5.2.dll and allegro_font-5.2.dll so I am assuming it does. I ran cmake with `cmake .. -G "MinGW Makefiles"` and got these error messages: https://pastebin.com/KrEBaxPz so I assumed I am missing some dll's.

I just found this page: https://github.com/liballeg/allegro_winpkg/releases and downloaded the lastest version. I assume this is what I need to fix my problem but I am not sure what to do with these files.

I also just noticed that I am not generating allegro_ttf-5.2.dll

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

The winpkg is a source package for dependencies that builds with cmake.

You need to build those first, and then specify them when you build allegro.

Use cmake-gui, not cmake. It will show you much much more than what you see with cmake alone.

If you need help, you can refer to the Allegro 5 compile guide in my sig. It uses a slightly different process though.

The messages saying X could not be found need to be fixed for the addons and support to build correctly. PNG not found, ZLIB, JPEG, etc....

Aldrik
Member #16,925
December 2018
avatar

After finally being able to compile I get the error "The procedure entry point inflateReset2 could not be located in the dynamic link library in allegro_image-5.2.dll" when I start my test program. Have you ever had this problem?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Aldrik
Member #16,925
December 2018
avatar

I was indeed linking to the wrong zlib, thanks. I think I did everything correctly, yet somehow I ended up with the exact same problem I stated in my first post. I am not sure what to do at this point.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Well, don't worry, it could be other things as well.

Have you tried static linking let's save that for later...

Are you sure there aren't any incompatible dlls in your %PATH%?

Try moving your exe and assets and new dlls to a separate folder. Then open a cmd.exe window and cd to that folder. Now type cmd.exe again. In the new environment (which inherits everything else) type 'set path=' and hit enter. Now try to run your program from within that shell and see what happens. You can type exit at any time to return to your original environment. This is to test what happens when the %PATH% is empty. It means it should look in the current folder only.

Next, have you made sure your current working directory is set correctly? It gets set to the directory you run the program from, which means, it isn't necessarily the same one. See https://www.allegro.cc/forums/thread/617730/1041133#target for details.

After that has been tried we can discuss static linking, to rule out bad linking.

Aldrik
Member #16,925
December 2018
avatar

There were no changes using the method you stated above, am also sure the active directory is set correctly before loading any assets because I had already fixed that issue before.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

All right that rules that out let's start from the beginning.

What compiler did you download and from where?

What version of the winpkg did you download? Did you build them from source?

Can you make a simple example program that demonstrates this?

And also, make sure you're building in debug mode. Important clues can be gained from the allegro.log file.

Aldrik
Member #16,925
December 2018
avatar

I managed to fix my problem by completely reinstalling MinGW. However, I am not generating allegro_ttf-5.2.dll because of a problem with freetype. I guess this isn't really a problem because I am not planning on changing anything the the font addon so I can just use the precompiled allegro_ttf-5.2.dll. :P

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

iheartcoffee
Member #16,518
August 2016
avatar

Freetype 2.9 needs to build with libpng and zlib. Then when you are compiling Allegro 5 use cmake-gui to check off FREETYPE_ZLIB and FREETYPE_PNG are enabled. On MSYS just type cmake-gui .. from the build directory to make things easy. I followed Edgar's tutorial to compile my Allegro DLLs.

Go to: