Recent

Author Topic: Error when compile under Linux for SPARC: /usr/bin/ld: skipping incompatible .o  (Read 6024 times)

IgorM

  • Newbie
  • Posts: 5
Hi!

When I compile my program on Linux for SPARC, I've got error:
[root@host1 fpc]# fpc hello.pas
Free Pascal Compiler version 3.0.2 [2017/05/07] for sparc
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for SPARC
Compiling hello.pas
Assembling hello
Linking hello
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: skipping incompatible hello.o when searching for hello.o
/usr/bin/ld: skipping incompatible ./hello.o when searching for hello.o
/usr/bin/ld: cannot find hello.o
hello.pas(5,40) Error: Error while linking
hello.pas(5,40) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcsparc returned an error exitcode
[root@host1 fpc]#


Could you please advise - what is wrong?

Thanx!

Best Regards
Igor Melnikov

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11947
  • FPC developer.
The format of .o that the compiler generates and that the linker wants don't match.

Wrong linker or compiler or wrong linker/compiler target.

Some linkers can accept multiple kinds of .o, but need parameters to switch (usually -m., which can be passed via the compiler using -k)

IgorM

  • Newbie
  • Posts: 5
Hi Marcov!

Thanx!
Object-file , generated by fpc is " ELF 64-bit":
[root@host1 fpc]# file hello.o
hello.o: ELF 64-bit MSB relocatable, SPARC V9, relaxed memory ordering, version 1 (SYSV), not stripped


When I sent to linker this target (elf64-sparc), the same error occur.
What target expect linker? - How verify full linker parameters generated by fpc ?
[root@host1 fpc]# fpc hello.pas -k-belf64-sparc
Free Pascal Compiler version 3.0.2 [2017/05/07] for sparc
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Linux for SPARC
Compiling hello.pas
Assembling hello
Linking hello
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: skipping incompatible hello.o when searching for hello.o
/usr/bin/ld: skipping incompatible ./hello.o when searching for hello.o
/usr/bin/ld: cannot find hello.o
hello.pas(5,40) Error: Error while linking
hello.pas(5,40) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcsparc returned an error exitcode


Thank you!

Best Regards
Igor Melnikov


MarkMLl

  • Hero Member
  • *****
  • Posts: 8039
This thread died of natural causes, but since it's the one turned up by search engines I thought it worth tacking a comment onto it. However since SPARC as a target seems to have very little life left in it this is more in the spirit of wrapping up loose ends than anything else.

I commented incorrectly to this that I thought I'd seen this on a SPARC (i.e. 32-bit) platform, and was suspicious that it was something to do with an attempt to move a compiler built on Debian 8 or 9 ("Lenny" or "Stretch", circa 2015 or 2017 respectively) to Debian 10 ("Buster", 2019) possibly the result of an incompatible linker version.

However I later realised that the Debian 10 system was, in fact, SPARC64 and that my problems stemmed at least in part from trying to run a 32-bit compiler on it. I've not explored to what extent this can be worked around with Debian's multiarch libraries, since the tenuous nature of Debian's support for the SPARC64 port introduces far too many potential points of failure for comfort.

Hence I think the first thing to suspect when seeing this sort of issue from a trivial program

Code: Text  [Select][+][-]
  1. 0 1>markMLl@sunfire:~$ fpc test.pas
  2. Free Pascal Compiler version 3.0.4 [2017/11/10] for sparc
  3. Copyright (c) 1993-2017 by Florian Klaempfl and others
  4. Target OS: Linux for SPARC
  5. Compiling test.pas
  6. Assembling test
  7. Linking test
  8. /usr/bin/ld: warning: link.res contains output sections; did you forget -T?
  9. /usr/bin/ld: skipping incompatible test.o when searching for test.o
  10. /usr/bin/ld: skipping incompatible ./test.o when searching for test.o
  11. /usr/bin/ld: cannot find test.o
  12. test.pas(6) Error: Error while linking
  13. test.pas(6) Fatal: There were 1 errors compiling module, stopping
  14. Fatal: Compilation aborted
  15. Error: /usr/local/bin/ppcsparc returned an error exitcode
  16.  

is a mismatch between a 64-bit OS and a version of FPC generating 32-bit code, i.e. as repeatedly experienced by people on the x86 and x86_64 platforms.

Having said which, 32-bit SPARC FPC 3.2.2 installed from Sourceforge appears to work with Debian 10 SPARC to an extent that it compiles simple programs to a runnable state. It is not, however, able to build anything complex like the Lazarus IDE.

MarkMLl
« Last Edit: June 16, 2022, 11:21:32 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018