Difference between revisions of "FreeBSD"

From Free Pascal wiki
m (FREEBSD bleeding edge notes: typos and minor rewordings)
m (Support for older versions: spelling)
Line 12: Line 12:
 
== Support for older versions ==
 
== Support for older versions ==
  
4.x is formally no longer supported, but the old code pretty much staid put, the defaults just changed. The differences are pretty much startup code, threading, and some code under ifdef FREEBSD5:    (note, the best chance for this to work is with the code of 2.2.2)
+
4.x is formally no longer supported, but the old code pretty much stayed put, the defaults just changed. The differences are pretty much startup code, threading, and some code under ifdef FREEBSD5:    (note, the best chance for this to work is with the code of 2.2.2)
  
 
* 4.x has other startup code than 7.x, get the old .as files from 2.0.0 or 2.0.2 (or from similar versions svn).  (I don't really remember what was different about them. It could only be the ABI number in the ELF ident), assemble them, and copy them over the existing ones.  
 
* 4.x has other startup code than 7.x, get the old .as files from 2.0.0 or 2.0.2 (or from similar versions svn).  (I don't really remember what was different about them. It could only be the ABI number in the ELF ident), assemble them, and copy them over the existing ones.  

Revision as of 16:09, 19 November 2010

FREEBSD bleeding edge notes

This page is mainly a scratchpad where I will try to keep FreeBSD specific issues noted. Some of them may apply to NetBSD/OpenBSD, too. Darwin is also sharing a lot of the generic BSD.

FreeBSD is the most mature of the BSD ports, though Darwin is rapidly catching up.

Supported FreeBSD versions (5.x..8.x)

FreeBSD is currently targeted at versions 5.x .. 8.x. There might be some features not available in 5.x, but they will be rare. (think like createguid/uuidgen or so).

Support for older versions

4.x is formally no longer supported, but the old code pretty much stayed put, the defaults just changed. The differences are pretty much startup code, threading, and some code under ifdef FREEBSD5: (note, the best chance for this to work is with the code of 2.2.2)

  • 4.x has other startup code than 7.x, get the old .as files from 2.0.0 or 2.0.2 (or from similar versions svn). (I don't really remember what was different about them. It could only be the ABI number in the ELF ident), assemble them, and copy them over the existing ones.
  • Now bootstrap the compiler using OPT="-dFREEBSD4 -Xf"
  • copy sources + bootstrapped (static) compiler to 4.x
  • Bootstrap system (again with patched startup code and OPT="-Xf -dFREEBSD4"

write your experiences here under this paragraph since this is all just theory till now. I do not have a fbsd4 to actually try anymore.

5.x startup code

The first can be fixed for 1.0.10 (lang/fpc port) by running this shell script if you have 5.x, which takes the prefix where FPC is installed as optional parameter. (tested on 5.2)

libkse/libpthreads

Starting with 2.0.4 or so, the default is FreeBSD5 kse/pthreads threading instead of libc_r.

For this to work there must be at least one header set that has {$linklib c} {$linklib pthreads}

and there should be no direct use of {$linklib c_r} anymore, the compiler transforms the library list automatically to 4.x compat if -Xf is passed on the cmdline

Ports tree

FPC is currently available as 2.4.2 in the ports tree, maintained by José Alonso Cárdenas Márquez (acm@freebsd.org).

COMPAT_ requirement of the port

I haven't really researched the issue, but somehow the port maintainers added a dependancy to COMPAT_5, probably because the source default puts the .note in cprt0.as to 504000 or so. This can be easily remedied by patching the cprt0.as file before building, and put the output of

elfdump -n `which elfdump` |awk '/FreeBSD/{print $2}'

in the .long line AFTER a .string "FreeBSD" line in cprt0.as.

A script has been added to -trunk (fpc/rtl/freebsd/i386/identpatch.sh) that does this. I'm no scripting wizard (actually I think I don't even qualify as "beginner") so if you have improvements, please communicate them back

Note: The COMPAT_ dependency was removed with version 2.2.4 of freepascal, and the value of .long line into cprt0.as file is changed to ${OSVERSION} automatically.

See about ${OSVERSION} at: http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/dads-after-port-mk.html

FPC_USE_LIBC

Since jan 2004, most Unix ports of FPC can be recompiled with FPC_USE_LIBC, and in those cases the RTL will use libc functions as much as possible. This was mainly introduced for the Darwin port, and may also be used for e.g. Lazarus distributions. (Lazarus links its apps to libc anyway, because of gtk)

Unix RTL, 1.0.x/1.9.x RTL compability

The 1.0.x rtl was essentially a linux only hackish rtl. The rtl was rewritten in version 1.9.x/2.x (and this still continues), and unfortunately, compatibility had to be broken.

For reasons and discussion, see Unix Rtl Doc