Compiling a Development Version of FreeBASIC
The source code of FreeBASIC is maintained on Sourceforge using the Git version control system, which allows different developers to work on the source code at the same time and later combine their work. It is possible for users to download the FreeBASIC source code using anonymous read access and compile it using GNU development tools.
Compiling the development version is not recommended for most users. FreeBASIC is a self-hosting compiler, still in active development, so there will be times when the current development version cannot be compiled by the last official release. Note also that the procedures for building the compiler described here may change with future versions of FreeBASIC.
Essentially, FreeBASIC consists of two parts:

- The FreeBASIC compiler, written in FreeBASIC (self-hosting). Compiling this requires a working FreeBASIC installation.
- The FreeBASIC runtime libraries, written in C. Compiling this requires a C compiler such as gcc, the GNU C compiler (Native gcc on Linux, MinGW on Windows, DJGPP for DOS).

Generally, when compiling FB, care should be taken to never mix compiler and rtlib of different versions, because they will not necessarily be compatible. fbc's code generation expects a specific libfb version. Thus, an FB setup should always have the proper libfb version in its `lib/` directory, matching the version of the `fbc.exe`. When building a new compiler, just like any other FB program, it will be compiled by an existing fbc and thus it must also be linked against the existing fbc's libfb, not against the new libfb. The new libfb belongs into the new compiler's `lib/` directory, not in that of the existing fbc. Typically this means that the compiler should be built first, before rtlib/gfxlib2, which is also how the FB makefile works by default.
There are two ways to build FB: normal or standalone. The normal version is intended for integration with an existing gcc toolchain, while the standalone version makes fbc act more like a self-contained tool. Most importantly, the two use slightly different directory layouts. For example, in the normal version the fbc program is located at `bin/fbc[.exe]`, while in the standalone version, `fbc[.exe]` is put into the toplevel directory, instead of the `bin/` directory. Furthermore, the directory layout for include files and libraries differs. Traditionally, the FB-linux release is a normal build, while the FB-win32 and FB-dos builds are standalone versions.
Getting the source code
Compiling FB for DOS
Compiling FB on Linux
Compiling FB on Windows
Getting source code updates and recompiling FB
Debugging FB
FB build configuration options
Known problems when compiling FB
GCC toolchain choice