FPC3.04 Error while linking lazarus / 1-Linux ---------------------------------------------------------------------- ada · 2020-08-11 03:13 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 · 2020-08-11 03:52 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 · 2020-08-11 04:25 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 ---------------------------------------------------------------------- BeniBela · 2020-08-11 07:17 OMG that message looks familiar. I just got that message on the Travis CI server yesterday What is going on there? ---------------------------------------------------------------------- TRon · 2020-08-11 08:36 @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 · 2020-08-11 09:40 Quote from: TRon on August 11, 2020, 10:36:16 am@BeniBela: Are you also using ld 2.24 or 2.25 ? 2.24 Quote from: TRon on August 11, 2020, 10:36:16 amIn 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: QuoteHint: (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 Quote from: TRon on August 11, 2020, 10:36:16 amIn 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 · 2020-08-11 09:56 Quote from: BeniBela on August 11, 2020, 11:40:50 amIt 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 ---------------------------------------------------------------------- MarkMLl · 2020-08-11 09:58 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 ---------------------------------------------------------------------- BeniBela · 2020-08-11 10:02 Fine, it is working with ld 2.26 ... Quote from: dbannon on August 11, 2020, 11:56:44 am 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 · 2020-08-11 10:09 Quote from: BeniBela on August 11, 2020, 11:40:50 am2.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. QuoteDoes 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. QuoteIt 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 · 2020-08-11 10:10 Quote from: BeniBela on August 11, 2020, 12:02:37 pmFine, it is working with ld 2.26 ... As suspected. Thank you for the confirmation.