I've been trying all day to get allegro to work, ran into a few problems but it was mostly ok
but now i have a another one which ive managed to indentify but cant solve
I'm using the gcc compiler but i get the same problem with make and g++ aswell
To put it simply the package on the AUR conflicts with the one from github. I'm aware that the header version is 5.2.6 but the library is 5.2.4.1, and im pretty sure this is whats causing al_init to return false. However when i remove the aur package, nothing works at all. even after reinstalling with cmake
theres also something to do with pkg-config because 'pkg-config --list-all | grep allegro' returns a bunch of packages with the AUR package isntalled, but nothing when i remove it. but i really dont understand what pkg-config is or what it does. installed allegro with 'yay -S allegro' if thats relevant
Anyway, I cant find a solution anywhere, so thats why im here. Perhaps someone can help?
thanks for reading. be really nice if you could help me
also, unimportant, but it would be wonderful if someone could show me how to compile without having to add 'pkg-config blahblahblah...' after gcc
$gcc main.cpp -o main `pkg-config --libs allegro-5 allegro_font-5 allegro_ttf-5 allegro_main-5 allegro_primitives-5 allegro_color-5 allegro_image-5 allegro_dialog-5`
$./main
edit:
just to confirm, after removing the package 'yay -R allegro', compiling using the same command as above, returns
after this, i ran... (in ~/build/)
with no errors!
but compiling still fails :/
edit2:
ran
still nothing tho
Okay, never used arch linux before but I can try to help.
Since you used 'yay -S allegro' I assume you have the dependecies installed.
You can build allegro yourself rather easily on linux once all the dependent packages are installed.
Install GIT and CMake.
Clone allegro from git. See here : https://liballeg.org/git.html
Once you have allegro cloned, build using cmake-gui or ccmake. Make sure to enable the WANT_MONOLITH option so you don't have to link to 10 different libraries.
After that, you can use pkg-config or link directly to the monolith library. By default, allegro installs to /usr/local .
Thank you so much, I didnt realise that i needed to use ccmake and not cmake.
however, im not sure if im doing the last step correctly
I added the pkgconfig folder in usr/local to pkgconfig using 'CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig' but there are still no files named allegro in 'pkg-config --list-all' and i still get these errors when compiling.
edit: forgot to add errors
I'm fairly sure i did, however, use ccmake correctly
edit2:
so i just need to link to the monolith library, right?
how do i do that?
edit3:
btw i used 'ccmake -DCMAKE_INSTALL_PREFIX=/usr ~/allegro5/' and followed the wiki's instructions on how to use it. making sure i enabled WANT_MONOLITH
edit4:
realised that in order to add the libraries, i need to add usr/local/lib and /usr/local/include to pkg-config
now, the allegro libs can be found in pkg-config, along with monolith
only problem now, is that the when compiling with
$gcc main.cpp -o main `pkg-config --libs allegro_monolith-5`
i get the error '/usr/bin/ld: cannot find -lallegro_monolith'
edit6:
also compiling with the command i used at the beginning works just fine, however i now get the error while running the compiled program: 'error while loading shared libraries: liballegro_ttf.so.5.2: cannot open shared object file: No such file
or directory'
edit7:
finally working
not a perfect setup, but i can now run ./main using 'LD_LIBRARY_PATH="/usr/local/lib" ./
main'
smh AUR update your packages
Well, looks like you got it sorted. Can be quite confusing the first time.
Allegro's .pc files will be installed the same place you specified CMAKE_INSTALL_PREFIX, usually in their own pkgconfig folder.
As you found out, you can set PKG_CONFIG_PATH and LD_LIBRARY_PATH to get everything building and running.
Congrats on figuring it out.