Makefile error when installng allegro 4.2.3
Bob Keane

I am installing Allegro 4.2.3 on Fedora 29 and running into a problem. I ran fix.sh -unix and configure -- enable-static but get an error:

makefile:421: *** recipe commences before first target. Stop.
makefile:421: *** recipe commences before first target. Stop.

The makefile is attached. Google says there may be a space or missing / symbol on the line but I am not too familiar with makefiles. Can anyone else see the issue?

Edgar Reynaldo

You need to use git to checkout the Allegro 4.4 branch. It builds with cmake.

raynebc

Distros that have apt-get make this easier. "sudo apt-get install liballegro4-dev" worked flawlessly on Ubuntu the last time I tried it.

push32

Hi Bob,

I ran into the same problem when trying to compile Allegro 4.2.3 for DOS and Win32. The problem was the version of make, newer versions seem to be incompatible with the Makefile. Make version 3.79 worked for me.

Best regards,
Torsten

Edgar Reynaldo

Edit I. Dumb

Bob Keane
Torsten said:

I ran into the same problem when trying to compile Allegro 4.2.3 for DOS and Win32. The problem was the version of make, newer versions seem to be incompatible with the Makefile. Make version 3.79 worked for me.

Best regards,
Torsten

Thanks, I'll give it a go.

<edit> Installing make 3.79 got me past the configure issue but when running make I get another error:

make: *** [obj/unix/asmdef] Error 1

I don't want to run all over the internet looking up errors. Two questions: Will downloading from Git install the version of allegro I want with all the dependencies? If so, I have never used git before. Where can I find a step by step guide to do so?

Edgar Reynaldo

https://liballeg.org/git.html

No, it won't install the dependencies. You have to do that. Either build them, or use your distros package manager.

Bob Keane

I downloaded allegro-4.2.2-xc-master, ran fix.sh but get an error: bash: ./configure: No such file or directory. I guess I'll try to find a guide to Allegro . Thanks anyway.

Edgar Reynaldo

Why do you want version 4.2.2? 4.4 is the latest for the 4 branch and it builds with cmake. This isn't as hard as you're making it.

There are four add-ons, logg, jpgalleg, loadpng, and allegroGL. These need ogg, vorbis, and libpng and zib. These are all optional.

Bob Keane

I don't really need version 4.2, I'm just looking for one with good documentation. I have that book which covers 4.0.3, but I can't get it to install.

Edgar Reynaldo

4.4 is src compatible with 4.2 and 4.0.

Minus like two deprecated functions.

EDIT
ZLib and LibPNG build with CMake. Ogg and Vorbis build with configure. Allegro 4.4 builds with cmake.

By all means, use your package manager, and search for the dependencies. I'm more than sure those 4 libraries are provided.

Then you build Allegro 4.4.

It's easy.

1) download allegro src using git
2) copy to allegro folder somewhere
3) open a terminal in that folder
4) mkdir build
5) cd build
6) cmake -G "Unix Makefiles" ..
7) make
8) make install
9) $$$PROFIT$$$

Bob Keane

Well I got Allegro to install but am having trouble linking with the --pkgconfig files. Guess I have more searching to do.

Edgar Reynaldo

Allegro 4 links with allegro-config not pkg-config. Or you can link directly.

Bob Keane

That works, but now I have to figure out why it does not find the allegro.h file.

Edgar Reynaldo

When compiling, pass -I "include/directory/path" to gcc. Where it is ;

gcc blah... -I /usr/local/include main.c

Bob Keane

We are getting closer. Using gcc -Iinclude /usr/local/include/allegro.h -o main `allegro-config --cflags --libs` gives me an "undefined reference to main" error.

Here is the code:

#SelectExpand
1#include <allegro.h> 2 3 4 int main() 5 6 { 7 8 //Initialize Allegro 9 10 allegro_init(); 11 12 13 14 //Set the resolution to 640 x 480 with SAFE autodetection. 15 16 set_gfx_mode(GFX_SAFE, 640, 480, 0, 0); 17 18 19 20 //Install the keyboard handler 21 22 install_keyboard(); 23 24 25 26 //Print your welcome message to the screen 27 28 textout(screen, font, "Hello Dream.In.Code! This is my first Allegro Program", 1, 1, 10); 29 30 textout(screen, font, "Press ESCape to quit.", 1, 12, 11); 31 32 33 34 //Loop until escape is pressed 35 36 while(! key[KEY_ESC]) 37 38 poll_keyboard(); 39 40 41 42 //Exit program 43 44 allegro_exit(); 45 46 return 0; 47 48 }

I remember seeing the problem before but cannot remember the solution. It was something simple.

Edgar Reynaldo

The correct line would be something more like this :

gcc -Wall -Wextra -Wshadow -o program `allegro_config --cflags` main.c `allegro_config --libs`

Or specifying manually :

gcc -Wall -Wextra -Wshadow -o program -I //usr/local/include main.c -L //usr/local/lib -lalleg

You forgot to specify the source file.

Peter Hull

I can't remember if you need END_OF_MAIN on Linux. You might need it.

Also why not dnf install allegro-devel I've given up compiling allegro myself, unless I need to.

Good luck!

Bob Keane

That worked, thanks Edgar. However, for future generations, I would like to say it should be allegro-config, not allegro_config. Peter, I tried using dnf, but I think I had the wrong package name. Maybe next time.

Edgar Reynaldo

Well I don't use allegro 4 anymore, and I'm not on linux either, so you're welcome. ;)

ZoriaRPG

4.4 is src compatible with 4.2 and 4.0.

Minus like two deprecated functions.

4.4 also needed some tweaks in the programme src, for us, for packfile password calls, and some stuff for glibc 2.28.

https://github.com/ArmageddonGames/ZeldaClassic/blob/2.55/src/alleg_compat.h
https://github.com/ArmageddonGames/ZeldaClassic/blob/2.55/src/allegro_wrapper.h
https://github.com/ArmageddonGames/ZeldaClassic/blob/2.55/src/alleg_compat.cpp

In the event that you run into a similar situation.

Thread #617701. Printed from Allegro.cc