How to : BlitzMax on Ubuntu 12.04 LTS

Archives Forums/Linux Discussion/How to : BlitzMax on Ubuntu 12.04 LTS

dawlane(Posted 2012) [#1]
Greetings to all. It's been a while since I've played around with Ubuntu and now it's at version 12.04, so I thought I would have a bash at getting BlitzMax to work with it.

So to start with I used a clean install of Ubuntu 12.04 LTS and using BlitzMax 1.48. An upgraded from a earlier version of Ubuntu could be a bit of a mess.

32bit Installation
sudo apt-get update
sudo apt-get install g++ gcc build-essential
sudo apt-get install libglu1-mesa-dev x11proto-core-dev x11proto-gl-dev x11proto-kb-dev libxxf86vm-dev libasound2-dev libfreetype6-dev libxpm-dev libxft-dev
You will also need to follow one of skid's threads to get sound working (see below the 64bit version install method.)

64Bit Installation
I've found out there have been a few changes regarding the 64bit version as the usual ia32-libs package is being replaced with a new method of dealing with 32bit application on a 64bit system. The /usr/libs32 directory is still there, but there are very few libs left in there as now they reside in /usr/lib/i386-linux-gnu when the new ia32-libs-mutiarch package is installed.
One problem I've had is sound out of the box; but I've got sound working by using skidracers pulse-audio driver or you can now use the fixed ALSA driver.

First we install the packages using a terminal.

sudo apt-get update
sudo apt-get install ia32-libs-multiarch g++-multilib build-essential
sudo apt-get install libglu1-mesa-dev x11proto-core-dev x11proto-gl-dev x11proto-kb-dev libxxf86vm-dev libasound2-dev libfreetype6-dev libxpm-dev libxft-dev


Next we need some symbolic links to the libs that we need to use.
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib32/libGL.so
sudo ln -s /usr/lib/i386-linux-gnu/libGLU.so.1 /usr/lib32/libGLU.so
sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib32/libX11.so
sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so.6 /usr/lib32/libfreetype.so
sudo ln -s /usr/lib/i386-linux-gnu/libXxf86vm.so.1 /usr/lib32/libXxf86vm.so
sudo ln -s /usr/lib/i386-linux-gnu/libXft.so.2 /usr/lib32/libXft.so
sudo ln -s /usr/lib/i386-linux-gnu/libXpm.so.4 /usr/lib32/libXpm.so

If you compile and you get can't find such and such due to an update etc, then use the method above to create a symbolic link by first finding the actual target libs true name. The symbolic's links usually the targets name with every thing to the right of the .so.x removed (x being any number ).
Note if things break after an update use the rm command to remove the current broken link e.g. sudo rm /usr/lib/libfreetype.so and then redo the link with the updated version of that .so file.

Ok you should now be able to compile the sample files that come with BMax. But you may not get sound.

The sound issue.
As I haven't got the time to look deeply into this. I used skidracer's pulse audio driver as an alternative.
Here's the link read it through and don't use MaxIDE to copy and paste the cpp code. Use a text editor like notepad for this. skid's also also fixed the ALSA driver as well. See here for details.
I actually put these files into path_to_blitzmax/mod/pub.mod/freeaudio.mod
One thing to note is that BlitzMax/mod/brl.mod/freeaudioaudio.bmx is related to this so you may want to update the code at the bottom to reflect what sound driver name your using.
Then rebuild all the modules.

If your using the 64bit version of ubuntu then you'll need to add another symbolic link for the dound driver your using.
For Pulse Audio
sudo ln -s /usr/lib/i386-linux-gnu/libpulse-simple.so.0 /usr/lib32/libpulse-simple.so
For ALSA
sudo ln -s /usr/lib/i386-linux-gnu/libasound.so.2 /usr/lib32/libasound.so
and you should have sound.


impixi(Posted 2012) [#2]
Thanks. I had to follow this procedure to get BlitzMax working for Linux Mint 13 64-bit (MATE desktop). Skidracer's pulse audio driver also works nicely.


SystemError51(Posted 2012) [#3]
I did those steps on 11.10 before, apps did segfault (but compiling fine). Will test again on 12.04.


dawlane(Posted 2012) [#4]
@SystemError51:What GFX hardware are you using? And where does the segfault occur when you debug the code?
All the samples compile and run fine apart from when I try the GUI launcher sample then I get a segfault when it tries to create a FLT canvas.


SystemError51(Posted 2012) [#5]
On Ubuntu 12.04 the above steps with all the multilibs etc, now seems to have fixed the problem. Programs compile and run fine.

Weird.


Grisu(Posted 2012) [#6]
Can someone please describe how to get the audio driver running under Ubuntu 12.04 (32-Bit). - I can't create the symbolic links as mentioned in the #1 post.

Is Brucey's FMod module still usable under the latest Ubuntu distribution?
I get a segmentation fault, but this might be related to my general audio driver problem.




dawlane(Posted 2012) [#7]
You shouldn't need a symbolic link for any 32bit OS. The two links in the first post are for the 64bit OS versions only.

The pulse audio drive isn't installed by default in Ubuntu 12.04. And the current version of BlitzMax's oss/alsa audio driver doesn't work. You have to either use skidracer's pulse audio driver or the fix that skidracer has done for the alsa driver and then rebuild the modules. Links are in the first post.

If your getting a segfault see if it's any of the maxGUI code, for some reason the gui launcher caused this to happend to me (I suspect FLT Canvas has something to do with it).


Grisu(Posted 2012) [#8]
Thanks, got the alsa driver and Fmod working now. Can't these fixes be added to the official distribution?

MaxGUI has massive problems with the WINDOW_HIDDEN flag as well as Hide and Showgadget(), these caused segmentation faults for me.


dawlane(Posted 2012) [#9]
MaxGUI has massive problems with the WINDOW_HIDDEN flag as well as Hide and Showgadget(), these caused segmentation faults for me.
The are a few posts in the MaxGUI bug section about this.


Dinosorceror(Posted 2012) [#10]
I've just updated my Linux Mint, and now BlitzMax projects won't compile anymore. I had gotten it to work for quite a few updates with the instructions in this post, but now when I try to compile anything, I get an error near the end. The error is:

/usr/bin/ld: cannot find -lGLU

Here's a example of me trying to compile Digesteroids:


Building digesteroids
Compiling:simplephysics.bmx
flat assembler version 1.68 (32768 kilobytes memory)
4 passes, 57473 bytes.
Compiling:minitimer.bmx
flat assembler version 1.68 (32768 kilobytes memory)
3 passes, 5416 bytes.
Compiling:dynamicgame.bmx
flat assembler version 1.68 (32768 kilobytes memory)
3 passes, 11278 bytes.
Compiling:MathUtil.bmx
flat assembler version 1.68 (32768 kilobytes memory)
3 passes, 6542 bytes.
Compiling:digesteroids.bmx
flat assembler version 1.68 (32768 kilobytes memory)
4 passes, 152908 bytes.
Linking:digesteroids.debug
/usr/bin/ld: cannot find -lGLU
collect2: ld returned 1 exit status
Build Error: Failed to link /home/xo4/BlitzMax/samples/digesteroids/digesteroids.debug
Process complete


Dinosorceror(Posted 2012) [#11]
Oh, I'm betting I need to update one of those symbolic links, and I see which one. I'll give it a shot.


Dinosorceror(Posted 2012) [#12]
Yep, that did it. I had to issue the following commands:

sudo rm /usr/lib32/libGLU.so
sudo ln -s /usr/lib/i386-linux-gnu/libGLU.so.1.3.08004 /usr/lib32/libGLU.so

...since that GLU library updated from 08000 to 08004. Compiling works again!


Dinosorceror(Posted 2012) [#13]
Okay, now I've rebuilt a box with Ubuntu 12.10 (64-bit), and I can't even get the IDE to run at all. Before I start putting the dependencies back for compilation, this doesn't seem right. Back when I opened the BlitzMAX archive in Mint, the IDE would run, but I needed to follow the steps for compilation. Now the IDE won't run at all? Does that seem weird to anyone else?


Dinosorceror(Posted 2012) [#14]
Hrm, guess I did need to do those dependencies just to run the IDE. I'm going to make a fresh post about Ubuntu 12.10 64-bit for reference in the future, including how to get the PulseAudio working.