Revision [16301]

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

 

Notes on making FB releases



Manifests

Win32

FreeBASIC-x.xx.x-win32

ENABLE_STANDALONE := YesPlease
ENABLE_FBBFD := 217
FBCFLAGS := -d ENABLE_TDMGCC
FBLFLAGS := -p c:/path/to/libbfd217/


fbc-x.xx.x-mingw32

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


Linux

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 https://github.com/GregorR/musl-cross.

The contrib/build-musl-fbc.sh 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 ...

FreeBASIC-x.xx.x-linux-musl
  • Use the build-musl-fbc.sh 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 config.mk like this:

FBC := .../musl-fbc/fbc/fbc-new
FBLFLAGS := -static -l tinfo
ENABLE_FBBFD := 217
ENABLE_STANDALONE := YesPlease

  • 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 build-musl-fbc.sh script)
  • regenerate & check the manifest:
  • contrib/manifest/update.sh linux-musl
  • package:
  • contrib/manifest/package.sh linux-musl FreeBASIC-x.xx.x-linux-musl targz

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

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

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/update.sh linux
  • package:
  • contrib/manifest/package.sh linux FreeBASIC-x.xx.x-linux targz


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

FreeBASIC-x.xx.x-dos
  • 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 config.mk:

ENABLE_STANDALONE := YesPlease
ENABLE_FBBFD := 217
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/update.sh dos
  • package:
  • contrib/manifest/package.sh dos FreeBASIC-x.xx.x-dos zip

fbcxxxxb.zip
  • exactly like the FreeBASIC-x.xx.x-dos release, but build with a config.mk like:

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

  • copy in the modified libc.a into lib/freebas/
  • regenerate & check the manifest:
  • contrib/manifest/update.sh djgpp
  • package:
  • contrib/manifest/package.sh 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
    make
    cd ../fbdoc
    make
    cd ../fbchkdoc
    make
    cd ../makefbhelp
    make
  • 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
    ./mkerrlst
    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



sf.net phatcode