Getting FreeBASIC

From OHRRPGCE-Wiki
(Redirected from Getting Freebasic)
Jump to navigation Jump to search

FreeBasic is a 32/64-bit, cross-platform, QuickBasic compatible, modern object-orientated language in the BASIC family. This page will talk about getting and installing it on each of the platforms of OHRRPGCE Development.

The latest version of FreeBASIC, 1.09, is recommended, and at least 1.04 is required. The Android OHRRPGCE port requires an as yet unmerged fork of FB.

The threads in the FreeBASIC News forum (e.g. FreeBASIC 1.09 release thread) are the best place to go for links to the different builds available.

Windows[edit]

See the Quickstart if you just want to install FreeBASIC.

On Windows there are many many different builds of FreeBASIC provided, compatible with different GCC toolchains and versions (including MingGW-w64, and another set compatible with MinGW (these are labelled "mingworg")) and packaged as either standalone or needing to be install. There's also a separate FB build for each GCC version you can install with MinGW-w64. You need to install a build of FB compatible with the distribution of mingw/mingw-w64 you install.

The rest of this section is out of date.

Find download links on the FB forums (see link above) or directly on SourceForge.

  • For MinGW-w64, either:
    • For GCC 5.2.0 you can just download the default FreeBASIC 1.07.1 Installer and run it
    • Or get one of the other FreeBASIC-... .zip/.7z files and extract it anywhere, then put fbc.exe in your PATH.
    • Alternatively, files named "fbc-..." instead of "FreeBASIC-..." are for extracting into your mingw-w64 folder (this should avoid needing to add FB's directories to your PATH) and they are much smaller because they don't duplicate everything MinGW-w64 already includes.
  • For MinGW, either:

There are also 64 bit versions of FB. I expect these would still be capable of creating 32 bit executables, but whether they work with the OHR is completely untested.

Note that the zip distributions of FreeBasic will not automatically add the location of fbc.exe to the system's PATH. You should not extract the files overwriting an existing install made with the FreeBasic installer into C:\Program Files (x86)\FreeBASIC\ because the PATH set up by that installer may not be correct.

If you extracted FreeBASIC at (e.g.) C:\Program Files (x86)\FreeBASIC\, then you need to put both C:\Program Files (x86)\FreeBASIC\ and C:\Program Files (x86)\FreeBASIC\bin\win32 in your PATH. For other versions of FB, the necessary PATH varies.

Linux[edit]

Download and install one of the freebasic packages from https://www.freebasic.net or from your distribution's package manager if available. Beware that problems with ncurses/libtinfo are very common. See the FB forums.

See also Linux library requirements.

Standalone vs. Normal builds[edit]

For recent versions, this distinction is only relevant if compiling FB yourself. Previously FB packages were available in both 'standalone' and 'normal' versions. Now only normal builds are distributed.

If compiling you should never create a standalone build, regardless of whether you install FB globally on your system or not. The way standalone builds work has changed in recent FB versions, so that it now expects gcc, as, etc, in its local bin/ directory and does not look on the $PATH. This seems to be intended only for distributing packages to Windows users.

See also the FB wiki page on Normal vs. Standalone FreeBASIC installs.

Macintosh[edit]

See Compiling in Mac OS X.

Android[edit]

See Compiling for Android‎.

FreeBSD and other Unices[edit]

The OHRRPGCE works on FreeBSD. FB does also kind-of support NetBSD and OpenBSD, but you're on your own. (FB's Unix headers aren't portable or complete, so for OpenBSD etc. it's likely you will have to edit the "crt" headers in some places where there are OS-specific defines.)

Old builds of FB for FreeBSD are available on the FB forums, but probably won't work due to missing headers.

For the moment you need to use a fork of FB 1.06 which fixes FreeBSD support. The latest version of FreeBASIC should be able to compile the OHRRPGCE, but if it doesn't work, try this fork.

FB is written in FB. Unlike cross-compiling, it's easy to compile FB yourself, see #Compiling bootstrapped FreeBASIC (includes the FreeBSD fixes). You don't need a copy of the above git repo.

DOS32[edit]

32-bit DOS is supported by FB but not by the OHRRPGCE. It is technically possible, but no one has had time for it. There will definitely be a lot of difficulties.

ARM (e.g. Raspberry Pi)[edit]

There's no official package for linux on arm. Someone has created packages here.

Alternatively, you can compile it, see below.

Compiling bootstrapped FreeBASIC[edit]

FreeBASIC packages aren't available for every OS it supports. You can compile FB yourself using a 'bootstrap' distribution of the FB source, which is a copy of the source code with the FB's compiler FB source code pre-translated to C for the appropriate targets, so that you can compile FB without an existing copy of FB.

Such a pre-generated bootstrap is available for linux-arm (armhf), freebsd-x86 and freebsd-x86_64. (Or you can easily generate it yourself from a copy o f the FB source, if fbc is already installed: just run "make bootstrap-dist". You'd likely want to edit the makefile to control which OSes are targeted.)

Requires GCC, and GNU Make on FreeBSD.

  • Download and extract http://tmc.castleparadox.com/ohr/temp/FreeBASIC-1.06.0-source-bootstrap.tar.xz (contains linux-arm (armhf), freebsd-x86 and freebsd-x86_64).
  • Run "make bootstrap" (or "gmake bootstrap" on FreeBSD) (Hint: add "-j4" for 4-core CPUs, etc)
  • Install it somewhere (this is necessary to get the right directory structure). Either system wide with e.g. "sudo make install prefix=/usr/local" (that's the default prefix so can be omitetd), or locally, e.g. "make install prefix=~/local/fbc-1.06"
  • Either make sure the installed $prefix/bin/fbc is in your $PATH, or compile the OHR with "scons fbc=/path/to/bin/fbc"


See Also[edit]