I installed(?) allegro 5 using dnf on Fedora and thought things went well. After configuring code::blocks I tried compiling a simple program but got linking errors. I tried reinstalling and most of the packages were installed except allegro-devel. I believe I got a no such package error. I tried compiling from the command line, got errors related to allegro-devel and was prompted to install, so I said yes. the compile failed. Errors are:
gcc main.c `allegro-config --libs` /usr/bin/ld: /tmp/ccbuDCqo.o: in function `main': main.c:(.text+0x14): undefined reference to `al_install_system' /usr/bin/ld: main.c:(.text+0x34): undefined reference to `al_init_primitives_addon' /usr/bin/ld: main.c:(.text+0x74): undefined reference to `al_create_display' /usr/bin/ld: main.c:(.text+0xb3): undefined reference to `al_set_target_backbuffer' /usr/bin/ld: main.c:(.text+0xc7): undefined reference to `al_map_rgb' /usr/bin/ld: main.c:(.text+0xed): undefined reference to `al_clear_to_color' /usr/bin/ld: main.c:(.text+0x101): undefined reference to `al_map_rgb' /usr/bin/ld: main.c:(.text+0x19a): undefined reference to `al_draw_ellipse' /usr/bin/ld: main.c:(.text+0x19f): undefined reference to `al_flip_display' /usr/bin/ld: main.c:(.text+0x1b0): undefined reference to `al_rest' /usr/bin/ld: main.c:(.text+0x1bc): undefined reference to `al_destroy_display' collect2: error: ld returned 1 exit status
This leads me to believe the package is not installed or installed correctly. Am I correct? I can remove and reinstall but if there is something else going on, I'd like to find out. Thx
allegro5-devel surely?
https://koji.fedoraproject.org/koji/rpminfo?rpmID=22600737
You're linking wrong. You should be using pkg-config, not allegro-config
gcc -Wall -Wextra -Wshadow -ggdb3 -O0 `pkg-config --cflags allegro`, and add all the addon libraries you used. You're just not linking, there's nothing broken at all.
I'm pretty sure my system is messed up. I'm going to try a few other things and see what happens.
Peter?
{"name":"612942","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/0\/40e4901094aecd40353514562a599b12.jpg","w":300,"h":168,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/0\/40e4901094aecd40353514562a599b12"}
Bob - not sure what you meant with that image. I was in a rush with my poist but the point was to make sure you were installing allegro5-devel and not allegro-devel. Using allegro-config (which is provided by the latter) is going to pass Allegro 4 libs into the the linker and that might account for the missing symbols you see listed.
Cheers!
Peter, I did not notice the difference between the package you posted and what I thought I was using. I thought I sensed a little sarcasm, sorry. Still trying a few things, but confused why code::blocks does not work.
Good stuff! I have Fedora 34 in a VM so if you haven't fixed it I can have a look, though I'm not a code::blocks user. Will be tomorrow probably.
Also I noticed I've invented a new word 'poist'! It's a cross between point and post. You heard it first here...
I'm still looking into using code::blocks to make compiling easier. In the meantime, here is the code attached. What would be the terminal command to compile? I want to check my installation.
I compiled your main.c with
cc -o main -O2 -g main.c $(pkg-config --libs --cflags allegro-5 allegro_primitives-5)
(this was on Fedora 34, but I don't believe 33 would be any different)
The packages I have installed are (I have both A4 & A5, they coexist ok)
$ dnf list installed |grep allegro allegro.x86_64 4.4.3.1-5.fc34 @fedora allegro-devel.x86_64 4.4.3.1-5.fc34 @fedora allegro5.x86_64 5.2.4-7.fc34 @fedora allegro5-addon-image.x86_64 5.2.4-7.fc34 @fedora allegro5-addon-image-devel.x86_64 5.2.4-7.fc34 @fedora allegro5-devel.x86_64 5.2.4-7.fc34 @fedora
Thanks, I'll give it a shot. I did upgrade to Fedora 34 recently, I forgot to note in the thread.
EDIT:
I forgot to ask, do I need to fully qualify the path to the *.so files, ie /usr/lib64 (or lib) in the terminal command? If so the problem may be a PATH issue.
EDIT2:
I was able to compile and link in terminal, so the issue is something in code::blocks. I'll keep looking.
EDIT3: Nevermind, found it thanks.