[fpc-pascal] FPC 2.x for old Solaris
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Sun Jan 16 05:12:11 CET 2011
Jonas Maebe wrote:
> On 14 Jan 2011, at 15:02, Mark Morgan Lloyd wrote:
>
>> Does anybody have an archived copy of FPC 2.x for SPARC Solaris v8 or older? The ones available by FTP (2.1.1 and 2.4.2) both appear to be for Solaris 10, i.e. expect newer libraries.
>>
>> I suspect that it was available or at least built and tested at some point because the enabled packages appear to be a fairly good match to what's in v8.
>
> I perform nightly regression testing on Solaris 9, and it works fine. I don't actually use it though, and I've never tested any of the packages (someone else did the Sparc Solaris port and enabled the packages).
>
> It's not that hard to bootstrap everything for another system even without a cross-toolchain, only a bit labour-intensive:
>
> a) build a SPARC cross-compiler (prerequisite: a native compiler compiled from the same FPC sources, replace ppcarch with ppc386 or equivalent)
> cd fpc/compiler
> make FPC=/path/to/fpc/with/same/version/ppcarch PPC_TARGET=sparc OPT="-O2" clean all
> mv ppcsparc somewhereelse
>
> b) compile the RTL into assembler files (note that this step won't work without extra preparation for all targets due to RTL assembler startup files; it does for Solaris though):
> cd fpc/rtl/solaris
> make FPC=somewhereelse/ppcsparc OPT="-O2 -a -s" clean all
>
> c) compile the compiler into assembler files
> cd fpc/compiler
> make FPC=somewhereelse/ppcsparc OPT="-O2 -a -st" OS_TARGET=solaris clean all (ignore the error message at the end about the makefile being unable to find "pp")
>
> d) transfer all compiled sources to your target system (make sure to create the "units" directories on the target system first)
> scp -r fpc/rtl/units/sparc-solaris solarisbox:fpc/rtl/units
> scp -r fpc/compiler/sparc/units/solaris-sparc solarisbox:fpc/compiler/sparc/units
> scp fpc/compiler/pp_* solarisbox:fpc/compiler
>
> e) assemble the RTL
> Execute the following command in solarisbox:fpc/rtl/units/sparc-solaris directory:
> for file in *.s ; do gas -o `basename $file`.o $file ; done
>
> f) assemble and link the compiler
> 1) edit solarisbox:fpc/compiler/pp_link.res and perform a global search/replace to fix the absolute paths pointing to the RTL object files so they match your solaris box dir layout
> 2) change to the solarisbox:fpc/compiler directory and execute "./pp_ppas.sh"
> 3) rename the generated pp to ppcsparc
Thanks for that, noted for next time :-) The solution turned out to be
fairly easy: the Solaris compiler uses dynamic libraries since some
(libm) don't exist in static form on 10 and others (libmd5 etc.) don't
exist in static form at all. Taking ppcsparc from 10 and running it on 8
failed because it was linked against libm.so which was a symlink to
libm.so.2, it was resolving that at link time so required libm.so.2
rather than libm.so. However libm.so.1 is on Solaris 10 and simply
changing the symlink before linkage created a binary that would run on
both 10 and 8.
So the remaining question is whether it it possible to tell FPC build to
always link against libm.so.1 rather than using the symlink, since
messing around with the symlink would obviously be undesirable on a
system with multiple users.
As noted elsewhere I've got FPC on Solaris 10 to the state where it will
compile (but not fully link) Lazarus, fpGUI appears OK so we're probably
at a state where lazbuild on simple projects would work.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list