[fpc-devel]Linker errors when compiling a mixed C/C++ code tree.

Marco van de Voort marcov at stack.nl
Tue Jan 27 16:04:56 CET 2004


> When one tries to compile a mixed C/C++ - pascal code tree into a single
> executable one gets the following linker errors :
>  
> 1./usr/local/lib/fpc/1.0.10/units/freebsd/rtl/libpsysbsd.a(sysbsd0s283.o): 
>      In function `_SYSBSD$$_SYSTEM_EXIT':
> sysbsd0s283.o(.text+0x4): undefined reference to `_haltproc'
> 2./usr/local/lib/fpc/1.0.10/units/freebsd/rtl/libpsysbsd.a(sysbsd0s186.o): 
> In function `FPC_FINALIZEUNITS':
> sysbsd0s186.o(.text+0x8): undefined reference to `INITFINAL'
> 
> The linkage step is carried out via the command:
> 
> gcc -g ./../entities/cmdInterpret/lib/dbg/cmdinterpret.o 
> ./../entities/consoleCmd/lib/dbg/consoleCmd.o 
> /usr/local/lib/fpc/1.0.10/units/freebsd/rtl/libpsysbsd.a 
> ./../utilities/mainEntryPnt/dbg/mainEntryPnt.a -o ./../dbg/lib
> 
> cmdinterpret.o is compiled from pascal source code as a unit
> consoleCmd.o,mainEntryPnt.a are compiled from C/C++ source code
> where the function main resides within the static library mainEntryPnt.a
> 
> P.S. The OS upon which this is compiled is FreeBSD release 4.9.

fpc needs its own startup code modifications. 

What you could try to do(no guarantees)
:
Try to do the above compile step with "-v", and check the linker commandline.

Then execute exactly the same "ld" line, but substitute crt1.o (ort0.o,
can't remember) with cprt0.o (or cprt1.o) from the
/usr/local/lib/fpc/1.0.10/units/freebsd/rtl directory.

P.s. FPC 1.9.2 beta is in ports tree as lang/fpc-devel since early january.







More information about the fpc-devel mailing list