I was advised that I should get some experience compiling pygame. I use windows and thanks to Brian/Lenard it's a one click process to install the latest version of pygame. I knew that in the future I would be needing to run tests on Linux so I thought I may as well set it up now and compile pygame on that. I toyed briefly with the idea of setting up a dual boot. I have ran that setup in the past and it's a PITA so I opted for a virtual machine running Ubuntu 8.04 running on one of my virtual desktops. Virtual insanity.
After setting up the VM and installing Ubuntu I decided to have a crack at compiling everything from source and not using apt-get. This both for the experience and because I was under the mistaken impression that the svn HEAD version of pygame required newer versions of it dependencies than available through apt-get packaging.
(The wiki has compilation steps for Mac and Windows with links to source archives of pygame dependencies. A note on the wiki says "We should have a download with everything included. As well as patches for each one that we need". Sounds like a great idea to me. Maybe an svn repo? Is there much difference between the platforms?)
I downloaded the packages and began the quite tedious process of compiling everything.
............
I eventually had all the dependencies compiled and was glad to be finally able to begin compiling pygame
$
sudo python setup.py install
............
building 'pygame.scrap' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -D_REENTRANT -I/usr/X11R6/include -I/usr/local/include/SDL -I/usr/include/python2.5 -c src/scrap.c -o build/temp.linux-i686-2.5/src/scrap.o
In file included from src/scrap.c:59:
src/scrap_x11.c: In function ‘_convert_format’:
src/scrap_x11.c:77: error: ‘XA_PIXMAP’ undeclared (first use in this function)
src/scrap_x11.c:77: error: (Each undeclared identifier is reported only once
src/scrap_x11.c:77: error: for each function it appears in.)
src/scrap_x11.c:79: error: ‘XA_BITMAP’ undeclared (first use in this function)
src/scrap_x11.c: In function ‘_add_clip_data’:
............
My happiness was shortlived. I googled the problem and found someone back in 2005 having similiar problems trying to compile qt. It was something to do with not having the XFree86 development package. Turns out this package goes by the name libx11-dev for debian/ubuntu.
I installed it but the problem remained so I turned to #pygame for help. Someone helpful there, I can't recall who, said that it seemed I was missing some X11 header files and specifically a file called Xatom.h. Off in circles again for while looking for a missing package. I was pointed toward packages.ubuntu.com.
I searched for all packages containing Xatom.h. and..... aha! "x11proto-core-dev". That must be it!
$
sudo apt-get install x11proto-core-dev
It was already installed.
What now? I harassed one of my mentors, Rene, and he said that it could be a problem with pygame-trunk/src/scrap_x11.c or that it could possibly be because I got a non X version of SDL. "Damn.., I don't think I did"
He taught me about "sudo updatedb" and "locate X" with which I was able to confirm the existence of and location of Xatom.h on the system. He recommended that I use apt-get to get ready made packages of the dependencies and compile again.
I managed to replace all the local versions of the dependencies with apt-get ones but the first time round I missed deleting a lot of them. I have not that much experience with linux. The first time I recompiled it worked but upon running the unit tests I found that 5 of them were failing.
Rene, was quick to the rescue. "my guess is you're linking to your self installed sdl_image... try ldd `find . -name imageext.so`"
That confirmed it. I hunted down all the non apt managed packages and exterminated them from the system then compiled pygame again.
1 Unit test was still failing. IS still failing.
1 ======================================================================
2 FAIL: test_spritecollide (sprite_test.SpriteTest)
3 ----------------------------------------------------------------------
4 Traceback (most recent call last):
5 File "test/sprite_test.py", line 68, in test_spritecollide
6 self.assertEqual(sprite.spritecollide(s1, ag2, dokill = False, collided = sprite.collide_rect_ratio(20.0)),[s2,s3])
7 AssertionError: [<Sprite sprite(in 1 groups)>, <Sprite sprite(in 1 groups)>] != [<Sprite sprite(in 1 groups)>, <Sprite sprite(in 1 groups)>]
This test passes fine under Windows.
The hunt is on.