[fpc-pascal]linking bug

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jul 25 14:14:40 CEST 2002


Hi all,

I have written a small program under linux, which calls an external procedure in a dynamic lib. See at the end of the mail. I compiled it with the -XD option without any error or warning. But when I run it, I got errors, that looks like wrong linking.
The same program compiled with the gcc works nice. So the error must be somewhere in the fpc linking stage. 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
program TestGtk2;
{$mode objfpc}{$H+}

{$linklib 'gtk-x11-2.0'}
procedure gtk_init(var argc:longint; var argv:PPchar); cdecl; external;

begin
  gtk_init (argc, argv);
end.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Compiled under linux with:
ppc386 -XD testgtk2.pas

Running it, gives me:

specified class size for type `GParamChar' specified class size for type `GParamChar' is smaller than the parent type's `GParam' class size
[...]
specified class size for type `GParamObjectspecified class size for type `GParamObject' is smaller than the parent type's `GParam' class size
Runtime error 216 at 0x40342F2B
  0x40342F2B
[...]
  0x08048250

------------------------------------

I looked into the link.res file and found out the line, that creates the error:

)
INPUT(
-lgtk-x11-2.0
/lib/ld-linux.so.2  # <- this line creates the bug
)

If I remove the '/lib/ld-linux.so.2' line, everything works nice.

Here is the diff of both ldd outputs:

$ diff good.ldd buggy.ldd 
2a3
> 	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
7c8
< 	libpangoxft-1.0.so.0 => /usr/lib/libpangoxft-1.0.so.0 (0x402b2000)
---
> 	libpangoxft-1.0.so.0 => /usr/lib/libpangoxft-1.0.so.0 (0x402b3000)
15d15
< 	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)


Can someone explain to me, what is going on, and/or what params fpc needs to create a working link.res?
 

thx in advance,
Mattias Gaertner




More information about the fpc-pascal mailing list