Wednesday, 12 February 2014

How to Install Gambas on the Raspberry Pi

Gambas is a great visual programming environment for Linux, so if you've worked with Visual Basic on Windows, you will feel right at home with Gambas.


Although you can easily install Gambas from the repository using Synaptic, if you want the most recent stable release you will need to download the source files, compile and install manually.


Generally, installing applications from the repository is the best idea. After all, its easy, the package should be stable, and all dependent files should be included.

However, certain applications are being updated very frequently. So in the case of Gambas, the repository version is way behind the current release.

Update: 22-Nov-2014

As we near the end of 2014, it is clear the world has moved on since writing this post, which only applies to Gambas versions up to 3.4.

I therefore recommend that you consider upgrading your Pi to Raspbian Jessie so you can pull Gambas 3.5 from the repository.

You will find other alternatives on the Gambas wiki, and possibly more help on the forum.

The original post continues....

Although installing using the method I'm about to describe is complicated, I hope I've detailed the steps clearly enough for the user to simply copy and paste instructions into the RaspberryPi terminal window. Basically, it should be simple if you follow this.... as long as nothing goes wrong!

The complete process will probably take the best part of 4 hours on a RaspberryPi with 512MB of RAM, but as indicated in the procedure, you can walk away and leave it for much of that time.

If you forget which step you performed last, just remember you can use the up arrow in terminal to recall your last command.

Let's Do It


I'm gonna have to assume you are reasonably happy with certain operations on the Raspberry Pi, although you wont have to do much more than start it up and open a terminal window.

So unless otherwise stated, all of the following commands/strings in this font can be copied into terminal, one at a time, and at each step just press <enter>.

It's normally a good idea to bring your Raspberry Pi up to date:-

sudo rpi-update

...after completion, re-boot your Pi

sudo apt-get update

sudo apt-get upgrade

Install required packages…

sudo apt-get install subversion

sudo apt-get install gcc g++ automake autoconf libtool libffi-dev build-essential


sudo apt-get install libgnome-keyring-dev libxtst-dev libldap2-dev libsvga1-dev libgtkglext1-dev


sudo apt-get install libcairo2 libcairo2-dev libbz2-dev unixodbc-dev libgsl0-dev librsvg2-dev


sudo apt-get install libgtk2.0-dev libpcre3-dev libbonobo2-dev libcurl4-gnutls-dev


sudo apt-get install libqtcore4 libqtgui4 libqxt-core0 libqt4-dev libqt4-opengl-dev libv4l-dev libjpeg8-dev libpng12-dev


sudo apt-get install libsdl-ttf2.0-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl1.2-dev libdirectfb-dev libimlib2-dev libtiff4-dev


sudo apt-get install libpoppler-dev libpoppler-cpp-dev libpoppler-glib-dev libpoppler-private-dev libpoppler-qt4-dev

                             
sudo apt-get install libgstreamer-plugins-base0.10-dev libqtgstreamer-dev libgstreamer-ocaml-dev


sudo apt-get install libgmime-2.6-dev


sudo apt-get install libglew-dev libxslt1-dev libsqlite3-dev libpq-dev libmysqlclient-dev


Now clean up…

sudo apt-get autoremove


Create a new directory to hold the source files…

mkdir gambasbuild


Move into new directory...

cd gambasbuild

Download the source files. In this example I want Gambas version 3.4...

svn checkout svn://svn.code.sf.net/p/gambas/code/gambas/branches/3.4

Move into newly created sub-directory...

cd 3.4

./reconf-all

...OK, step out into the fresh air, or maybe take your wife out to lunch, as you will have an hour or two to kill…(the last time I did this it took 1hr 45m)

./configure -C

...and you probably have another 20 minutes to wait
 

make


...this may make you wait another 100 minutes

sudo make install


Does It Work?


If all went well, you should now be able to start Gambas by typing in terminal:-

gambas3


To add Gambas to your menu structure, just make a launcher by creating a new blank file called Gambas.desktop and add this text:-

[Desktop Entry]
Version=1.0
Name=Gambas
Comment=Gambas IDE
Exec=gambas3
Icon=/usr/share/pixmaps/gambas3.png
Terminal=false
Type=Application
Categories=Application;Development;
StartupNotify=true


Note: you need to find a suitable icon (gambas3.png was in the files you downloaded earlier) and copy it to the pixmaps directory.

Save Gambas.desktop to: /usr/share/applications
...you need to be root to do this.



Update: Dependency Problems with V3.5


It looks like there are problems with installing Gambas 3.5 on RaspberryPi because of dependency issues. Several newer package versions are required including gstreamer which is not available in the current RaspberryPi repository. If you do attempt to install 3.5, please read the notes on the gambas website.




See also: RaspberryPi GPIO with Gambas


5 comments:

  1. Many thanks for posting this. Your detailed information enabled me to compile Gambas very easily.

    ReplyDelete
  2. I tried it twice and could not get it to work, It comes up with an error.

    ReplyDelete
    Replies
    1. I am sorry that this has not worked for.

      Do you know which part of the process failed?

      At what point do you get an error message, and what does the error message say?

      Delete
  3. Hello SteveDee. Can i you teach me how the GPIO of raspberry interact with gambas. I really stuck at gambas coding. I have done create simple GUI for raspberry but stuck at coding in gambas

    ReplyDelete
  4. Hi Paan Paan,
    Can you describe what you are having difficulty with?

    Have you tried following my notes on this post: http://captainbodgit.blogspot.co.uk/2013/11/raspberrypi-gpio-using-gambas.html
    The main points are:-
    - to use Gambas with the RaspberryPi GPIO I use the wiringPi library (which is written in C language by Gordon Henderson). So this must be installed as described.
    - the "Library" reference, "Public Extern" and "Public Const" declarations are added to the Gambas FMain.class in your project, at the beginning of this class.
    - initialise wiringPi as shown, in "Public sub Form_Open()".
    - set the "pinMode()" for any pin to either input or output.
    - use "digitalRead()" or "digitalWrite()" to read or set the pin condition
    - don't forget to run Gambas as root user, which you can do from a terminal with the command "gksu gambas3"

    I hope this helps, but please let me know if you are still having problems.

    ReplyDelete