Allegro Library not detected by gcc
Installed Allegro Library 5.0
Slackware 13.37 (on old computer), running x windows Everything seemed to be installed successfully, I followed all the compile instructions. Tried to set the Allegro directory so it was in the path (detectable - previous advice from here). That didn't help either. I load up my file in Emacs and hit compile, then type gcc myfile.c -save-temps -o myfile.exe tell me where gcc libraries are kept, so I can manually copy the Allegro libraries into that directory? I don't even mind if I have to copy multiple files all over the place. Just want to be able to use Allegro. |
Quote:
Code:
gcc myfile.c -save-temps -o myfile.exe $(allegro-config --libs) I assume you're continuing where you left off here, btw? http://www.linuxquestions.org/questi...es-4175491443/ |
Thanks so much for the speedy reply.
Thanks for finding that old thread. (from memory, the compiler says it can't find any of the allegro functions - lists them all, but I'll give you exact details of any problems) |
Quote:
|
In debian allegro has a pkg-config .pc file.
$ gcc file.c -o file.exe $(pkg-config --cflags --libs allegro) Perhaps with -Wall -Wextra to help debug any quirks with the build. You might just be missing a -dev package, although I'm not sure if slackware breaks them up like that. Last time I used it, most everything was installed out of the box and I didn't need to seek things to compile any whims I had at the time. Outside of versioning issues anyway. As I recall using allegro to build a crude graphics editor on windows in the mid 90s with the help of djgpp. |
Nope that did not work:
-*- mode: compilation; default-directory: "/root/" -*- /bin/bash: allegro-config: command not found /tmp/ccBLXcJN.o: In function 'main' Myio.c;(.text+0xbe): undefined reference to 'Al_install_system' Myio.c;(.text+0xbe): undefined reference to 'Al_install_keyboard' Myio.c;(.text+0xbe): undefined reference to 'Al_create_timer' Myio.c;(.text+0xbe): undefined reference to 'Al_create_display' Myio.c;(.text+0xbe): undefined reference to 'Al_destroy_timer' and repeat this for every function that is in Myio.c file. Allegro directory at /usr/local/include/Allegro5 - all the libraries look okay. I'll try Shadows suggestion, now. I tried to install VCL Media Player and it came up in my right click - to play open with VCL Media Player but it always failed - not sure if VCL just wouldn't work with slackware. Or perhaps there is something that I'm doing wrong with my installations. Installation comes up as successful. I just follow the install instructions, perhaps slackware needs another step that is common knowledge but I'm not aware of? |
$ gcc file.c -o file.exe $(pkg-config --cflags --libs allegro)
Gave me this: package allegro was not found on the pgk-config search path perhaps you should add the directory containing 'allegro.pc' to the PKG_CONFIG_PATH environment variable. No package 'allegro' found. the the regular allegro function list not found in my .c file So how do I add directory to the PKG_CONFIG_PATH? |
If it's really PKG_CONFIG_PATH, then you can temp override it.
$ $(PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/ pkg-config --cflags --libs allegro-5.0) -I/usr/include/x86_64-linux-gnu -lallegro Which makes this gcc command: $ gcc file.c -o file.exe $(pkg-config --cflags --libs allegro-5.0) turn into this: $ gcc file.c -o file.exe -I/usr/include/x86_64-linux-gnu -lallegro Which might work for you completely ignoring the pkg-config or allegro-config options. Note that the .pc is allegro-5.0, not vanilla allegro which appears to be version 4's method. Tools like find are good for figuring this out. Or apt-file in debian for finding it out about packages not yet installed. YMMV |
Reinstall Allegro. This time use this:
https://www.slackbuilds.org/reposito...aries/allegro/ Yes it will work with 13.37. Quote:
The way to install VLC is to download the package from here: http://www.slackware.com/~alien/slackbuilds/vlc/pkg/ And then to install it with installpkg. If you'd followed any other "instructions", they were wrong. |
You might hate me for this. I didn't follow your instructions.
Because I was concerned about the x86_64 bit of your instruction - pretty sure my version is not 64bit - perhaps that has nothing to do with it and I'm stupid, tell me if that's the case. HERE IS WHAT I DID: Found: usr/local/include/Allegro5 (all the libraries) usr/share/gcc4.5.2 (copied all of /Allegro5 in here) Found: usr/local/lib/pkgconfig (FULL of allgero library files ending in .pc) usr/lib/pkgconfig (copied all of those files into here GRRRRR!) Compiled with this command gcc Myio.c -o Myio.exe $(pkg-config --cflags --libs allegro5.0) (no idea which thing I did worked, or if it was just the different compile line) It worked PERFECTLY! I'M TOTALLY OVER THE MOON NOW. Six months of this pathing bullshit, seriously WTF! Surely there is an easier way to get things in the path! A text configuration file I can edit? Dungan: I want Allegro 5 because there are significant changes between 4 & 5, so I'd rather learn 5. Thanks for your VLC tip, I'll go back and review that. |
That's what pkg-config is for, to return the "things" needed for "your" system. The x86_64 part was what it returned for "my" system. A hail mary in case all else failed.
|
Quote:
I did look up how to use pkg-config, there was one bit that I found that stated I should export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/ But it was not clear if this would wreck my current paths. I'll need to do more research on pkg, and start a different post to see if I'm understanding it. I'm not too sure if copying all those files made any difference. Tried different compile lines (the original ones) and the compile failed. So perhaps it was just the new compile line you gave me lol (sorry for being a bit frustrated - I'll put my frustration to better use in the future) |
That's what I love about debian. There's apt-file, so if your compile fails because it cannot find "a" file, install it. Try again, and add what you "need" as you need it. Versus other distros that are basically install "*" and it might work. I don't have that kind of bandwidth, or time. As I spent "ALL" of last weekend getting a windows 8.1 install last "used" in July of 2016 up to "date". And basically 3 days, 3 different ways of fixing windows update, and 5G's of "updates" later (windows offline update), and mission reluctantly accomplished. So I could take a typing test circa a web service whos min-req was NT4. So I could count smalls boxes inside a large box (warehouse) for a living.
|
All times are GMT -5. The time now is 09:30 PM. |