HowTo Install FreeBASIC into openSUSE 10.x and 11.x (32 bit and 64 bit)

Versions: the 32 bit install has been verified in 10.x and 11.x. The 64 bit version has been verified for 11.x (to 11.3 inclusive).

Pitch: FreeBASIC is alive and very healthy. If you want to write sophisticated programs with a language that equals PHP but with standalone executables, FreeBASIC is the answer. If you don't want to spend a year learning C and C++, FreeBASIC is the answer. It's a no-brainer to choose FreeBASIC.

Installing RPMs to support the compiler: A series of libraries are required to support the FreeBASIC compiler. You install then with Yast --> Software --> Software Management. The list differs between 32 and 64 bit openSUSE. Read the left column if you have a 32 bit install and the right if you have a 64 bit install.

Install these RPM's into 32 bit openSUSE

  • gcc
  • gcc-c++
  • ncurses-devel
  • xorg-x11-libX11-devel
  • xorg-x11-libXext-devel
  • xorg-x11-libXpm-devel
  • xorg-x11-libXrender-devel
  • gtk2-devel

Install these RPM's into 64 bit openSUSE

  • gcc-32bit
  • xorg-x11-libX11-devel-32bit
  • xorg-x11-libXext-devel-32bit
  • xorg-x11-libXpm-devel-32bit
  • xorg-x11-libXrender-devel-32bit
  • ncurses-devel-32bit

Download and Install the compiler: The compiler comes in two variations. There's a standard version and a so-called "standalone" version. The standalone version has extra libraries in the download. You must use the standalone version to install in openSUSE 64 bit. I recommend you use the standard version to install in openSUSE 32 bit. So read the left column if you have a 32 bit openSUSE and the right if you have a 64 bit openSUSE.

Install the compiler into 32 bit openSUSE

You can download the standard compiler for Linux-x86, including libraries, headers, etc. without docs and sources from the fbc standard download link. Unzip the FreeBASIC tar.gz file anywhere convenient.

FreeBASIC compiler, fbc, is installed by executing the shell script install.sh with this command in a terminal window:

sudo ./install.sh -i

Here's a copy of the terminal session:

tim@host:~> sudo ./install.sh -i
root's password:
===================================
FreeBASIC compiler successfully installed in /usr/local
===================================
tim@host:~>

You can uninstall the standard compiler with this command:

sudo ./install.sh -u

Install the compiler into 64 bit openSUSE

You can download the standalone compiler for Linux-x86, including libraries, headers, etc. without docs and sources from the fbc standalone download link. Unzip the FreeBASIC tar.gz file anywhere convenient.

FreeBASIC compiler, fbc, is installed by executing the shell script install-standalone.sh with this command in a terminal window:

sudo ./install-standalone.sh -i

Here's a copy of the terminal session:

tim@host:~> sudo ./install-standalone.sh -i
root's password:
===================================
FreeBASIC compiler successfully installed in /usr/share/freebasic
A link to the compiler binary has also been created as /usr/bin/fbc
===================================
tim@host:~>

You can uninstall the standalone compiler with this command:

sudo ./install-standalone.sh -u

Install Xrandr libs into 64 bit openSUSE: Do not do this for 32 bit, only for 64 bit openSUSE. The Xrandr libs can't be installed from an RPM using the Yast Software module. I've put zipped packages of the files for you on this site; see the list below:

  • Use this link for openSUSE 11.1 to download file lib32.ver111.tar.gz
    [contains libXrandr.a, libXrandr.la, libXrandr.so, libXrandr.so.2 and libXrandr.so.2.1.0]
  • Use this link for openSUSE 11.2 to download file lib32.ver112.tar.gz
    [contains libXrandr.so(link), libXrandr.so.2(link) and libXrandr.so.2.2.0]
  • Use this link for openSUSE 11.3 to download file lib32.ver113.tar.gz
    [contains libXrandr.so(link), libXrandr.so.2(link) and libXrandr.so.2.2.0]

Unzip thepackage to create the directory lib32 and the files will be inside. Move the directory lib32 and its files to /usr/share/freebasic so the files are in /usr/share/freebasic/lib32. Then edit the file elf_i386.x located at/usr/share/freebasic/lib/linux/elf_i386.x. Find the line containing the search paths, about fourth line down containing terms like these:

SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");

and add an extra search path indicating the /usr/share/freebasic/lib32 directory so the line ends like this:

SEARCH_DIR(.... etc etc ..... SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/share/freebasic/lib32");

The last is all one line. Now your 64 bit openSUSE should be good to go.

Handbook: A comprehensive handbook in Windows compressed html help file format (.chm) is available from FreeBASIC.net on this link. You can open the unzipped file, "FB-manual-etc.chm" with the KDE app KchmViewer, available on the openSUSE OSS install media. It's a KDE app but you can install it into a Gnome Desktop Environment.

First Graphics Program, test.bas: You can test the compiler with a simple graphics programme that draws a few coloured lines etc. I'll list one that I know will work if installations of the prerequisite libraries and the fbc compiler all went OK. Open your favourite text editor, Gedit, Kwrite, whatever and paste these lines of code into it, then save as "test.bas":

screen 13
print "hello world"
line (20,20) - (300,180), 3
line (140,180) - (180,120), 15, b
sleep 10000
end

Screen 13 will produce a graphics box of 320x200 px. Or 19->800x600, 20->1024x768, see "Screen (Graphics)" in the chm manual file.

Compile test.bas: To compile this (or any programme) into an executable, issue command fbc test.bas in a normal user's terminal, being sure NOT to "su" to root privileges: . Here's the terminal session:

username@suse102:~/path> fbc test.bas
/usr/share/freebasic/fbc: Symbol `ospeed' has different size in shared object, consider re-linking
username@suse102:~/path>

The warning message regarding `ospeed' is just a caution. It should be ignored. It occurs because the rt library I downloaded was compiled in Debian/Ubuntu Linux. It's not important.

Run test.bas: Just issue this shell command in a terminal: ./test and here's what you'll get:

png of graphics screen

Cheers
Swerdna mid 07; last update 22 February 2010