[fpc-pascal] crosscompiling from win32 to i386-linux and libc linking

Dominique Leducq dleducq at magellan-ing.fr
Fri Jul 28 11:54:07 CEST 2006


Hi,

I have linking problems when cross-compiling from win32 to i386-linux 
and linking with libc (dynamically).
I use FPC 2.0.2, the libs are from a Debian Sarge (glibc-2.3.6, I tried 
with glibc 2.3.2 with same results),
cross ld is :
ld.exe -V
GNU ld version 2.15
   Supported emulations:
    elf_i386
    i386linux

I get the following errors :
fpc -Mdelphi -Tlinux test.pas -Fl'c:\FPC\2.0.2\lib\i386-linux'
Free Pascal Compiler version 2.0.2 [2005/11/26] for i386
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: Linux for i386
Compiling test.pas
Linking test
C:\FPC\2.0.2\lib\i386-linux\/libdl.so: undefined reference to 
`_rtld_global at GLIBC_PRIVATE'
C:\FPC\2.0.2\lib\i386-linux\/libc.so: undefined reference to 
`__libc_enable_secure at GLIBC_PRIVATE'
C:\FPC\2.0.2\lib\i386-linux\/libc.so: undefined reference to 
`__libc_stack_end at GLIBC_2.1'
C:\FPC\2.0.2\lib\i386-linux\/libdl.so: undefined reference to 
`_rtld_global_ro at GLIBC_PRIVATE'
C:\FPC\2.0.2\lib\i386-linux\/libc.so: undefined reference to 
`_dl_out_of_memory at GLIBC_PRIVATE'
C:\FPC\2.0.2\lib\i386-linux\/libc.so: undefined reference to 
`___tls_get_addr at GLIBC_2.3'
C:\FPC\2.0.2\lib\i386-linux\/libc.so: undefined reference to 
`_r_debug at GLIBC_2.0'
C:\FPC\2.0.2\lib\i386-linux\/libc.so: undefined reference to 
`_dl_argv at GLIBC_PRIVATE'
C:\FPC\2.0.2\lib\i386-linux\/libdl.so: undefined reference to 
`_dl_rtld_di_serinfo at GLIBC_PRIVATE'
testthreads.pas(37,1) Error: Error while linking
Error: c:\FPC\2.0.2\bin\i386-Win32\ppc386.exe returned an error exitcode 
(normal if you did not specify a source file to be compiled)


while

  nm -D ld-linux.so.2
0000e6a0 T ___tls_get_addr
00015f1c D __libc_enable_secure
000101b0 W __libc_memalign
00015f18 D __libc_stack_end
0000de70 T __tls_get_addr
0000e610 T _dl_allocate_tls
0000e3f0 T _dl_allocate_tls_init
00015e8c D _dl_argv
0000e640 T _dl_deallocate_tls
0000c450 T _dl_debug_state
0000e330 T _dl_get_tls_static_info
0000ec60 T _dl_make_stack_executable
0000db30 T _dl_mcount
00012258 R _dl_out_of_memory
00006840 T _dl_rtld_di_serinfo
0000e1f0 T _dl_tls_setup
000164e4 B _r_debug
00016020 D _rtld_global
00015cc0 D _rtld_global_ro
000103d0 W calloc
0000fda0 W free
00000000 A GLIBC_2.0
00000000 A GLIBC_2.1
00000000 A GLIBC_2.3
00000000 A GLIBC_PRIVATE
000102f0 W malloc
00010320 W realloc

the difference in the symbols is only the '@GLIBC...' part.
I have no problem linking the same code on Linux, on the very same 
system the libs came from.

I can link statically ( with -Xt), however.

Dominique.





More information about the fpc-pascal mailing list