Installing FreeBASIC in Linux HOWTO

Linux specific questions.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Installing FreeBASIC in Linux HOWTO

Postby Galeon » Nov 02, 2010 11:12

I'm currently trying out different Linux distros and decided to try installing FreeBASIC in them using VirtualBox and hard drive install.
The following are for installing FreeBASIC in Ubuntu, Debian, Fedora, Puppy and Slax distributions, and their derivatives.
There are also instructions for x86-64 architecture (AMD64, Intel64, whatever). They have a "64-bit" suffix. You don't need to read the instructions for x86 if there is a section for the 64-bit machine, i.e. read only Ubuntu 64-bit not Ubuntu unless there's no Ubuntu 64-bit in a section. Currently, Ubuntu is the only distro with instructions for 64-bit in this howto. Be aware that when compiling with a library (i.e. GTK+), you still need the 32-bit ones, that can be installed with getlibs.
When it says "tested", it doesn't mean everything is tested, only compiling a command line and gfxlib "Hello World!" program is compiled and tested to work.
Make sure to read the notes!


Before anything else:
Open a terminal in your distribution then type the following commands. Press enter after each command. Don't type the "#"!

Add your username to sudoers if you're not a sudoer:

Code: Select all

# su
# echo 'username ALL=(ALL) ALL' >> /etc/sudoers
# exit

Replace "username" with your username.
You might need to provide the superuser/root (su) password after typing the first command.
Debian and Fedora do not add the first user to the sudoers file. Ubuntu adds the first user by default. Puppy and Slax do not use sudo (you're always logged in as root), so remove any "sudo" from commands in installing FreeBASIC below.
If you're not using Puppy or Slax, or you prefer su than sudo, you may change to su then execute the commands with sudo removed.

Download FreeBASIC:
If packages are not available for your distribution, or you don't want packages created for your distribution, you need to download the official tarballs of FreeBASIC. Slax have modules available in my website (check it out in the Slax section). Puppy Linux packages are also available. A Fedora 13/14 repository is also available in my website.
Download FreeBASIC-X.X.X-linux.tar.gz or FreeBASIC-X.X.X-linux-standalone.tar.gz (the one with the latest version) using your web browser:
http://www.sourceforge.net/projects/fbc/files/Binaries%20-%20Linux
Direct links (i.e. for downloading with wget):
http://nchc.dl.sourceforge.net/project/fbc/Binaries%20-%20Linux/FreeBASIC%200.21.1/FreeBASIC-0.21.1-linux.tar.lzma
http://nchc.dl.sourceforge.net/project/fbc/Binaries%20-%20Linux/FreeBASIC%200.21.1/FreeBASIC-0.21.1-linux-standalone.tar.lzma

Note: It seems that FreeBASIC 0.21.x had been linked with a newer libc which means some distros cannot use the packages from sourceforge.net. Affected are Debian, older Ubuntu, Slax and older versions of other distros. Here's an installer for Debian which might be used on other distros, a prefix compiler linked against libc 2.7 (no standalone yet):
http://wargaleon.users.sourceforge.net/extras/FreeBASIC-0.21.1-linux-debian.tar.lzma
Note: This is not well tested. Tested on Debian GNU/Linux 5.0.6 and Slax 6.1.2 by Galeon.

Note for symlinks for libbfd: Creating a symlink to an older or newer libbfd is dangerous and might cause compiling problems. I suggest that you do it, then recompile the FreeBASIC compiler, install the new one then recompile it again.


Install required packages and fixes:

Ubuntu/Debian:
For Debian-derivatives: Ubuntu Linux, Kubuntu Linux, Xubuntu Linux, Lubuntu Linux, Debian GNU/Linux, Linux Mint, etc.
It might be possible that other distributions (i.e. Fedora with apt-get) could use these.
Tested in Ubuntu Linux 10.04.1, Ubuntu Linux 10.10, Debian GNU/Linux Lenny 5.0.6 and Linux Mint 9 Isadora by Galeon.

Update packages (optional):

Code: Select all

# sudo apt-get update
# sudo apt-get upgrade


Install required packages:

Code: Select all

# sudo apt-get install gcc g++ libncurses5-dev libx11-dev libxext-dev libxpm-dev libxrandr-dev libxrender-dev

Packages gcc and g++ are not needed for standalone installs.


Ubuntu/Debian 64-bit:
For 64-bit Debian-derivatives: Ubuntu Linux, Kubuntu Linux, Xubuntu Linux, Lubuntu Linux, Debian GNU/Linux, Linux Mint, etc.
It might be possible that other distributions (i.e. Fedora with apt-get) could use these.
Tested in Ubuntu Linux 10.10 AMD64 by Galeon and Debian GNU/Linux Squeeze 6.0.1a AMD64 by jvd.

Update packages (optional):

Code: Select all

# sudo apt-get update
# sudo apt-get upgrade


Install required packages:

Code: Select all

# sudo apt-get install libc6-i386 lib32ncurses5-dev gcc-multilib g++-multilib lib32mudflap0

Packages gcc-multilib, g++-multilib and lib32mudflap0 are not needed for standalone installs (not tested).

Download and install getlibs:

Code: Select all

# wget http://frozenfox.freehostia.com/cappy/getlibs-all.deb
# sudo dpkg -i getlibs-all.deb


Install required 32-bit libraries:

Code: Select all

# getlibs -p libx11-dev libxext-dev libxpm-dev libxrandr-dev libxrender-dev


Install binutils for Debian Squeeze 6.0.1a and later only

Code: Select all

# sudo getlibs -p binutils
# sudo ln -s  /usr/lib32/libbfd-2.20.1-system.20100303.so /usr/lib32/libbfd.so
# sudo ln -s  /usr/lib32/libbfd.so /usr/lib32/libbfd-2.18.0.20080103.so



Fedora:
For Fedora Linux, its spins and derivatives.
Tested in Fedora 14 (chroot only) and Fedora 13 by Galeon.
Note: When running fbc, it may show a warning about ospeed. You may just ignore it, it is caused by the compiler being compiled in a Debian-based system.

Update packages (optional):

Code: Select all

# sudo yum upgrade


Add FreeBASIC repository and install from there (Fedora 13/14 only)
Please read this: http://wargaleon.users.sourceforge.net/repositories/fedora. It is complete and compiled in Fedora, so you don't need to do the next steps if you decide to use this instead. Packages are available for FreeBASIC, FreeBASIC Manual and FBHelp.


Install required packages:

Code: Select all

# sudo yum install gcc libstdc++-devel ncurses-devel libX11-devel libXext-devel libXpm-devel libXrandr-devel libXrender-devel


Install libstdc++-static for Fedora 14 and later only

Code: Select all

# sudo yum install libstdc++-static



Puppy:
For Puppy Linux and puplets.
Tested in Puppy Linux 5.1.1 by Galeon.

Install "dev" module:
The dev module is required by prefix versions of FreeBASIC: http://www.puppylinux.com/development/compileapps.htm

Install "FreeBASIC" package:
I created modules for use in Puppy Linux: http://wargaleon.users.sourceforge.net/repositories/puppy-linux. It is complete and compiled in Puppy Linux, so you don't need to do the next steps if you decide to use this instead. Packages are available for FreeBASIC, FreeBASIC Manual and FBHelp.

Create man directory:
Standalone:

Code: Select all

# mkdir /usr/share/man/man1

Prefix:

Code: Select all

# mkdir PREFIX/man/man1

Replace PREFIX with the prefix of the fbc, which is /usr/local by default.
Note: This is needed because FreeBASIC installs a man page but Puppy doesn't use those. FreeBASIC installer will not install without this. You may remove this file afterwards if you want.
If you don't like the above approach, you may just comment out the line in install.sh that installs the manpage:

Code: Select all

gzip -c docs/fbc.1 > /usr/share/man/man1/fbc.1.gz && \

to:

Code: Select all

#gzip -c docs/fbc.1 > /usr/share/man/man1/fbc.1.gz && \#



Slax:
For Slax Linux.
Tested on Slax Linux 6.1.2 by Galeon.

Installing "Slax Devel" module:
Slax Devel module is installed by default. If you have a customized Slax, the author (or you) might have removed it to conserve space. Type gcc in the terminal then press enter; if it showed "-bash: l: command not found", it means you don't have the devel module installed. In that case, follow these instructions: http://www.slax.org/documentation_use_modules.php.

Install "FreeBASIC" module:
I created modules for use in Slax: http://wargaleon.users.sourceforge.net/repositories/slax. It is complete and compiled in Slax, so you don't need to do the next steps if you decide to use this instead. Packages are available for FreeBASIC, FreeBASIC Manual, FBHelp and gEdit.

Create a symbolic link to the newer version of libbfd:
Slax comes with a newer libbfd than Debian which is used to compile the compiler I provided. In that case, you need to create a symbolic link to it:

Code: Select all

# ln -s /usr/lib/libbfd.so /usr/lib/libbfd-2.18.0.20080103.so



Installing FreeBASIC:

Extract and Install FreeBASIC:

Code: Select all

# cd ~/Downloads
# tar -xvf FreeBASIC-X.X.X-linux.tar.lzma
# cd FreeBASIC-X.X.X-linux
# sudo ./install.sh -i

Replace "FreeBASIC-X.X.X-linux" with "FreeBASIC-X.X.X-linux-standalone" for installing standalone versions.
Replace "X.X.X" with version of FreeBASIC, i.e. "0.21.1".
Note: You don't need to use the first command if you're already in the directory where FreeBASIC's installation tarball (FreeBASIC-X.X.X-linux.tar.lzma) is downloaded. Commonly, Mozilla Firefox in Ubuntu and Fedora save downloaded files to ~/Downloads, Ice-Weasel in Debian to ~/Desktop/Downloads and Midori in Puppy save downloaded files to ~. ~ is shortcut to home.
Note: If your tar doesn't support lzma compression, use this instead:

Code: Select all

# lzma -cd FreeBASIC-X.X.X-linux.tar.lzma | tar -xv

You need lzma to be installed (included in p7zip).

Cleanup Install (optional):

Code: Select all

# cd ..
# rm -rf FreeBASIC-X.X.X-linux
# exit

Replace "FreeBASIC-X.X.X-linux" with "FreeBASIC-X.X.X-linux-standalone" for installing standalone versions.
Replace "X.X.X" with version of FreeBASIC, i.e. "0.21.1".

Note: If you want to add a distribution, reply to the thread and I will add it to the first post.
Last edited by Galeon on May 01, 2011 12:20, edited 11 times in total.
E.K.Virtanen
Posts: 785
Joined: May 28, 2005 9:19
Location: Finland

Postby E.K.Virtanen » Nov 04, 2010 16:41

Awesome post. Make it sticky please.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Nov 06, 2010 5:03

I installed FreeBASIC compiler to an Ubuntu Linux 10.10 Maverick Meerkat LiveCD, and found out some problems.
Changed libstdc++6-4.4-dev with g++. libstdc++6-4.4-dev depends on g++, anyway. This will fix differences in versions and "can't find -lsupc++.a" errors.
I removed the instruction for creating links to libbfd. fbc is now linked with the newer libbfd.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Nov 28, 2010 5:37

Kura!
New modules for Slax are now available! FreeBASIC Compiler, FreeBASIC Manual and FBHelp! The modules are available in my SourceForge.Net users' website, read the Slax section in the instructions above.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Nov 29, 2010 14:03

Packages for Puppy Linux is now also available!
The Slax modules are also updated because of some problems discovered while packaging FreeBASIC in Puppy Linux. A Geany module is also uploaded.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Dec 04, 2010 9:54

Updated dependencies for Fedora 14+. libsupc++ is moved to libstdc++-static.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Dec 05, 2010 3:49

Fedora repository for FreeBASIC is now available.
Read this: http://wargaleon.users.sourceforge.net/repositories/fedora
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Jan 18, 2011 13:49

I'm back!
Moved to 64-bit Ubuntu. I have updated it to include that distro. I'm planning to add Arch, Mandriva, openSUSE and PCLinuxOS. Sorry, 32-bit only, I'm using VirtualBox and my CPU do not have VT-x.
mathwizard44
Posts: 72
Joined: Oct 13, 2006 6:11
Location: Latte Plantation, Guam
Contact:

Postby mathwizard44 » Apr 25, 2011 20:21

Confirmed: works on Ubuntu 11.04 (32 bit). Thanks for the instructions.
jvd
Posts: 4
Joined: Apr 26, 2011 21:50

Problems installing on debian squeeze amd64

Postby jvd » Apr 26, 2011 23:43

Some library is preventing geany from compiling a piece of code:

/usr/share/freebasic/fbc: error while loading shared libraries: libbfd-2.18.0.20080103.so: cannot open shared object file: No such file or directory

What I do have is this one:

/usr/lib/libbfd-2.20.1-system.20100303.so

I created a symbolic link that should trick the compiler into using the newer version, but it keeps complaining. Tried the standalone and complete version of both the debian and non-debian lzma.

Also have applied the steps of the Ubuntu 64 bit thread, and it only could not find the 32-bit lib libglitz-glx1-dev. My uneducated guess is that these are unrelated.

Any clue as to how to get this working?

Thanks a lot!
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Apr 27, 2011 23:27

Had you tried this:

Code: Select all

ln -s /usr/lib/libbfd.so /usr/lib/libbfd-2.18.0.20080103.so


Please include the operating system you are using, including the version and architecture.
jvd
Posts: 4
Joined: Apr 26, 2011 21:50

Postby jvd » Apr 28, 2011 10:25

Thanks Galeon, but no luck yet. I'm on Debian Squeeze, 2.6.32-5-amd64.

Code: Select all

$ fbc helloworld.bas
/usr/share/freebasic/fbc: error while loading shared libraries: libbfd-2.18.0.20080103.so: cannot open shared object file: No such file or directory


Code: Select all

$ ls -l /usr/lib/libbfd*
lrwxrwxrwx 1 root root      18 Apr 28 11:50 /usr/lib/libbfd-2.18.0.20080103.so -> /usr/lib/libbfd.so
-rw-r--r-- 1 root root  934040 Jan 25 02:09 /usr/lib/libbfd-2.20.1-system.20100303.so
-rw-r--r-- 1 root root 9245066 Jan 25 02:08 /usr/lib/libbfd.a
lrwxrwxrwx 1 root root      32 Apr 26 23:21 /usr/lib/libbfd.so -> libbfd-2.20.1-system.20100303.so


Somehow I now get this error when installing:

Code: Select all

./fbc: error while loading shared libraries: libbfd-2.18.0.20080103.so: cannot open shared object file: No such file or directory


Can barely imagine that I've overseen that, so did I overwrite this lib while creating that symlink?

Where does ./fbc expect this file to be? Possibly copying this binary to appropriate place could help... Any good way to obtain this file without doing to radical stuff to my system (ie forcing a version of binutils)?
Landeel
Posts: 614
Joined: Jan 25, 2007 10:32
Location: Brazil
Contact:

Postby Landeel » Apr 29, 2011 11:01

If you're running AMD64 you need the 32-bit library.
Do the symbolic link, but in /usr/lib32 instead of /usr/lib .

Code: Select all

ln -s /usr/lib32/libbfd.so /usr/lib32/libbfd-2.18.0.20080103.so
jvd
Posts: 4
Joined: Apr 26, 2011 21:50

Postby jvd » Apr 29, 2011 14:19

Thanks Landeel, that sounds very convincing. Should have thought about that myself :) Will test later, and report here.

Installing on a 32-bit version of Debian Squeeze was painless.
dkl
Site Admin
Posts: 3133
Joined: Jul 28, 2005 14:45
Location: Germany

Postby dkl » Apr 29, 2011 17:06

Tinkering with libbfd like that is dangerous, I strongly advice against it. At least fbc is not guaranteed to work properly after that, because libbfd versions generally do not retain binary compatibility.

This dependency on the shared libbfd.so appears to be a problem with the daily SVN build from http://www.freebasic-portal.de/downloads/svn-daily-builds.html. Maybe Sebastian can fix it. The "official" FB releases are built without the dependency on a shared libbfd.so, precisely because different systems have different libbfd's installed.

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 0 guests