News:

Welcome to RetroCoders Community

Main Menu

FreeBASIC Install on Linux

Started by ron77, Sep 13, 2022, 01:07 PM

Previous topic - Next topic

ron77

hello here is basic instructions on how to install freeBASIC on Ubuntu 20.04 taken from FreeBASIC Main Community Forum... how to install all Dependencies and Install the Freebasic Compiler

https://www.freebasic.net/forum/viewtopic.php?t=28535

johnno56

I am running Linux Mint 20.3 (64 bit). The installation of FB installed without issue. Loading or entering a programme into the IDE went without a hitch. Running was a slightly different story. Usually, whenever I run a programming language IDE and select execute (or run), another window pops up and displays the results of the programme. On Linux mint, the programme compilation would finish successfully, but there would be no visual display of the programmes results. FB compiler creates an executable and places it in FB's directory. The executable would then need to be run separately using...  ./programme_name (enter)  Other than that... FB runs fine...
May your journey be free of incident.  Live long and prosper.

Tomaaz

Which IDE are you using? I'm pretty sure you can set it up so the compile button will also run produced executable. In Geany, for example, you can use run/compile/build buttons with multiple commands being executed one after another. With one click you can compile your program, move the executable to another directory, rename it then run it. Of course, this is just a simple example.

As far I remember fbc places executable in the same directory the source is placed. If you can't run it by double-clicking you could create a one line shell script, make it executable and make your program clickable this way.

johnno56

#3
Tomaaz,

I am using the PoseidonFB IDE. I have ".bas" setup on Geany for RCBasic...
May your journey be free of incident.  Live long and prosper.

Tomaaz

An IDE dedicated to FreeBASIC doesn't have an option to run FreeBASIC code opened in it? Strange.

If you want,I can help you combine syntax highlighting and set Geany buttons to send .bas files to RCBasic or FreeBASIC depending on which button you press. I used to do it with Luajit and EGSL. Run button was configured to work with Luajit and compile button with EGSL interpreter (based on Lua).

johnno56

Cool... any assistance would be appreciated... Thank you.
May your journey be free of incident.  Live long and prosper.

Tomaaz

OK. I need to know two things:

1. Do you have FreeBasic and RC Basic installed system-wide? For example, can you call FreeBASIC from any directory simple by typing fbc?

2. What Geany configuration for BASIC files do you use now?

johnno56

Tomaaz,

On my Linux machine, both Freebasic and RCBasic, are not setup as 'system wide'. Each created shortcut points directly to each executable.

Geany, by default, uses a Freebasic configuration file for Basic. The Admin of RCBasic has modified it to work with RCBasic. Geany will only allow one "basic" to execute/compile. At the moment, the ".bas" file extension, is configured for RCBasic. Therefore, if any other '.bas' file is used (that is not RCBasic) the compiler will more than likely terminate with errors.

I would imagine that it may be possible to use multiple 'basics' if each one used a unique file extension... for instance: create a configuration file for qbasic and use a file extension of perhaps ".qbas".
May your journey be free of incident.  Live long and prosper.

Tomaaz

#8
It's absolutely possible to use both FreeBASIC and RCBasic to work with .bas extension and one Geany BASIC configuration file. Geany will have no problem with that. It has three main buttons (compile, build and run) and each one can be set to work with a different compiler/interpreter. You can either pre set them in the configuration file or change them manually using "set build menu" option from the menu. To be honest it's absolutely possible to set the buttons the way that one click will send the source code to several  interpreters/compilers. The only thing we would have to do is to combine two sets of keywords for syntax highlighting what is a trivial task and can be done in 5 min.

Could you check something for me? Open your terminal, type fbc and let me know what the output is. Does it print all FreeBASIC compiler options or simply complains about incorrect command?

johnno56

'fbc' from a terminal command prompt, you say?

---------------------------------------------------
john@john-H81M-DS2:~$ fbc
usage: fbc [options] <input files>
input files:
  *.a = static library, *.o = object file, *.bas = source
  *.rc = resource script, *.res = compiled resource (win32)
  *.xpm = icon resource (*nix/*bsd)
options:
  @<file>          Read more command line arguments from a file
  -a <file>        Treat file as .o/.a input file
  -arch <type>     Set target architecture (default: 486)
  -asm att|intel   Set asm format (-gen gcc|llvm, x86 or x86_64 only)
  -b <file>        Treat file as .bas input file
  -c               Compile only, do not link
  -C               Preserve temporary .o files
  -d <name>[=<val>]  Add a global #define
  -dll             Same as -dylib
  -dylib           Create a DLL (win32) or shared library (*nix/*BSD)
  -e               Enable runtime error checking
  -entry           Change the entry point of the program from main()
  -ex              -e plus RESUME support
  -exx             -ex plus array bounds/null-pointer checking
  -export          Export symbols for dynamic linkage
  -forcelang <name>  Override #lang statements in source code
  -fpmode fast|precise  Select floating-point math accuracy/speed
  -fpu x87|sse     Set target FPU
  -g               Add debug info, enable __FB_DEBUG__, and enable assert()
  -gen gas|gas64|gcc|llvm  Select code generation backend
  [-]-help         Show this help output
  -i <path>        Add an include file search path
  -include <file>  Pre-#include a file for each input .bas
  -l <name>        Link in a library
  -lang <name>     Select FB dialect: fb, deprecated, fblite, qb
  -lib             Create a static library
  -m <name>        Specify main module (default if not -c: first input .bas)
  -map <file>      Save linking map to file
  -maxerr <n>      Only show <n> errors
  -mt              Use thread-safe FB runtime
  -nodeflibs       Do not include the default libraries
  -noerrline       Do not show source context in error messages
  -noobjinfo       Do not read/write compile-time info from/to .o and .a files
  -nostrip         Do not strip symbol information from the output file
  -o <file>        Set .o (or -pp .bas) file name for prev/next input file
  -O <value>       Optimization level (default: 0)
  -p <path>        Add a library search path
  -pic             Generate position-independent code (non-x86 Unix shared libs)
  -pp              Write out preprocessed input file (.pp.bas) only
  -prefix <path>   Set the compiler prefix path
  -print host|target  Display host/target system name
  -print fblibdir  Display the compiler's lib/ path
  -print x         Display output binary/library file name (if known)
  -profile         Enable function profiling
  -r               Write out .asm/.c/.ll (-gen gas/gcc/llvm) only
  -rr              Write out the final .asm only
  -R               Preserve temporary .asm/.c/.ll/.def files
  -RR              Preserve the final .asm file
  -s console|gui   Select win32 subsystem
  -showincludes    Display a tree of file names of #included files
  -static          Prefer static libraries over dynamic ones when linking
  -strip           Omit all symbol information from the output file
  -t <value>       Set .exe stack size in kbytes, default: 1024 (win32/dos)
  -target <name>   Set cross-compilation target
  -title <name>    Set XBE display title (xbox)
  -v               Be verbose
  -vec <n>         Automatic vectorization level (default: 0)
  [-]-version      Show compiler version
  -w all|pedantic|<n>  Set min warning level: all, pedantic or a value
  -Wa <a,b,c>      Pass options to 'as'
  -Wc <a,b,c>      Pass options to 'gcc' (-gen gcc) or 'llc' (-gen llvm)
  -Wl <a,b,c>      Pass options to 'ld'
  -x <file>        Set output executable/library file name

----------------------------------

Well, it certainly surprised me! Always ran it via Geany and assumed that it was not a 'system wide' command... Learn something new every day! If you had not have made the request, I would have probably carried on believing as I have... Thank you! Much appreciated.

I have a sneaking suspicion that you may have an ulterior motive for your request... or am I in error yet again? ... lol
May your journey be free of incident.  Live long and prosper.

Tomaaz

#10
In the attachment you will find a modified version of Geany FreeBASIC configuration file. It supports both FreeBASIC and RCBasic syntax. I've copied build menu settings from the file that comes with RCBasic and added three lines, so it could be used with FreeBASIC, as well. The build button is now set to send the source code to fbc and then to execute produced executable. You need to copy the file  to $HOME/.config/geany/filedefs/. In the attached .zip archive there is a simple FreeBASIC example you can use to test the configuration file. Let me know if it works.  :)

johnno56

Tomaaz,

See the screen image. It eventually worked. So... RC on the compile and FB on the build... Cool

'eventually'... I had to tweak the "Set Build Commands", as they were configured for Windows (back slashes) and Linux uses forward slashes, when it come to file paths... Other than that, ran like a dream... Thank you.

May your journey be free of incident.  Live long and prosper.

Tomaaz

I used the file that came with Linux version of RCBasic and assumed it was made for Linux. I should have checked that. Sorry.  But it works so I'm glad I could help. :)


johnno56

No need to apologise. The file for FB, that came with the Linux version, was setup for Windows. I had to do the same when I first installed Geany.... lol
May your journey be free of incident.  Live long and prosper.