Recent

Author Topic: FPC3.04 Error while linking  (Read 564 times)

ada

  • Newbie
  • Posts: 1
FPC3.04 Error while linking
« on: August 11, 2020, 05:13:19 am »
I am a newer for lazarus(I have used the delphi for several years),After i installed the Lazarus on linux,then i test the fpc,the error displayed on  console:
  [xty@localhost lazarus1.8.4]$ fpc  hello.pas -T
Error: Illegal parameter: -T
Error: /usr/bin/ppcx64 returned an error exitcode
[xty@localhost lazarus1.8.4]$ fpc  hello.pas
Free Pascal Compiler version 3.0.4 [2017/10/02] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling hello.pas
Linking hello
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: /usr/lib64/fpc/3.0.4/units/x86_64-linux/rtl/prt0.o: unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: 错误的值
hello.pas(4,1) Error: Error while linking
hello.pas(4,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode

The version
fpc-3.0.4-1.x86_64.rpm
lazarus-1.8.4-0.x86_64.rpm

The linux version
cat /proc/version
Linux version 4.4.13-200.nd7.3.x86_64 (mockbuild@kojibuilder8) (gcc version 4.9.3 20150626 (4.9.3-3) (GCC) ) #1 SMP Sat Jul 8 23:22:12 CST 2017
Linux localhost 4.4.13-200.nd7.3.x86_64 #1 SMP Sat Jul 8 23:22:12 CST 2017 x86_64 x86_64 x86_64 GNU/Linux

LSB Version:   :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Release:   5.0
Codename:   x86
GNU ld version 2.24


Any one can help me?
Thank you very much!

TRon

  • Hero Member
  • *****
  • Posts: 536
Re: FPC3.04 Error while linking
« Reply #1 on: August 11, 2020, 05:52:16 am »
Hello ada,

I have no idea why the linker fails for you with that message, but whatever you do, do not provide the option "-T" to the fpc command-line compiler.

That message you see "did you forget -T?" is there because the linker outputs that message, not FPC. That message from the linker is harmless and exists for ages. It works confusing because you also have another linker related error. FPC uses the option -T for something completely different/unrelated.

dbannon

  • Hero Member
  • *****
  • Posts: 1165
    • tomboy-ng, a rewrite of the classic Tomboy
Re: FPC3.04 Error while linking
« Reply #2 on: August 11, 2020, 06:25:45 am »
Ada, when you installed fpc (from the rpm) did it all go smoothly ?  You did not have to 'force' the install because a dependency was unresolved ?

Just to be sure, you do have binutils installed ?

Davo

Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

BeniBela

  • Hero Member
  • *****
  • Posts: 761
    • homepage
Re: FPC3.04 Error while linking
« Reply #3 on: August 11, 2020, 09:17:21 am »
OMG that message looks familiar.

I just got that message on the Travis CI server yesterday

What is going on there?

TRon

  • Hero Member
  • *****
  • Posts: 536
Re: FPC3.04 Error while linking
« Reply #4 on: August 11, 2020, 10:36:16 am »
@BeniBela:
Are you also using ld 2.24 or 2.25 ?

In case you are, could you try with optimisations off ? I can't detect that from TS' output but was able to see from your log.

Only meant for test purpose to verify a current hunch.

In case your using this setup for a longer period of time and had always worked ok for you (with optimisations on), then forgot above suggestion because in that case it makes no sense to turn them off.

BeniBela

  • Hero Member
  • *****
  • Posts: 761
    • homepage
Re: FPC3.04 Error while linking
« Reply #5 on: August 11, 2020, 11:40:50 am »
@BeniBela:
Are you also using ld 2.24 or 2.25 ?

2.24

In case you are, could you try with optimisations off ? I can't detect that from TS' output but was able to see from your log.

Does not change anything

Rerunning it with different settings, has erased the above log, but here is an excerpt:

Quote
Hint: (11030) Start of reading config file /home/travis/.fpc.cfg
Hint: (11030) Start of reading config file /etc/fpc.cfg
Hint: (11031) End of reading config file /etc/fpc.cfg
Hint: (11031) End of reading config file /home/travis/.fpc.cfg
Note: (11046) DWARF debug information cannot be used with smart linking on this target, switching to static linking
Free Pascal Compiler version 3.0.4 [2018/10/29] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
(1002) Target OS: Linux for x86-64
/usr/bin/ld: warning: /home/travis/build/benibela/sf/programs/internet/xidel/link.res contains output sections; did you forget -T?
(3104) Compiling xidel.pas
/home/travis/build/benibela/sf/programs/internet/xidel/xidel.pas(33,22) Hint: (5023) Unit "multipagetemplate" not used in xidel
(9015) Linking /home/travis/build/benibela/sf/programs/internet/xidel/xidel
/usr/bin/ld: /usr/lib/fpc/3.0.4/units/x86_64-linux/rtl/prt0.o: unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
/home/travis/build/benibela/sf/programs/internet/xidel/xidel.pas(98,1) Error: (9013) Error while linking
/home/travis/build/benibela/sf/programs/internet/xidel/xidel.pas(98,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
Error: (lazarus) Compile Project, Mode: default, Target: xidel: stopped with exit code 1
Error: (lazbuild) failed compiling of project /home/travis/build/benibela/sf/programs/internet/xidel/xidel.lpi


In case your using this setup for a longer period of time and had always worked ok for you (with optimisations on), then forgot above suggestion because in that case it makes no sense to turn them off.

It has always worked, until I updated it from Lazarus 1.8.0RC5 to 2.0.8

dbannon

  • Hero Member
  • *****
  • Posts: 1165
    • tomboy-ng, a rewrite of the classic Tomboy
Re: FPC3.04 Error while linking
« Reply #6 on: August 11, 2020, 11:56:44 am »
It has always worked, until I updated it from Lazarus 1.8.0RC5 to 2.0.8

It looks more like a compiler issue than Lazarus to me.  In particular, Ada is seeing it with no Lazarus involved at all.

Benibela, when you updated your Lazarus, did you also update your operating system ?   Hmm, I assume you don't see it on your local machine anyway ?   Do you know what OS Travis is using ?

Ada, what operating system are your using ?   

Ada is using fpc3.0.4 in a simple hello world, we have been using fpc 3.0.4 for longer than I have been using Object Pascal, so he has not found a fpc bug, I am suggesting something may have changed in some OS build tools.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

MarkMLl

  • Hero Member
  • *****
  • Posts: 1347
Re: FPC3.04 Error while linking
« Reply #7 on: August 11, 2020, 11:58:43 am »
FPC 3.2.0 has a workaround for the longstanding -T warning message, which can be inhibited by the new -X9 option. Lazarus might have started to make assumptions (one way or the other) about FPC's linker behaviour, and about the precise binutils (i.e. ld etc.) version installed.

Note that I'm not necessarily saying "this is the problem", but that it might be related.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.

BeniBela

  • Hero Member
  • *****
  • Posts: 761
    • homepage
Re: FPC3.04 Error while linking
« Reply #8 on: August 11, 2020, 12:02:37 pm »
Fine, it is working with ld 2.26 ...




Benibela, when you updated your Lazarus, did you also update your operating system ?   Hmm, I assume you don't see it on your local machine anyway ?   Do you know what OS Travis is using ?


The server installs the fpc that comes with Lazarus. With the old Lazarus it probably used an older fpc

It was also working with Lazarus 2.0.10 (with fpc 3.2 i guess) on the server

TRon

  • Hero Member
  • *****
  • Posts: 536
Re: FPC3.04 Error while linking
« Reply #9 on: August 11, 2020, 12:09:31 pm »
2.24
Ok. In that case note that there seem to be issues reported (general sense, not pascal related) with regards to ld 2.24/2.25 and certain optimised code (e.g. making use of particular instructions) that these linker-version seems to trip over (also mentioned that ld 2.26 seems to fix thee kind of issues).

In such cases it reported the same error-message.

Quote
Does not change anything
That can still mean it is related to this issue, only that FPC uses these instructions the linker trips over without using  optimisations, although chance is in that case a lot smaller.

Quote
It has always worked, until I updated it from Lazarus 1.8.0RC5 to 2.0.8
As mentioned by dbannon, it seems more like a compiler related issue (more in particular,  linker related).

TRon

  • Hero Member
  • *****
  • Posts: 536
Re: FPC3.04 Error while linking
« Reply #10 on: August 11, 2020, 12:10:22 pm »
Fine, it is working with ld 2.26 ...
As suspected. Thank you for the confirmation.

 

TinyPortal © 2005-2018