FreeBASIC and the Raspberry Pi ?

General discussion for topics related to the FreeBASIC project or its community.
dasyar
Posts: 372
Joined: Dec 04, 2008 15:31

Re: FreeBASIC and the Raspberry Pi ?

Post by dasyar »

I decided to reinstall freeBasic on one of my Raspberry Pi 3 units; I used this method:
>wget http://users.freebasic-portal.de/stw/bu ... -03-08.zip
(in case of RB PI 3)
Once you extract the .zip file, there is a readme file which gives further explanation as to what too do. One clue, as it happened to me, you will probably have to change the permissions for the install.sh file, just make it "anybody" for all selections.

After you get that part done, you will have to install the necessary libs, use the first Linux/Ubuntu suggestions. For the installation, make sure you have done:
sudo apt-get update
then you would use:
sudo apt-get install [the lib file]
The method I use is, open up the readme file, and open up a terminal window. Once you type in "sudo apt-get" you can then cut/paste the lib name from the readme file.Hope this makes sense.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: FreeBASIC and the Raspberry Pi ?

Post by D.J.Peters »

Code: Select all

sudo apt-get install libX11-dev libXext-dev libXpm-dev libXrandr-dev libncurses5-dev
cd $HOME
wget http://users.freebasic-portal.de/stw/builds/linux-armv7a-hf-debian/fbc_linux_armv7a_hf_debian_0267_2018-03-08.zip
unzip fbc_[press tab]
cd fbc_[press tab]
chmod -x install.sh
sudo ./install.sh -i
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

It failed to locate packages, libX11-dev libXext-dev libXpm-dev libXrandr-dev
Last edited by BasicCoder2 on Mar 21, 2018 23:06, edited 1 time in total.
dasyar
Posts: 372
Joined: Dec 04, 2008 15:31

Re: FreeBASIC and the Raspberry Pi ?

Post by dasyar »

Did you do a 'sudo apt-get update' before doing the lib install? I cannot remember which two files they are, but two of them should already be installed on the system. I got in the habit of doing a 'sudo apt-get update' every chance I get.

Just curious, did fbc get installed OK?
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

@dasyar,

No I hadn't as when it failed to locate packages, libX11-dev libXext-dev libXpm-dev libXrandr-dev I assumed I would have to wait until I resolved that problem.
However I have gone ahead and the rest seemed to work ok.
I ran the 'sudo apt-get update' but when I tried to again to install the above files it was still unable to locate the above packages.
So after the install I now find there is a folder,
fbc_linux_armv7a_hf_debian
It has an install.sh file I am not sure if I should run it?
fbc is in the bin sub folder and I assume that is the compiler?
Now I need an simple editor. I have been using FBIDE with Windows which I used to download with the old version of FreeBASIC and then install the latest version of FreeBASIC into the same folder.
Will have to do some research on how to do it with Linux now the fbc is already there.
However I see there is something called Geany Programmer's Editor maybe I could use that once I figure out how to configure it to compile and run FreeBasic programs?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: FreeBASIC and the Raspberry Pi ?

Post by D.J.Peters »

@BasicCoder2 It's REALLY important that you update and then upgrade your fresh installed OS before you do any other funny things with it.

sudo apt-get update
sudo apt-get dist-upgrade

'update' will update the list of servers where "apt-get install" can download packages for your OS
'dist-upgrade' will look for new or patched packages and will replace older versions on your OS

after that:
sudo apt-get install libX11-dev libXext-dev libXpm-dev libXrandr-dev libncurses5-dev

will find and install missed libs for you

sudo geany
will install geany a nice IDE with support for FreeBASIC (I use it on Windows also)

Joshy
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

Well sudo apt-get dist-upgrade was one mighty big 20 minute download (it said it would take 35MB).
After the download I thought I had better check the memory.
pi@raspberrypi:~ $ cat /proc/meminfo
MemTotal: 945512 kB
MemFree: 32228 kB
MemAvailable: 471460 kB
Buffers: 22732 kB
Cached: 651728 kB

It was unable to find some archives and also it didn't help finding the missed libs.
I had run apt-get update first.
...
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
...
pi@raspberrypi:~ $ sudo apt-get install libX11-dev libXext-dev libXpm-dev libXrandr-dev libncurses5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libX11-dev
E: Unable to locate package libXext-dev
E: Unable to locate package libXpm-dev
E: Unable to locate package libXrandr-dev
pi@raspberrypi:~ $

Geany is already on the computer all I have to do is figure out how to configure it to use the fbc compiler.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: FreeBASIC and the Raspberry Pi ?

Post by D.J.Peters »

Minutes ago I typed the same apt-get commands and all works fine here on PI2.

Which version of raspbian you are using with your PI3?

Joshy
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

It is a Raspberry Pi 3B not 13
https://www.jaycar.com.au/raspberry-pi- ... r/p/XC9000

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

pi@raspberrypi:~ $ cat /etc/debian_version
9.1
dasyar
Posts: 372
Joined: Dec 04, 2008 15:31

Re: FreeBASIC and the Raspberry Pi ?

Post by dasyar »

I just installed fbc on my Raspberry Pi 3 which is using stretch, upgraded before I did the install, I have not had any problems.

I use Geany all the time when I work with fbc. Geany is already setup to work with fbc, once you save your .bas file, Geany recognizes that it is an fbc compiler. In the Build selection:
- Compile, use this to compile the .bas file
- Execute, use the to run your compiled program.
- Set build commands, make changes to the Compile and Execute commands.
Sequence of events, create/save .bas file, do the compile, and then you can do the execute, to see what your program runs like. Once you get the hang of this, and you start doing some GUI stuff, you will probably want to add a '-s gui' to the compile command. Hope you are having fun.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

@daysar,
Clearly there is something I am not understanding. Perhaps to do with Linux and how it works. I also suspect the "steps" suggested assume knowledge I don't have and say do X without me knowing exactly what X is or how to do it.
"-Set build commands, make changes to the Compile and Execute commands"
How do I set build commands.
What changes do I make to the Compile and Execute commands and where are these commands and how to make changes...
What is "stretch"?
And so on....
I have placed all the downloads into the waste basket, emptied it and perhaps will come back to trying to install FreeBASIC and configuring Geany when I know more about Linux.
I will have to do a lot of reading first until I get it.
There are other sites covering the subject.
https://computoman.blogspot.com.au/2014 ... ry-pi.html
https://www.raspberrypi.org/forums/view ... 1&t=101333
http://scruss.com/blog/2015/03/25/runni ... pberry-pi/
https://freebasic.net/wiki/DevBuildLinux
I don't really know what all the build talk is about.
dasyar
Posts: 372
Joined: Dec 04, 2008 15:31

Re: FreeBASIC and the Raspberry Pi ?

Post by dasyar »

Stretch is the name of the latest Debian Linux build, prior to this it was called Wheezy. The Raspberry Pi uses its own adaptation of the Debian software.

As for Geany, if you start up the IDE, across the top you will see a row of menu selections, one of them is Build. If you click on that, it drops down to show the selection of commands that are available. In that selection you will see Compile and Execute, as some of the selections. You will use the Build selections for whatever compiling that you will be working with.

Since you are a C user, you would create/save your xxx.c program, then within the Build selection you would click on Compile, to compile the program. Once that activity shows that there were no errors, you can then go ahead and do the Execute command. If everything, within your program is legitimate, then the program should run in its own terminal window. And, yes you start everything by using the File menu selection.
srvaldez
Posts: 3373
Joined: Sep 25, 2005 21:54

Re: FreeBASIC and the Raspberry Pi ?

Post by srvaldez »

hello BasicCoder2
the following steps always work for me
1. using your PC, download Raspbian from https://www.raspberrypi.org/downloads/raspbian/
2. follow the instructions on how to install the image to the SD card https://www.raspberrypi.org/documentati ... /README.md
3. after placing the SD card into the Pi, power up
4. launch the terminal
5. from the terminal issue the following commands.

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libX11-dev
sudo apt-get install libXext-dev
sudo apt-get install libXpm-dev
sudo apt-get install libXrandr-dev
sudo apt-get install libncurses5-dev
sudo apt-get install geany
6. launch the web browser and go to http://users.freebasic-portal.de/stw/bu ... hf-debian/
scroll to bottom of list and download the latest version of FB
7. extract the archive that's in the Downloads folder, hint: right-click on the archive and select extract here.
8. from the terminal cd into the extracted folder and issue the following commands
9. chmod +x ./install.sh
10. sudo sh ./install.sh -i

geany is a multi-language IDE and it determines what compiler to invoke depending on the file extension of the source code, so if you have a bas file open in the IDE then it will invoke fbc, if you have a C file then it will invoke gcc and so on
you must have the source code saved to disk with the appropriate file extension before you can compile the source with geany.
see the geany image in D.J.Peters post viewtopic.php?f=17&t=22815&p=199960

you can of course compile FB programs from the terminal, fbc -w all example.bas
to execute type, ./example see https://unix.stackexchange.com/a/4432
also see https://stackoverflow.com/a/14933238
Last edited by srvaldez on Mar 22, 2018 19:31, edited 4 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: FreeBASIC and the Raspberry Pi ?

Post by D.J.Peters »

@srvaldez

before step 9

chmod +x ./install.sh

are missing

Joshy
srvaldez
Posts: 3373
Joined: Sep 25, 2005 21:54

Re: FreeBASIC and the Raspberry Pi ?

Post by srvaldez »

thanks Joshy, I edited my post with your correction.
Post Reply