[fpc-pascal] fpc2.6.4 compilation problem

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Jan 11 12:12:53 CET 2015


On 10/01/15 17:48, Vahe Sahakyan wrote:

> In the attached please find the code in PASCAL (as an example) with 
> external procedure on FORTRAN which I’m training to compile. The names 
> of these two programs are: “exmppas.p”  and “exmpfrt.f”, and for 
> compilation I'm using the following commands:

Your external declaration in Pascal is missing "cdecl;". Adding that
will not solve the linker error, but not having it means that you're
using the wrong calling convention and depending on the
platform/parameter types it can cause crashes or corrupt values.

> Linking exempts
> Undefined symbols for architecture x86_64:
>   "___powisf2", referenced from:
>       _hbin_ in libpacklib.a(hbin.o)
> ld: symbol(s) not found for architecture x86_64
> An error occurred while linking 
> exmppas.p(15) Error: Error while linking
> exmppas.p(15) Fatal: There were 1 errors compiling module, stopping
> Fatal: Compilation aborted
> Error: /sw/bin/ppcx64 returned an error exitcode (normal if you did not
> specify a source file to be compiled)
> 
> I'm using fpc 2.4.6.
> Please note I have tried the same things on MAC OS X Maverick 10.9.5 
> using fpc 2.4.0 and it works without any problems .

This has nothing to do with FPC 2.4 vs 2.6.4. It's about the version of
gfortran you use. Apparently the new versions's libpacklib.a references
a symbol that's not in any of the libraries you are linking in.

Google suggests it's in libgcc, so add {$linklib gcc} or {$linklib
gcc_s} (I don't know whether fink's gcc contains the default or shared
version). If libgcc.a/libgcc_s.dylib is not in /sw/lib/gcc4.9/lib, you
will also have to add the directory where it is located via another -Fl
parameter to FPC.


Jonas



More information about the fpc-pascal mailing list