Recent

Author Topic: Building 3.20 on a fairly old Debian Linux  (Read 479 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 1217
Building 3.20 on a fairly old Debian Linux
« on: July 30, 2020, 03:01:22 pm »
I'm currently running through the sequence of building all significant versions of FPC on i386, using a fairly old laptop. This has Debian 5 "Lenny" on it, in part because it's what supports video etc. well but also because it's a useful "sweet spot" release compatible with SPARC etc.

v3.0.4 builds without issue. V3.2.0 gives me this reproducible problem:

Code: [Select]
/usr/local/src_fpc/fpcbuild-3.2.0/fpcsrc/compiler$ /usr/local/src_fpc/fpcbuild-3.2.0/fpcsrc/compiler/ppc1 -Ur -Xs -O2 -n -Fui386 -Fusystems -Fu/usr/local/src_fpc/fpcbuild-3.2.0/fpcsrc/rtl/units/i386-linux -Fii386 -FE. -FUi386/units/i386-linux -dRELEASE -di386 -dGDB -dBROWSERLOG -Fux86 -Sew pp.pas
/usr/bin/ld:./link.res:315: syntax error
pp.pas(266,1) Error: Error while linking
pp.pas(266,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

$ /usr/bin/ld --version
GNU ld (GNU Binutils for Debian) 2.18.0.20080103
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

If I add the -sh parameter, then add --verbose to the invocation of ld in ppas.sh, I get

Code: [Select]
$ cat ppas.sh
#!/bin/sh
DoExitAsm ()
{ echo "An error occurred while assembling $1"; exit 1; }
DoExitLink ()
{ echo "An error occurred while linking $1"; exit 1; }
echo Linking ./pp
OFS=$IFS
IFS="
"
/usr/bin/ld --verbose  -b elf32-i386 -m elf_i386     -s  -L. -o ./pp -T ./link.res -e _start
if [ $? != 0 ]; then DoExitLink ./pp; fi
IFS=$OFS

/usr/local/src_fpc/fpcbuild-3.2.0/fpcsrc/compiler$ ./ppas.sh
Linking ./pp
GNU ld (GNU Binutils for Debian) 2.18.0.20080103
  Supported emulations:
   elf_i386
   i386linux
   elf_x86_64
opened script file ./link.res
/usr/bin/ld:./link.res:315: syntax error
An error occurred while linking ./pp

where line 315 is the final line in link.res, which reads

Code: [Select]
...
i386/units/i386-linux/rasm.o
i386/units/i386-linux/rax86.o
i386/units/i386-linux/rautils.o
i386/units/i386-linux/rax86att.o
i386/units/i386-linux/raatt.o
)
SECTIONS
{
  .fpcdata           :
  {
    KEEP (*(.fpc .fpc.n_version .fpc.n_links))
  }
  .threadvar : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }
}
INSERT AFTER .data;

I mention this in case it is of interest to the core developers, not because I'm expecting a fix (although one would be nice, and would allow me to continue testing recent FPC/Lazarus occasionally on that platform).

MarkMLl
« Last Edit: July 30, 2020, 03:24:47 pm by 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.

Warfley

  • Sr. Member
  • ****
  • Posts: 302
Re: Building 3.20 on a fairly old Debian Linux
« Reply #1 on: July 30, 2020, 03:25:52 pm »
You could install a newer linker, you can even do this on older debian systems (just download the executable or build the gnu binutils yourself)

MarkMLl

  • Hero Member
  • *****
  • Posts: 1217
Re: Building 3.20 on a fairly old Debian Linux
« Reply #2 on: July 30, 2020, 03:42:31 pm »
I know. But if FPC has started generating a questionable link.res, which might be related to the longstanding -T warning, I consider it at least courteous to solicit the developers' comments.

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.

PascalDragon

  • Hero Member
  • *****
  • Posts: 2093
  • Compiler Developer
Re: Building 3.20 on a fairly old Debian Linux
« Reply #3 on: July 30, 2020, 04:05:51 pm »
I mention this in case it is of interest to the core developers, not because I'm expecting a fix (although one would be nice, and would allow me to continue testing recent FPC/Lazarus occasionally on that platform).

You need to use either ld of version 2.19 or newer or pass the -X9 parameter (for the makefile you need to pass it as OPTNEW=-X9, because 3.0.4 does not support it, though I have not tested whether this works). This is documented here.

MarkMLl

  • Hero Member
  • *****
  • Posts: 1217
Re: Building 3.20 on a fairly old Debian Linux
« Reply #4 on: July 30, 2020, 04:28:41 pm »
You have a most engaging way of saying "RTFM" :-)

Compiling 3.2.0 with 3.0.4 and ld 2.18 as discussed, using OPTNEW='-X9' gets it past the compilation of ppc but it looks as though that's not getting into the makefile for fpc. If I rerun the command manually with -X9 it works... I've not yet worked out where it needs bodging into the makefile.

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.

PascalDragon

  • Hero Member
  • *****
  • Posts: 2093
  • Compiler Developer
Re: Building 3.20 on a fairly old Debian Linux
« Reply #5 on: July 30, 2020, 04:50:49 pm »
Compiling 3.2.0 with 3.0.4 and ld 2.18 as discussed, using OPTNEW='-X9' gets it past the compilation of ppc but it looks as though that's not getting into the makefile for fpc. If I rerun the command manually with -X9 it works... I've not yet worked out where it needs bodging into the makefile.

Well, the wiki did mention that it's not trivial and as I said, I have not tried it.

Alternatively you could simply compile a 3.2.0 on another Linux and bootstrap with that (after all the compiler is a static binary ;) ). Or you can use the generated ppc386 (if it gets that far), copy that and use that for compiling again. In both cases you'd use OPT instead of OPTNEW.

MarkMLl

  • Hero Member
  • *****
  • Posts: 1217
Re: Building 3.20 on a fairly old Debian Linux
« Reply #6 on: July 30, 2020, 05:51:38 pm »
I can confirm that OPTNEW=-X9 gets a usable ppc386 built, copying that to /usr/local/bin and changing to OPT=-X9 (in the make command line) gets everything else built including the fpc binary.

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.

Thaddy

  • Hero Member
  • *****
  • Posts: 10436
Re: Building 3.20 on a fairly old Debian Linux
« Reply #7 on: July 30, 2020, 06:03:45 pm »
https://wiki.freepascal.org/User_Changes_3.2.0#GNU_Binutils_2.19.1_or_later_are_required_by_default
And you use $ /usr/bin/ld --version GNU ld (GNU Binutils for Debian) 2.18.0.20080103

Seems to me you are expecting to much. That is not fairly old, it is more than a decade ago: 20080103

That version is more than twelve years old and has not been maintained for the last 10 years by that development team. (The Linux side)
« Last Edit: July 30, 2020, 06:06:49 pm by Thaddy »
When you ask a question that is actually answered in the documentation, you are either lazy or a moron.

MarkMLl

  • Hero Member
  • *****
  • Posts: 1217
Re: Building 3.20 on a fairly old Debian Linux
« Reply #8 on: July 30, 2020, 06:19:26 pm »
In which case I suggest that the fact that the FPC core developers anticipated this problem and (mostly) worked around it is to their credit, and that you should be expending as much effort in complimenting them as you are in criticising me :-) :-) :-)

Seriously, in general I agree with what you're saying: a (modest) binutils upgrade is normally no big issue, and that really is a very old distro release. But as I've said, it's a distro release worth having since it includes SPARC, Itanium etc. that were either dropped or went into rapid decline shortly after.

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.

 

TinyPortal © 2005-2018