Hello,
I have a small server application (only ~130 lines) I need to run on a Debian server. Sadly Delphi still doesn't offer Linux support, and rather than rewriting the thing in Java, I want to try compiling it with Free Pascal. I downloaded CrossFPC because it comes with the required bintools and a compiled RTL. Surprisingly I was able to compile and run a simple helloworld program without major problems.
However, my program uses Indy, which seems to be slightly more complicated. It compiles fine, but linking fails
This is the batch file I use for compiling:
"C:\Program Files\CrossFPC\bin\i386-win32\ppc386.exe" -TLINUX -FD"C:\Program Files\CrossFPC\bin\i386-linux\" -Xs -Xd -XX -Mdelphi -FlC:\i386-linux -Fu"M:\CodeGear RAD Studio 2009\Indy 10 SVN\trunk\Lib\Core\;M:\CodeGear RAD Studio 2009\Indy 10 SVN\trunk\Lib\Protocols;M:\CodeGear RAD Studio 2009\Indy 10 SVN\trunk\Lib\System" project1.lpr
The helloworld program worked without specifying the library path, but Indy (or RTL units it uses) seems to require libc. I tried using the one that comes with CrossFPC first, but it threw a bunch of "undefined reference" errors at me. Then I downloaded the libc6-i386 package on Debian and copied the files to my local machine (and I also removed various numbers from the file extensions). I couldn't find the crt*.o files, so I took them from CrossFPC. That brought a slight improvement, since 2-3 of the reference errors disappeared.
This is the output I get:
Free Pascal Compiler version 2.7.1 [2013/09/08] for i386
Copyright (c) 1993-2013 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling project1.lpr
project1.lpr(57,3) Note: Local variable "Path" not used
project1.lpr(57,9) Note: Local variable "CRC32" not used
project1.lpr(58,3) Note: Local variable "Buf" not used
project1.lpr(59,3) Note: Local variable "FS" not used
Linking project1
C:\i386-linux\/libdl.so: undefined reference to `_rtld_global@GLIBC_PRIVATE'
C:\i386-linux\/libc.so: undefined reference to `__libc_enable_secure@GLIBC_PRIVATE'
C:\i386-linux\/libc.so: undefined reference to `__libc_stack_end@GLIBC_2.1'
C:\i386-linux\/libdl.so: undefined reference to `_rtld_global_ro@GLIBC_PRIVATE'
C:\i386-linux\/libc.so: undefined reference to `___tls_get_addr@GLIBC_2.3'
C:\i386-linux\/libc.so: undefined reference to `_dl_argv@GLIBC_PRIVATE'
C:\i386-linux\/libdl.so: undefined reference to `_dl_rtld_di_serinfo@GLIBC_PRIVATE'
project1.lpr(131,1) Error: Error while linking
project1.lpr(131,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Any ideas? Am I missing files or is it the wrong libc version?