fpc2.6.4 compilation problem

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

fpc2.6.4 compilation problem

Vahe Sahakyan
Hello,

I have some difficulties to compile my PASCAL code with external 
subroutine in FORTRAN on MAC OS X Yosemite 10.10.1 using fpc 2.6.4.

The problem is the following: I need to run the program in Pascal 
containing the external procedure in FORTRAN which uses the standard 
CERNLIB packages such as libpacklib.  

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:

$ gfortran -c exmpfrt.f
$ fpc exmppas.p -Fl/sw/lib/gcc4.9/lib

where with the -Fl/sw/lib/gcc4.9/lib I link the required libraries which 
I use in my code. But I get the following error:
 
Free Pascal Compiler version 2.6.4 [2015/01/09] for x86_64
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Darwin for x86_64
Compiling exmppas.p
Assembling (pipe) exmppas.s
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 .

I cannot figure out what is the problem. My be in this new version for 
linking libraries I should use another command or I have done mistake 
somewhere else?
Can someone help to solve the problems?

Thank you in advance.
Best regards,
Vahe


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

exmppas.p (334 bytes) Download Attachment
exmpfrt.f (908 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: fpc2.6.4 compilation problem

Jonas Maebe-2
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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpc2.6.4 compilation problem

Schindler Karl-Michael-2
In reply to this post by Vahe Sahakyan
Hi Vahe

Am 11.01.2015 um 12:00 schrieb [hidden email]:

> Message: 4
> Date: Sat, 10 Jan 2015 16:48:52 +0000 (UTC)
> From: Vahe Sahakyan <[hidden email]>
> To: "[hidden email]"
> <[hidden email]>
> Subject: [fpc-pascal] fpc2.6.4 compilation problem
> Message-ID:
> <[hidden email]>
>
> Content-Type: text/plain; charset="utf-8"
>
> Hello,
> I have some difficulties to compile my PASCAL code with external?subroutine in FORTRAN on MAC OS X Yosemite 10.10.1 using fpc 2.6.4.
> The problem is the following: I need to run the program in Pascal?containing the external procedure in FORTRAN which uses the standard?CERNLIB packages such as libpacklib. ?
> 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:
> $ gfortran -c exmpfrt.f$ fpc exmppas.p -Fl/sw/lib/gcc4.9/lib
> where with the -Fl/sw/lib/gcc4.9/lib I link the required libraries which?I use in my code. But I get the following error:?Free Pascal Compiler version 2.6.4 [2015/01/09] for x86_64Copyright (c) 1993-2014 by Florian Klaempfl and othersTarget OS: Darwin for x86_64Compiling exmppas.pAssembling (pipe) exmppas.sLinking exemptsUndefined symbols for architecture x86_64:? "___powisf2", referenced from:? ? ? _hbin_ in libpacklib.a(hbin.o)ld: symbol(s) not found for architecture x86_64An error occurred while linking?exmppas.p(15) Error: Error while linkingexmppas.p(15) Fatal: There were 1 errors compiling module, stoppingFatal: Compilation abortedError: /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 .
> I cannot figure out what is the problem. My be in this new version for?linking libraries I should use another command or I have done mistake?somewhere else?Can someone help to solve the problems?
> Thank you in advance.Best regards,Vahe
As much as I know, the missing symbol ___powisf2 is part of the fortran library, libgfortran, which should be in /sw/lib/gcc4.9/lib/. Maybe check, whether this is really the case.
Secondly, how does the linker get the information to link libgfortran? Through a linklib directive? If not, you may have to use the fpc options "-k -lgfortran" to pass the information to the linker.

Passing -vt or even -va will give you further (in case of -va a huge amount) of information building your program. I do not expect any difference between 2.4.0 and 2.6.*. I am using 2.6.4 on 10.9 in combination with gfortran and it works well.

Michael.

P.S. can you somehow achieve, to send a plain text email. The way you did it results in a very hard to read output.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

signature.asc (507 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: fpc2.6.4 compilation problem

Tomas Hajny-2
On Sun, January 11, 2015 12:43, Schindler Karl-Michael wrote:


Hello Michael,

The original poster is apparently not subscribed to the list (although he
forgot to mention this fact in his post) - adding him. In Cc: now so that
he could see your response).

Tomas



> Am 11.01.2015 um 12:00 schrieb [hidden email]:
>
>> Message: 4
>> Date: Sat, 10 Jan 2015 16:48:52 +0000 (UTC)
>> From: Vahe Sahakyan <[hidden email]>
>> To: "[hidden email]"
>> <[hidden email]>
>> Subject: [fpc-pascal] fpc2.6.4 compilation problem
>> Message-ID:
>> <[hidden email]>
>>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hello,
>> I have some difficulties to compile my PASCAL code with
>> external?subroutine in FORTRAN on MAC OS X Yosemite 10.10.1 using fpc
>> 2.6.4.
>> The problem is the following: I need to run the program in
>> Pascal?containing the external procedure in FORTRAN which uses the
>> standard?CERNLIB packages such as libpacklib. ?
>> 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:
>> $ gfortran -c exmpfrt.f$ fpc exmppas.p -Fl/sw/lib/gcc4.9/lib
>> where with the -Fl/sw/lib/gcc4.9/lib I link the required libraries
>> which?I use in my code. But I get the following error:?Free Pascal
>> Compiler version 2.6.4 [2015/01/09] for x86_64Copyright (c) 1993-2014 by
>> Florian Klaempfl and othersTarget OS: Darwin for x86_64Compiling
>> exmppas.pAssembling (pipe) exmppas.sLinking exemptsUndefined symbols for
>> architecture x86_64:? "___powisf2", referenced from:? ? ? _hbin_ in
>> libpacklib.a(hbin.o)ld: symbol(s) not found for architecture x86_64An
>> error occurred while linking?exmppas.p(15) Error: Error while
>> linkingexmppas.p(15) Fatal: There were 1 errors compiling module,
>> stoppingFatal: Compilation abortedError: /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 .
>> I cannot figure out what is the problem. My be in this new version
>> for?linking libraries I should use another command or I have done
>> mistake?somewhere else?Can someone help to solve the problems?
>> Thank you in advance.Best regards,Vahe
>
> As much as I know, the missing symbol ___powisf2 is part of the fortran
> library, libgfortran, which should be in /sw/lib/gcc4.9/lib/. Maybe check,
> whether this is really the case.
> Secondly, how does the linker get the information to link libgfortran?
> Through a linklib directive? If not, you may have to use the fpc options
> "-k -lgfortran" to pass the information to the linker.
>
> Passing -vt or even -va will give you further (in case of -va a huge
> amount) of information building your program. I do not expect any
> difference between 2.4.0 and 2.6.*. I am using 2.6.4 on 10.9 in
> combination with gfortran and it works well.
>
> Michael.
>
> P.S. can you somehow achieve, to send a plain text email. The way you did
> it results in a very hard to read output.
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal