Where's the typo?
Bob Keane

I installed allegro 5 from sources and tried compiling a sample program but run into errors. I added pkg-config to the search path using

export PKG_CONFIG_PATH=/Downloads/allegro-5.2.4.0/build/lib/pkgconfig

I compile using <code>gcc -Wall hello.c pkg-config --cflags --libs allegro-5.2.4.0 allegro_acodec-5.2.4.0 allegro_audio-5.2.4.0 allegro_color-5.2.4.0 allegro_dialog-5.2.4.0 allegro_font-5.2.4.0 allegro_image-5.2.4.0 allegro_main-5.2.4.0 allegro_memfile-5.2.4.0 allegro_physfs-5.2.4.0 allegro_primitives-5.2.4.0 allegro_ttf-5.2.4.0`
but get errors:

Package allegro-5.2.4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `allegro-5.2.4.0.pc'
to the PKG_CONFIG_PATH environment variable

I have verified the path to pkgconfig and for fun copied the folder to the same folder the source is in. Where is the typo?

Peter Hull

On my system I just use allegro-5. Does that work for you?

Bob Keane

No luck.

bobkeane@localhost Documents]$ export PKG_CONFIG_PATH=/Downloads/allegro-5/build/lib/pkgconfig
[bobkeane@localhost Documents]$ gcc -Wall hello.c `pkg-config --cflags --libs allegro-5 allegro_acodec-5 allegro_audio-5 allegro_color-5 allegro_dialog-5 allegro_font-5 allegro_image-5 allegro_main-5 allegro_memfile-5 allegro_physfs-5 allegro_primitives-5 allegro_ttf-5`
Package allegro-5 was not found in the pkg-config search path.
Perhaps you should add the directory containing `allegro-5.pc'
to the PKG_CONFIG_PATH environment variable

Elias

What is the output of:

pkg-config --list-all | grep allegro

Bob Keane

It is:

 pkg-config --list-all|grep allegro
allegro                        allegro - Allegro game programming library

Edgar Reynaldo

That's for Allegro 4 I think. I might be wrong but I'm pretty sure Allegro 5 lists itself as such. Is that what you wanted?

You need backticks around the pkg-config call as well.

Also, pkg-config registers its own packages, and that path doesn't look right for pkg-config. Perhaps you didn't install properly? Do you have include/allegro5 in /usr/local ? Do you have allegro 5 libs in /usr/local/lib?

Just link to them directly. pkg-config is a waste of time and energy unless you're static linking.

Also, you probably want the monolith.

Bob Keane

I'm trying to use allegro 5, I copied the compile command from the wiki. The copy included the backticks, so I'm not sure why the were not in the post. The include/allegro5 folder is in usr/local, the allegro libs are in usr/local/lib, but the pkgconfig folder is there as well. Is that the problem, and where should it be? And I am thinking about static compiling so pkgconfig is a should have. As to the monoliths, where are they and where should be?

Edgar Reynaldo

To get the monoliths, you need to compile with the cmake flag WANT_MONOLITH set to 'on'. (-DWANT_MONOLITH=on)

Bob Keane, soul stealer said:

the pkgconfig folder is there as well.

That's the folder you need for your PKG_CONFIG_PATH variable. Remember to append it and not replace it though.

export PKG_CONFIG_PATH=/usr/local/path/to/pkg-config:$PKG_CONFIG_PATH

Then try running the pkg-config command by itself or use grep to list the packages again.

Bob Keane

Maybe I entered the export command incorrectly. This is what I typed:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

This is what I get when I use grep:

pkg-config --list-all|grep allegro
allegro                        allegro - Allegro game programming library

And are the monoliths important? I may have to reinstall if so.

<edit>

Bob Keane, soul stealer said:

Everyone needs a hobby.

Edgar Reynaldo
OpenSUSE said:

linux-u7hl:/usr/local/lib/pkgconfig # ls
allegro-debug.pc allegro_monolith-5.pc allegro_monolith-debug-static-5.pc allegrogl-debug.pc jpgalleg-debug.pc loadpng-debug.pc logg-debug.pc
allegro.pc allegro_monolith-debug-5.pc allegro_monolith-static-5.pc allegrogl.pc jpgalleg.pc loadpng.pc logg.pc
linux-u7hl:/usr/local/lib/pkgconfig # pkg-config --list-all | grep allegro
allegro-debug allegro - Allegro game programming library
allegro_monolith-debug-static-5 allegro_monolith - Allegro game programming library (all addons included)
allegro_monolith-static-5 allegro_monolith - Allegro game programming library (all addons included)
allegrogl allegrogl - OpenGL addon for Allegro game programming library
allegro allegro - Allegro game programming library
allegro_monolith-debug-5 allegro_monolith - Allegro game programming library (all addons included)
allegrogl-debug allegrogl - OpenGL addon for Allegro game programming library
allegro_monolith-5 allegro_monolith - Allegro game programming library (all addons included)
linux-u7hl:/usr/local/lib/pkgconfig #

Some update borked my Linux VBOX graphics >:(
{"name":"611602","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/5\/a54b4442ee576e00bf15244cfefa096f.png","w":1536,"h":750,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/5\/a54b4442ee576e00bf15244cfefa096f"}611602

EDIT
The monoliths are only important if you don't like typing.

Chris Katko

... which graphics are actually bad?

Edgar Reynaldo

The text is all chunky like peanut butter. The screenshot appears fine, but a photo reveals the difference :

{"name":"611603","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/f\/bfba54c9818b0c920167d7011f112aba.jpg","w":5344,"h":4008,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/f\/bfba54c9818b0c920167d7011f112aba"}611603

EDIT

Updating VBox to 5.2.12 fixed it. xD

Bob, I think you forgot to 'make install'.

Bob Keane

I remembered make install, I had to use the sudo command. I think I'll try installing with the monoliths. Maybe then I'll get code::blocks to work with it.

<edit> Got it working in code::blocks.:D I had to hunt for some files but these instructions helped.

Edgar Reynaldo

You shouldn't need sudo to install at all. Don't install to /usr thats dumb. Let allegro pick the default install folders which are /usr/local/include and /usr/local/lib .

Those instructions are not the greatest. Really it shouldn't be this hard.

I think the wiki has an article that explains it better :

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

Except they give the same bad advice. Also I updated the version of allegro they tell you to checkout. You should be 'git checkout'ing 'master' or '5.2'.

If you install to the default location, that is /usr/local. There's nothing wrong with that. Some users may have to run 'sudo ldconfig' before it will link properly but that's not hard, and it keeps allegro out of system libraries. That's what /usr/local is for.

Bob Keane

The install failed without using sudo, I never checked the logs but since it worked with sudo, I assumed it was a rights issue. I did use the default settings and everything is in usr/local. I'll have to try this weekend due to my schedule. Code::blocks locks up whenever I open the Blades of Exile sources, so I'm going to have to find another editor. Busy, busy, busy.

bamccaig
Bob Keane said:
export PKG_CONFIG_PATH=/Downloads/allegro-5.2.4.0/build/lib/pkgconfig

You have a Downloads directory in the root of the file system? :-/ That seems odd. Make sure it's an absolute path from the root. Also, verify the current value of the variable while testing:

echo $PKG_CONFIG_PATH

Ensure that the ownership/permissions/flags are correct as well.

I also suggest finding all *.pc files in the system to verify.

find / -iname '*.pc'

Also, what OS are you running? Looks like either OS X, Linux, BSD, or some other Unix variant?

Bob Keane
Bamccaig said:

You have a Downloads directory in the root of the file system?

No I don't. Maybe I'm not using the correct path. I'm using Fedora. I'll see what happens Saturday.

bamccaig

You probably want ${HOME}/Downloads instead. But either way, verify your paths. I never "install" things into my Downloads directory so that's off on its own. I would move it to a more conventional place to work with, and ensure I know the path(s) to the headers for includes, libraries for linking, and shared objects/executables for runtime.

Fedora should match this assumption. System packages will install libraries to /usr. Headers will be in /usr/include and shared objects or archives will be in /usr/lib. Executables will be in /usr/bin. It may be nested for 64-bit platform, but that's all the variance I would expect.

Thread #617474. Printed from Allegro.cc