Marco van de Voort wrote 6 lines
> I haven't noticed up to now, but using fpc-2.0.4 on FreeBSD does not
> work completely in FreeBSD 4.11 any more.
This is by design. The default changed from FreeBSD4 to FreeBSD5 here.
The meaning of the compat switch -Xf changed accordingly afaik.
Um, I've never heard or read of that switch, I'll try.
Show quoted text 19 lines
> - Compiling fpc 2.0.4 works.
> - Compiling programs does not work with the new startup
> code (rtl/freebsd/i386/cprto.as)
> error: failure in _init_tls()
> couldn't find info on what that is ...
initialise the 5.x TLS supporting threading libs.
> - ... but multitasking isn't possible, the old cprt0.as
> does not work with threads at all
> errors:
Make sure nothing defines FreeBSD5, and use -Xd.
> Is there any chance of having support for FreeBSD 4 integrated into
> newer compilers?
Afaik, all support is still there, except maybe the startup code. Just make
sure that FreeBSD
?
However this sentence should continue, I've tried the following:
1. reconstructed the original cprt0.as
2. recompiled fpc-2.0.4 release sources
3. added "-Xf" to my .fpc.cfg
4. tried a complete compile of lazarus and a testing program of mine
But sadly I were not successful, the only error I get is the same as before, initializing tls fails:
<compiling lazarus>
$ gmake clean all
...
Compiling cleandirdlg.pas
Linking ../lazarus
/usr/lib/libc.so: WARNING! setkey(3) not present in the system! /usr/lib/libc.so: warning: this program uses gets(), which is unsafe. /usr/lib/libc.so: warning: mktemp() possibly used unsafely; consider using mkstemp() /usr/lib/libc.so: WARNING! des_setkey(3) not present in the system! /usr/lib/libc.so: WARNING! encrypt(3) not present in the system! /usr/lib/libc.so: warning: tmpnam() possibly used unsafely; consider using mkstemp() /usr/lib/libc.so: warning: this program uses f_prealloc(), which is not recommended. /usr/lib/libc.so: WARNING! des_cipher(3) not present in the system! /usr/lib/libc.so: warning: tempnam() possibly used unsafely; consider using mkstemp() /home/marc/fpc-2.0.4-fbsd/lib/fpc/2.0.4/units/i386-freebsd/rtl/cprt0.o: In function `_start': /home/marc/fpc-2.0.4-fbsd/lib/fpc/2.0.4/units/i386-freebsd/rtl/cprt0.o(.text+0xa9): undefined reference to `_init_tls' lazarus.pp(119,1) Error: Error while linking
...
</compiling lazarus>
<compiling test program>
$ fpc -Xf -Xd -Fu/home/marc/program/fpc-laz/fpc/packages/extra/hdf5/ -Fi/home/marc/program/fpc-laz/fpc/packages/extra/hdf5/ dev_mvc.lpr Free Pascal Compiler version 2.0.4 [2007/01/19] for i386 Copyright (c) 1993-2006 by Florian Klaempfl
Target OS: FreeBSD/ELF for i386
Compiling dev_mvc.lpr
Linking dev_mvc
/usr/lib/libc.so: WARNING! setkey(3) not present in the system! /usr/lib/libc.so: warning: this program uses gets(), which is unsafe. /usr/lib/libc.so: warning: mktemp() possibly used unsafely; consider using mkstemp() /usr/lib/libc.so: WARNING! des_setkey(3) not present in the system! /usr/lib/libc.so: WARNING! encrypt(3) not present in the system! /usr/lib/libc.so: warning: tmpnam() possibly used unsafely; consider using mkstemp() /usr/lib/libc.so: warning: this program uses f_prealloc(), which is not recommended. /usr/lib/libc.so: WARNING! des_cipher(3) not present in the system! /usr/lib/libc.so: warning: tempnam() possibly used unsafely; consider using mkstemp() /home/marc/fpc-2.0.4-fbsd/lib/fpc/2.0.4/units/i386-freebsd/rtl/cprt0.o: In function `_start': /home/marc/fpc-2.0.4-fbsd/lib/fpc/2.0.4/units/i386-freebsd/rtl/cprt0.o(.text+0xa9): undefined reference to `_init_tls' dev_mvc.lpr(17,1) Error: Error while linking
</compiling test program>
As you can see, the -Xf switch does not change things, even when given explicitely. Cross checking without -Xf anywhere (command line, .fpc.cfg) shows the same error, too.
Show quoted text 9 lines
> If the difference in initializing threads between 2.0.2 and 2.0.4 would
> be put into makefiles or ifdef's I think it could work ... but my
> knowledge of compiler internals and startup code is very limited.
This difference is twofold:
- startup codee, which you "fixed" (some diffing between the two would also
help.
- -Xf which changes to the "non-default" FreeBSD version on both 2.0.2 (where it
switches to 5.x) and 2.0.4(where it tries 4.x behaviour).
How can I go on from here, should I try switching startup code again and try "-Xd"?
TIA,
Marc