Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2004-01

Linker errors when compiling a mixed C/C++ code tree.

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pascal Pype

Hello,

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.

Regards , Pascal.

Reply by email

Marco van de Voort
to Pascal Pype
Show quoted text 22 lines
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.

Reply by email