Revision [16301]

This is an old revision of DevMakingReleases made by DkLwikki on 2012-08-17 17:17:08.


Notes on making FB releases




FBLFLAGS := -p c:/path/to/libbfd217/


FBLFLAGS := -p c:/path/to/libbfd217/


Building binaries that work on most of the available GNU/Linux distributions is hard because even though they are often similar in general, they differ differ in detail just as often. The most common problem is mismatching glibc versions, i.e. the fbc binary is run on a system with older glibc than the one it was built on, and an "glibc too old" error is encountered. The ncurses library is not always exactly the same either, as shown by the "`ospeed' has different size, consider re-linking" warnings when running fbc. That's why the Linux releases have usually been built in some GNU/Linux system old enough to let the fbc binary work on Debian 4 and 5, the current supported Ubuntu versions (especially LTSs), Fedora and OpenSUSE.

As of FB 0.24 it's possible to create static ELF binaries using musl libc instead of glibc, which should prevent the problems mentioned above. Other alternative libc's might work too, though I (dkl) tested only musl libc and dietlibc, and musl worked almost without problems, while compiling the rtlib with dietlibc required more adjustments. Besides getting the rtlib to build, the other big issue is getting the proper target libraries.

libc & co (including crt{1,i,n}.o) are easy to build from the musl sources, but properly compiling GCC to get libgcc, libsupc and crtbegin.o/crtend.o requires some experience. Luckily there is a script to create a musl libc GCC cross-compiling toolchains available at

The contrib/ script uses that to build a whole "musl-fbc" setup, including the CRT/GCC/ncurses/bfd/CUnit target libraries needed to build a static fbc binary with it.
  • lib{c,dl,m,pthread}, crt{1,i,n}.o from musl libc
  • lib{gcc,gcc_eh,supc++}, crt{begin,end}.o from GCC, built against musl
  • libncurses, libffi and libbfd 2.17 built against musl
  • FB rtlib (without X11/gpm/OpenGL support)

This should be enough for an fbc linked against musl libc, although it won't be enough for many other FB programs (e.g. graphics). The script builds a standalone FB setup, which is the native-to-musl cross-compiler with the binutils/libraries in order to compile static linux-musl FB programs. This setup can be used to create static FB programs, by doing:
.../fbc/fbc-new -static -l tinfo ...

  • Use the script to build the musl-fbc setup. Best copy the script in a new empty directory called "musl-fbc" and run it from there. It'll hg clone musl-cross and git clone fbc, and download lots of source packages (musl libc, Linux headers, gcc, binutils, ncurses, libffi, CUnit), unless those directories or packages already exist.
  • setup a like this:

FBC := .../musl-fbc/fbc/fbc-new
FBLFLAGS := -static -l tinfo

  • then build an fbc with it:
  • $ make compiler
  • copy over all the files from .../musl-fbc/fbc/bin/linux/ into bin/linux/
  • copy over all the files from .../musl-fbc/fbc/lib/linux/ into lib/linux/, including libfb[mt].a and fbrt0.o (no need to rebuild them in a new tree, when it's already done by the script)
  • regenerate & check the manifest:
  • contrib/manifest/ linux-musl
  • package:
  • contrib/manifest/ linux-musl FreeBASIC-x.xx.x-linux-musl targz

  • Get the FreeBASIC-x.xx.x-linux-musl release first
  • build FB with a like this:

FBC := .../fbc-musl-release/fbc
FBLFLAGS := -static -l tinfo

This should result in a static fbc binary built using the musl-fbc setup, and normal rtlib/gfxlib2 builds, compiled with the native gcc. Even though the fbc binary will be statically linked against musl libc and be very portable, the rtlib/gfxlib2 will still use the system's glibc headers, so the compilation should not be done on a system with the latest glibc version, but perhaps on a system with slightly older version, just to ensure the rtlib won't use any new APIs that would make it ABI-incompatible with older glibc versions. This is essentially the same problem as with fbc, but it cannot be avoided, but just compiling against a specific glibc version causes less trouble than linking against a specific glibc version.

  • regenerate & check the manifest:
  • contrib/manifest/ linux
  • package:
  • contrib/manifest/ linux FreeBASIC-x.xx.x-linux targz

  • Remember that FB needs a modified version of DJGPP's libc

  • Get the DJGPP setup, see also the DOS section on DevBuild
  • increase the maximum number of available file handles [if needed; it seems to be needed on Windows XP in order to build binutils 2.17 under DJGPP]
    • Use 'msconfig' to add PerVMFiles=255 to the [386Enh] section of SYSTEM.INI
    • Edit setting in C:\WINDOWS\system32\CONFIG.NT: files=255
  • build binutils 2.17 to get libbfd 2.17 and matching libiberty
  • ../binutils-2.17/configure --disable-shared --disable-nls --disable-werror
    (this requires automake, autoconf, bison, flex, etc. to be installed)
  • get an FB setup to compile the new fbc binary (usually the latest development version, or at least the previous release)
  • ensure the FB setup will link the new compiler against the libbfd.a 2.17 built before, e.g. by copying the libbfd.a into the FB setup's lib/ dir, or by using -p c:/path/to/libbfd217/ when linking the new fbc
  • build the new FB release with something like the following

FBLFLAGS := -p c:/path/to/libbfd217/

  • copy binutils/gdb from DJGPP into bin/dos/:
  • as.exe, ar.exe, ld.exe, gprof.exe, gdb.exe
  • copy libs from DJGPP into lib/dos/:
    • crt0.o, gcrt0.o
    • libemu.a, libm.a
    • libgcc.a, libsupcx.a (renamed from libsupcxx.a)
  • copy in the modified libc.a (e.g. from the previous FB release, or use DJGPP's libc.a and modify it)
  • copy in the libbfd.a 2.17 (and libiberty.a) too
  • regenerate & check the manifest:
  • contrib/manifest/ dos
  • package:
  • contrib/manifest/ dos FreeBASIC-x.xx.x-dos zip
  • exactly like the FreeBASIC-x.xx.x-dos release, but build with a like:

FBLFLAGS := -p c:/path/to/libbfd217/

  • copy in the modified libc.a into lib/freebas/
  • regenerate & check the manifest:
  • contrib/manifest/ djgpp
  • package:
  • contrib/manifest/ djgpp fbcxxxxb zip

FB manual/documentation
  • See also doc/fbchkdoc/readme.txt and doc/manual/readme.txt
  • Get MySQL, libcurl, libaspell, libpcre
  • Build the wiki tools:
  • cd doc/libfbdoc
    cd ../fbdoc
    cd ../fbchkdoc
    cd ../makefbhelp
  • Update the wiki cache (the offline copy of the *.wakka files)
  • cd doc/manual
    rm -f cache/*
    make refresh
  • Regenerate the PrintToc page:
  • cd doc/fbchkdoc
    ./mkprnttoc -web
  • Regenerate the CompilerErrMsg page:
  • cd doc/fbchkdoc
    fbc mkerrtxt.bas -exx
    ./mkerrtxt > errors.wakka
    Then copy the error list from errors.wakka into doc/manual/cache/CompilerErrMsg.wakka, and update the online wiki too.
  • Update the wiki samples in examples/manual/ (may want to clear out the old ones first, to delete those removed from the wiki)
  • cd doc/fbchkdoc
    ./getindex -web
    ./samps extract @PageIndex.txt

Back to FreeBASIC Developer Information

Back to Table of Contents
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki phatcode