Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro installed wrong on Linux

This thread is locked; no one can reply to it. rss feed Print
Allegro installed wrong on Linux
Chris Katko
Member #1,881
January 2002
avatar

I've built Allegro 5.1.x while back. Linux/Ubuntu.

I ran make. I ran sudo make install.

ldconfig -p | grep allegro

Results in:

#SelectExpand
1 liballegro_ttf.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_ttf.so.5.1 2 liballegro_ttf.so (libc6,x86-64) => /usr/local/lib/liballegro_ttf.so 3 liballegro_primitives.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_primitives.so.5.1 4 liballegro_primitives.so (libc6,x86-64) => /usr/local/lib/liballegro_primitives.so 5 liballegro_memfile.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_memfile.so.5.1 6 liballegro_memfile.so (libc6,x86-64) => /usr/local/lib/liballegro_memfile.so 7 liballegro_main.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_main.so.5.1 8 liballegro_main.so (libc6,x86-64) => /usr/local/lib/liballegro_main.so 9 liballegro_image.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_image.so.5.1 10 liballegro_image.so (libc6,x86-64) => /usr/local/lib/liballegro_image.so 11 liballegro_font.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_font.so.5.1 12 liballegro_font.so (libc6,x86-64) => /usr/local/lib/liballegro_font.so 13 liballegro_color.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_color.so.5.1 14 liballegro_color.so (libc6,x86-64) => /usr/local/lib/liballegro_color.so 15 liballegro_audio.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_audio.so.5.1 16 liballegro_audio.so (libc6,x86-64) => /usr/local/lib/liballegro_audio.so 17 liballegro_acodec.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_acodec.so.5.1 18 liballegro_acodec.so (libc6,x86-64) => /usr/local/lib/liballegro_acodec.so 19 liballegro.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro.so.5.1 20 liballegro.so (libc6,x86-64) => /usr/local/lib/liballegro.so

However,

 allegro-config --libs --cflags

Results in:

-I/usr/include
-L/usr/lib/x86_64-linux-gnu -lalleg

Either way, I can't get G++ to link the most basic of programs. It can't find the library. I recall previously I "got around it" by hardcoding every applicable library with -I and -L but that is a mess and I can't find my previous workaround. So instead of starting over, I imagine it'd be better to fix the problem overall.

To be clear, this should compile, right?

g++ main.cpp -o main `allegro-config --cflags --libs`

[edit]

Perhaps that's A4. Per the docs, this should work:

g++ main.cpp -o main `pkg-config --cflags --libs allegro-5.1 allegro_acodec-5.1 allegro_audio-5.1 allegro_color-5.1 allegro_dialog-5.1 allegro_font-5.1 allegro_image-5.1 allegro_main-5.1 allegro_memfile-5.1 allegro_physfs-5.1 allegro_primitives-5.1 allegro_ttf-5.1` --std=c++11

But my PKG_CONFIG_PATH env variable was missing. I added /usr/local/lib, but still fails.

#SelectExpand
1Package allegro-5.1 was not found in the pkg-config search path. 2Perhaps you should add the directory containing `allegro-5.1.pc' 3to the PKG_CONFIG_PATH environment variable 4No package 'allegro-5.1' found 5Package allegro_acodec-5.1 was not found in the pkg-config search path. 6Perhaps you should add the directory containing `allegro_acodec-5.1.pc' 7to the PKG_CONFIG_PATH environment variable 8No package 'allegro_acodec-5.1' found 9Package allegro_audio-5.1 was not found in the pkg-config search path. 10Perhaps you should add the directory containing `allegro_audio-5.1.pc' 11to the PKG_CONFIG_PATH environment variable 12No package 'allegro_audio-5.1' found 13Package allegro_color-5.1 was not found in the pkg-config search path. 14Perhaps you should add the directory containing `allegro_color-5.1.pc' 15to the PKG_CONFIG_PATH environment variable 16No package 'allegro_color-5.1' found 17Package allegro_dialog-5.1 was not found in the pkg-config search path. 18Perhaps you should add the directory containing `allegro_dialog-5.1.pc' 19to the PKG_CONFIG_PATH environment variable 20No package 'allegro_dialog-5.1' found 21Package allegro_font-5.1 was not found in the pkg-config search path. 22Perhaps you should add the directory containing `allegro_font-5.1.pc' 23to the PKG_CONFIG_PATH environment variable 24No package 'allegro_font-5.1' found 25Package allegro_image-5.1 was not found in the pkg-config search path. 26Perhaps you should add the directory containing `allegro_image-5.1.pc' 27to the PKG_CONFIG_PATH environment variable 28No package 'allegro_image-5.1' found 29Package allegro_main-5.1 was not found in the pkg-config search path. 30Perhaps you should add the directory containing `allegro_main-5.1.pc' 31to the PKG_CONFIG_PATH environment variable 32No package 'allegro_main-5.1' found 33Package allegro_memfile-5.1 was not found in the pkg-config search path. 34Perhaps you should add the directory containing `allegro_memfile-5.1.pc' 35to the PKG_CONFIG_PATH environment variable 36No package 'allegro_memfile-5.1' found 37Package allegro_physfs-5.1 was not found in the pkg-config search path. 38Perhaps you should add the directory containing `allegro_physfs-5.1.pc' 39to the PKG_CONFIG_PATH environment variable 40No package 'allegro_physfs-5.1' found 41Package allegro_primitives-5.1 was not found in the pkg-config search path. 42Perhaps you should add the directory containing `allegro_primitives-5.1.pc' 43to the PKG_CONFIG_PATH environment variable 44No package 'allegro_primitives-5.1' found 45Package allegro_ttf-5.1 was not found in the pkg-config search path. 46Perhaps you should add the directory containing `allegro_ttf-5.1.pc' 47to the PKG_CONFIG_PATH environment variable 48No package 'allegro_ttf-5.1' found 49/tmp/ccm0Fyr4.o: In function `main': 50main.cpp:(.text+0x14): undefined reference to `al_install_system' 51main.cpp:(.text+0x23): undefined reference to `al_create_display' 52main.cpp:(.text+0x3b): undefined reference to `al_map_rgb' 53main.cpp:(.text+0x70): undefined reference to `al_clear_to_color' 54main.cpp:(.text+0x75): undefined reference to `al_flip_display' 55main.cpp:(.text+0x8d): undefined reference to `al_rest' 56main.cpp:(.text+0x99): undefined reference to `al_destroy_display' 57collect2: error: ld returned 1 exit status

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Elias
Member #358
May 2000

pkg-config retrieves information about packages from special metadata files. These files are named after the package, and has a .pc extension. On
most systems, pkg-config looks in /usr/lib/pkgconfig, /usr/share/pkgconfig, /usr/local/lib/pkgconfig and /usr/local/share/pkgconfig for these files.
It will additionally look in the colon-separated (on Windows, semicolon-separated) list of directories specified by the PKG_CONFIG_PATH environment
variable.

So, it already should look in /usr/local/lib/pkgconfig (on "most systems" at least). And if not, then the path to set PKG_CONFIG_PATH to would be /usr/local/lib/pkgconfig and not /usr/local/lib.

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

Chris Katko
Member #1,881
January 2002
avatar

Interesting!

Removing the .1 and just using:

g++ main.cpp -o main `pkg-config --cflags --libs allegro-5` --std=c++11

Successfully compiles and links!

In my usr/local/lib/pkgconfig directory there are only files named for Allegro-5. Should there be ones for Allegro-5.1?

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

SiegeLord
Member #7,827
October 2006
avatar

It's not supported to have both 5.1 and 5.0 installed at the same time. allegro-5 pkgconfig file refers to the latest version you've installed. Indeed, we used to append the sub version to those files, but our Debian packagers suggested we drop it, as that simplifies build system upkeep. The only reason we even have a 5 there is because there's also Allegro 4.

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

Chris Katko
Member #1,881
January 2002
avatar

So I ran sudo apt-get remove with all allegro5 libs (there were only a couple).

Those pkgconfig files still exist. I can still compile successfully using pkgconfig --cflags --libs allegro5 which reports:

-I/usr/local/include  -L/usr/local/lib -lallegro

ldconfig -p still shows the same... I think the .so files are symbolic links to .so.5.11 libs.

#SelectExpand
1 liballegro_ttf.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_ttf.so.5.1 2 liballegro_ttf.so (libc6,x86-64) => /usr/local/lib/liballegro_ttf.so 3 liballegro_primitives.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_primitives.so.5.1 4 liballegro_primitives.so (libc6,x86-64) => /usr/local/lib/liballegro_primitives.so 5 liballegro_memfile.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_memfile.so.5.1 6 liballegro_memfile.so (libc6,x86-64) => /usr/local/lib/liballegro_memfile.so 7 liballegro_main.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_main.so.5.1 8 liballegro_main.so (libc6,x86-64) => /usr/local/lib/liballegro_main.so 9 liballegro_image.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_image.so.5.1 10 liballegro_image.so (libc6,x86-64) => /usr/local/lib/liballegro_image.so 11 liballegro_font.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_font.so.5.1 12 liballegro_font.so (libc6,x86-64) => /usr/local/lib/liballegro_font.so 13 liballegro_color.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_color.so.5.1 14 liballegro_color.so (libc6,x86-64) => /usr/local/lib/liballegro_color.so 15 liballegro_audio.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_audio.so.5.1 16 liballegro_audio.so (libc6,x86-64) => /usr/local/lib/liballegro_audio.so 17 liballegro_acodec.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro_acodec.so.5.1 18 liballegro_acodec.so (libc6,x86-64) => /usr/local/lib/liballegro_acodec.so 19 liballegro.so.5.1 (libc6,x86-64) => /usr/local/lib/liballegro.so.5.1 20 liballegro.so (libc6,x86-64) => /usr/local/lib/liballegro.so

[edit]

Looks like all that was removed was Allegro 4. >:(

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Go to: