Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-01

fpc2.6.4 compilation problem

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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_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

Jonas Maebe
to Vahe Sahakyan
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.

Show quoted text 15 lines
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

Schindler Karl-Michael

Hi Vahe

Am 11.01.2015 um 12:00 schrieb

Show quoted text 20 lines
Message: 4 Date: Sat, 10 Jan 2015 16:48:52 +0000 (UTC) From: Vahe Sahakyan To: "" Subject: [fpc-pascal] fpc2.6.4 compilation problem Message-ID: 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.

Tomas Hajny
to Schindler Karl-Michael

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

Show quoted text 63 lines
Am 11.01.2015 um 12:00 schrieb > Message: 4 > Date: Sat, 10 Jan 2015 16:48:52 +0000 (UTC) > From: Vahe Sahakyan > To: "" > > Subject: [fpc-pascal] fpc2.6.4 compilation problem > Message-ID: > > > 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 - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal