Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-11

Bootstrapping FPC for x86_64

7 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I setup a new 64bit server in our company, running Ubuntu 8.04 LTS (64bit). I want to us it as a 64bit testbed for our applications. So I want to compile 64bit version of our software.

I installed all the usual compiler requirements: binutils etc...

I copied FPC 2.2.3 (latest svn revision) from my local 32bit system to the 64bit server. I made sure my ~/.fpc.cfg file is correct. I then ran the following script which I use for all my FPC versions on my local machine.

---------------[ startbuild.sh ]----------------
make clean
make install INSTALL_PREFIX=/home/graemeg/programming/fpc_2.2.3 ----------------[ end ]--------------------

My directory layouts are as follows
/home/graemeg/programming/fpc_2.2.3
/src
<--- svn checkout
/bin
/lib
/.......

My fpc.cfg file reflects the compiler version number in the unit search paths. When I try and recompile the compiler, I get the following error.

make[3]: Entering directory
`/home/graemeg/programming/fpc_2.2.3/src/utils/fpdoc' /home/graemeg/programming/fpc_2.2.3/src/compiler/ppc386 -Ur -Xs -O2 -n -S2h -Fu/home/graemeg/programming/fpc_2.2.3/src/rtl/units/i386-linux -Fu/home/graemeg/programming/fpc_2.2.3/src/packages/fcl-base/units/i386-linux -Fu/home/graemeg/programming/fpc_2.2.3/src/packages/fcl-xml/units/i386-linux -Fu/home/graemeg/programming/fpc_2.2.3/src/packages/fcl-passrc/units/i386-linux -Fu/home/graemeg/programming/fpc_2.2.3/src/packages/chm/units/i386-linux -FE. -FUunits/i386-linux -di386 -dRELEASE fpdoc.pp /usr/bin/ld: skipping incompatible /usr/lib/crti.o when searching for /usr/lib/crti.o
/usr/bin/ld: cannot find /usr/lib/crti.o
Error: Error while linking
Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
make[3]: *** [fpdoc] Error 1
make[3]: Leaving directory `/home/graemeg/programming/fpc_2.2.3/src/utils/fpdoc' make[2]: *** [fpdoc_all] Error 2
make[2]: Leaving directory `/home/graemeg/programming/fpc_2.2.3/src/utils' make[1]: *** [utils_all] Error 2
make[1]: Leaving directory `/home/graemeg/programming/fpc_2.2.3/src' make: *** [build-stamp.i386-linux] Error 2

Questions:

1) I see it's generating a i386 compiler and not a x86_64 compiler??? Maybe that's because I copied my 32bit FPC 2.2.3 directory to the 64bit server?

2) No idea what the error means. I do have a /usr/lib/crti.o file. But maybe that's due to the server being 64bit and FPC is generating a 32bit executable.

3) Can I bootstrap a 64bit FPC without any previous FPC compiler? I don't want to download 35MB's FPC 2.2.2 just to recompile 2.2.3

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Joost van der Sluis
to Graeme Geldenhuys

Op maandag 24-11-2008 om 12:04 uur [tijdzone +0200], schreef Graeme Geldenhuys:

Show quoted text 6 lines
Questions: 1) I see it's generating a i386 compiler and not a x86_64 compiler??? Maybe that's because I copied my 32bit FPC 2.2.3 directory to the 64bit server?

No, that's because you used a 32-bit start-compiler

2) No idea what the error means. I do have a /usr/lib/crti.o file. But maybe that's due to the server being 64bit and FPC is generating a 32bit executable.

Indeed. Run 'file /usr/lib/crti.o' and you'll see

3) Can I bootstrap a 64bit FPC without any previous FPC compiler? I don't want to download 35MB's FPC 2.2.2 just to recompile 2.2.3

You only need the file 'ppcx64' or you have to cross-compile. But cross-compiling from 32bit to 64bit is a bit hard, and if I remember correctly even not possible for all versions of fpc.

Joost.

Henry Vermaak
to Graeme Geldenhuys: I setup a new 64bit server in our company, running Ubuntu 8.04 LTS (64bit). I want to us…

2008/11/24 Graeme Geldenhuys :

Show quoted text 12 lines
Hi, I setup a new 64bit server in our company, running Ubuntu 8.04 LTS (64bit). I want to us it as a 64bit testbed for our applications. So I want to compile 64bit version of our software. I installed all the usual compiler requirements: binutils etc... I copied FPC 2.2.3 (latest svn revision) from my local 32bit system to the 64bit server. I made sure my ~/.fpc.cfg file is correct. I then ran the following script which I use for all my FPC versions on my local machine.

why don't you download a 64bit release from the website to use as a starting compiler?

henry

Graeme Geldenhuys
to Joost van der Sluis: Op maandag 24-11-2008 om 12:04 uur [tijdzone +0200], schreef Graeme Geldenhuys: No,…
Joost van der Sluis wrote 7 lines
Op maandag 24-11-2008 om 12:04 uur [tijdzone +0200], schreef Graeme > > 1) I see it's generating a i386 compiler and not a x86_64 compiler??? > Maybe that's because I copied my 32bit FPC 2.2.3 directory to the > 64bit server? No, that's because you used a 32-bit start-compiler

That's what I meant... :-)

Show quoted text 5 lines
> 2) No idea what the error means. I do have a /usr/lib/crti.o file. But > maybe that's due to the server being 64bit and FPC is generating a > 32bit executable. Indeed. Run 'file /usr/lib/crti.o' and you'll see

:-(

Show quoted text 6 lines
> 3) Can I bootstrap a 64bit FPC without any previous FPC compiler? I > don't want to download 35MB's FPC 2.2.2 just to recompile 2.2.3 You only need the file 'ppcx64' or you have to cross-compile. But cross-compiling from 32bit to 64bit is a bit hard, and if I remember correctly even not possible for all versions of fpc.

Based on (1)'s answer, using a 32bit start compiler I thought I would try my hand at cross-compiling which I have never done before. :-)

After a few attemps using the following command line, I noticed it keeps looking for the cross-compler versions of 'as' and 'ld'. eg; 'x86_64-linux-as' I knew that the standard 'as' command is the correct one, because I'm on the 64bit system. I created a bin directory in my $HOME and added it to $PATH. I then created symlinks to resolve the new cross-compiler binutils names.

make CPU_TARGET=x86_64 OS_TARGET=linux
FPC=/home/graemeg/programming/ppc386 cycle

After running the above command, I finally ended up with a 'ppx86' executable. I'll now try and build the whole FPC with that. :-) Lets hope all goes well!

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Graeme Geldenhuys
to Henry Vermaak: 2008/11/24 Graeme Geldenhuys : why don't you download a 64bit release from the website to…
Henry Vermaak wrote
2008/11/24 Graeme Geldenhuys : why don't you download a 64bit release from the website to use as a starting compiler?

That would be the easiest option, but for some reason our download link is VERY slow today. 5Kb download speed, so the 35MB download is going to take over 2 hours. :-(

But so far, I think my cross-compiling trick worked... It's busy compiling my new 64bit FPC as I type. :-) Lets just hope it completes without issues.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Graeme Geldenhuys
to Graeme Geldenhuys: That's what I meant... :-) :-( Based on (1)'s answer, using a 32bit start compiler I…
Graeme Geldenhuys wrote 7 lines
make CPU_TARGET=x86_64 OS_TARGET=linux FPC=/home/graemeg/programming/ppc386 cycle After running the above command, I finally ended up with a 'ppx86' executable. I'll now try and build the whole FPC with that. :-) Lets hope all goes well!

IT WORKED!!!!!!!!!!!!!!!!! :-)

$> fpc -i
Free Pascal Compiler version 2.2.3

Compiler Date : 2008/11/24
Compiler CPU Target: x86_64

Supported targets:
Linux for x86-64
FreeBSD for x86-64
Win64 for x64

[....]

Now I can finally do local 64bit FPC testing and development without having to connecting to an Austrian server! :-)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/