![]() |
|
Ubuntu, Allegro 4.9.9.1, GCC, PNG |
nzmike
Member #10,841
March 2009
|
Hello Allegro community, I've recently come across Allegro and am excited to start using it however I'm having a few problems setting it up. So my current environment is: OS - Ubuntu 9.04 Beta The steps I've taken so far are (I've described each step in detail as it might be useful for other beginners trying to get allegro set up on Ubuntu): 1) Installed subversion - sudo apt-get install subversion This is where I'm up to at the moment. So I've compiled the zlib and lpng but and unable to compile loadpng, I get the following errors after I run sudo make: gcc -W -Wall -O3 -I. -c -o loadpng.o loadpng.c To me it looks like it's looking for the allegro library but can't find it. Is there as special place I am meant to put the loadpng folder? And can someone explain to me what zlib, lpng and loadpng actually are? My understanding is zlib is a compression library installed on the operating system, i'm unsure what lpng is and loadpng is a script specifically made for allegro to make using lpng and zlib easier. Sorry about the long post I just thought I would let everyone know exactly what I've done so far so there's no confusion. Cheers, Mike |
Thomas Fjellstrom
Member #476
June 2000
![]() |
nzmike said: 7) Downloaded zlib, lpng and loadpng You actually need zlib, and libpng. not loadpng and lpng (whatever that is). loadpng is an Allegro 4.2 addon, it is not compatible with Allegro 4.9. -- |
nzmike
Member #10,841
March 2009
|
Thanks for the reply. By lpng I think I meant libpng. Ok so I've tried to compile allegro using make but came across some errors. Here's my output: Scanning dependencies of target allegro I don't understand the error and I've a look around the forums for a similar error but couldn't find anything. I've had a look in the usr/local/lib directory in terminal and I can see the libz.a file. Here's what running gcc --version gives me: Anyone have any idea? |
Evert
Member #794
November 2000
![]() |
Could this be a 64 bit vs 32 bit issue? |
Elias
Member #358
May 2000
|
Why don't you just use Ubuntu's zlib? -- |
nzmike
Member #10,841
March 2009
|
Yes my operating system in running in 64 but. I'm not sure how to compile allegro for 64bits. I'm also not sure if I've compiled zlib for 32bit or 64bit (I'll check this when I get home in a few hours). I did see a zlib library in synaptic but it didn't seem to be the latest version. Does Allegro require the latest version or will the one in synaptic be fine? (I'll get the version number of the synaptic one when I get home) |
Peter Wang
Member #23
April 2000
|
Any zlib/libpng released in the last two decades will be fine.
|
nzmike
Member #10,841
March 2009
|
Ok in Synaptic I have a package installed called 'zlib1g' which is version 1:1.2.3.4.dfsg-12ub, there is another package there called zlibc which is version 0.9k-4. I tried uninstall the zlib1g but there were quite a few programs that need this library so I decided against that. I then tried installing the zlibc package and running cmake and make again but I'm still getting the same error. I should also mention that libpng is version 1.2.27 according in Synaptic. You suggested I run zlib with the 'file' command to check whether it was installed for a 32bit or 64 system, could you please explain how to use this command as I'm unsure what to do. |
Elias
Member #358
May 2000
|
What you want is the -dev package, like with the other -dev packages. This one looks right to me: http://packages.ubuntu.com/jaunty/zlib1g-dev [Edit:] Or better, just get the png dev lib, and Ubuntu will install dependencies on its own: http://packages.ubuntu.com/jaunty/libpng12-dev -- |
nzmike
Member #10,841
March 2009
|
Ok thanks for the advice Elias. I've installed the dev packages you suggested and they are located in a folder called lib64 in usr. The make file is looking for zlib.a in /usr/lib. How do I change this to point to usr/lib64. I had a look around the config files but couldn't find anything to do with zlib. I'm getting close I can feel it :-). Thanks for the help so far. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Is it allegro's makefile thats looking for /usr/lib? If so, you can pass /usr/lib64 to configure with its --libdir argument. edit: Oh crap, I forgot you're using Allegro 4.9, there is no configure... Gimme a moment, I'm sure theres a way to pass the same info to cmake. edit2: Yup, just set LIB_SUFFIX to 64 when running cmake (or set it in ccmake). Using cmake, that'd be: cmake -DLIB_SUFFIX=64 ..
-- |
nzmike
Member #10,841
March 2009
|
I tried adding the flags you suggested but I'm still getting the same error: mike@mike:~/allegro/4.9/Build$ sudo cmake -DLIB_SUFFIX=64 .. It still seems to be looking at /usr/local/lib/libz.a for the libz.a where as the one I've installed is at /usr/lib64/libz.a as far as I believe. There is a libz.a at both these locations as well as at /usr/lib/libz.a. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Ok, blow away your Build dir first and try again. For some reason its pulling in libz from /usr/local, did you install that yourself? You should probably remove it if you did (chdir into the build dir for that install and make uninstall it). -- |
nzmike
Member #10,841
March 2009
|
Thanks, deleting the Build directory seemed to do the trick. I've compiled it and now I'm tried to get it to work with Code::Blocks. I've added 'allegro5-config --libs' (without the quotation marks) |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Did you remember to install allegro? sudo make install Also, you'll want to add `allegro5-config --libs` with the backticks to the "Extra linker options" pane in Code::Blocks. I can't recall actually if the pkgconfig stuff got into 4.9.9[.1] or not, but if its there, go into the project settings and you'll see a large list of packages that pkgconfig exports, allegro and its addons (that got installed) should be in there, so you won't have to mess with allegro5-config at all. -- |
nzmike
Member #10,841
March 2009
|
Cheers Thomas I just needed to add the back-ticks. Ok so I've compiled a basic Allegro5 program but when the application is run it comes up with "/home/mike/project/bin/Debug/COSC345: error while loading shared libraries: liballegro-4.9.10.so: cannot open shared object file: No such file or directory Press ENTER to contine." So it looks like its trying to find liballegro-4.9.10.so in my project folder. Why is it trying to do this? |
Thomas Fjellstrom
Member #476
June 2000
![]() |
nzmike said: So it looks like its trying to find liballegro-4.9.10.so in my project folder. Why is it trying to do this? I'm assuming it really isn't. But that you let cmake set the install dir to /usr/local, and /usr/local/lib isn't always in the ld.so path (check /etc/ld.so.conf.d/libc.conf or one of the other files in the same dir for /usr/local/lib if it isn't there, add it to libc.conf, and run sudo ldconfig). Edit: Or of course, uninstall allegro, and tell cmake to install to /usr instead: cmake -DLIB_SUFFIX=64 -DCMAKE_INSTALL_PREFIX=/usr .. and redo the install. -- |
nzmike
Member #10,841
March 2009
|
It works!! Thank you so much for everyone's time, you've all been extremely helpful. Hopefully this thread proves useful for someone else having problems compiling the latest version of Allegro. |
|