Just tried to install the FPC port in a AMD64 FreeBSD and got an error that it was an i386 only port.
Is this a deficiency of the port in FreeBSD or is FPC only 32bits?

Mailing lists / fpc-pascal / 2007-06
32 messages · 10 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Just tried to install the FPC port in a AMD64 FreeBSD and got an error that it was an i386 only port.
Is this a deficiency of the port in FreeBSD or is FPC only 32bits?
Just tried to install the FPC port in a AMD64 FreeBSD and got an error that it was an i386 only port. Is this a deficiency of the port in FreeBSD or is FPC only 32bits?
Yes. I tried to get it running on AMD64 (and the results are in SVN), but the binary won't run and I don't fully understand why.
Just tried to install the FPC port in a AMD64 FreeBSD and got an error that it was an…
Francisco Reyes wroteJust tried to install the FPC port in a AMD64 FreeBSD and got an error that it was an i386 only port. Is this a deficiency of the port in FreeBSD or is FPC only 32bits?
It's a deficiency of the port.
I run 64 bit FPC every day, even my Lazarus is 64-bit :-)
Michael.
Michael Van Canneyt ?????:
It's a deficiency of the port. I run 64 bit FPC every day, even my Lazarus is 64-bit :-)
Hmm.. Where I can get FPC port for FreeBSD-amd64?
Yes. I tried to get it running on AMD64 (and the results are in SVN), but the binary…
Marco van de Voort wroteYes. I tried to get it running on AMD64 (and the results are in SVN), but the binary won't run and I don't fully understand why.
Is your work on the 2.1.4 Beta or I have to do SVN?
In particular I see sources from May 20 at
http://sourceforge.net/project/showfiles.php?group_id=2174
What files do I need to download for the source distribution to try and compile/test on amd64?
I see fpc-2.1.4.source.tar.gz and fpcbuild-2.1.4.tar.gz
I may try them both tonight, but any pointers would be helpfull.
You can't compile on amd64, since you still have to create the compiler (and debug the actual problem).
So you need:
- a starting compiler (2.0.4 or 2.1.4)
- a 2.3.x (development) snapshot or svn checkout, which are afaik on FTP's server. Note that sourceforge only contains releases, not snapshots
Then you need to crosscompile (see http://www.stack.nl/~marcov/buildfaq.pdf ) to AMD64, and fix the problems in the end.
It is possible to create a binary for amd64, but that binary doesn't work, and I don't know why. FreeBSD keeps complaining it can't execute it.
.note.abi set?
Yes. We even did it together.
You can't compile on amd64, since you still have to create the compiler (and debug the…
Marco van de Voort wrote- a starting compiler (2.0.4 or 2.1.4)
Have it.
- a 2.3.x (development) snapshot or svn checkout, which are afaik on FTP's server. Note that sourceforge only contains releases, not snapshots
Which directory?
....
drwxr-xr-x 2 1001 1001 4096 Mar 17 20:55 i386-emx drwxr-xr-x 2 1001 1001 4096 May 31 01:22 i386-go32v2 drwxr-xr-x 2 1001 1001 4096 May 31 01:40 i386-win32 ....
drwxr-xr-x 2 1001 1001 4096 Mar 18 00:03 source ....
The source?
Then you need to crosscompile (see http://www.stack.nl/~marcov/buildfaq.pdf ) to AMD64, and fix the problems in the end.
Ok.
Will read up the doc.
Op Mon, 4 Jun 2007, schreef Francisco Reyes:
The source?
Exactly.
Daniël
You can't compile on amd64, since you still have to create the compiler (and debug the…
Marco van de Voort wrote- a starting compiler (2.0.4 or 2.1.4)
Got 2.0.4
- a 2.3.x (development) snapshot
Got from ftp.
Then you need to crosscompile (see http://www.stack.nl/~marcov/buildfaq.pdf ) to AMD64, and fix the problems in the end.
Got it.
Trying to figure out the right parameters.
cd ~/fpc
gmake distclean
# next all on one line
gmake all install CPU_TARGET=x86_64 OS_TARGET=freebsd CROSSBINDIR=~/cross/bin BINUTILSPREFIX=x86_64-freebsd-INSTALL_PREFIX=/usr/local
Does the install_prefix at the end installs anything on /usr/local? or is everything installed on ~/cross/bin
Don't want to install a chunk of am64 code on an i386 machine. :-)
First, there should be a space before INSTALL_PREFIX
Does the install_prefix at the end installs anything on /usr/local?
Yes.
or is everything installed on ~/cross/bin
No. It only uses AS en LD from there. Specify a different prefix to INSTALL_PREFIX then.
You can't compile on amd64, since you still have to create the compiler (and debug the…
Marco van de Voort wroteThen you need to crosscompile (see http://www.stack.nl/~marcov/buildfaq.pdf ) to AMD64, and fix the problems in the end.
Done.
It is possible to create a binary for amd64, but that binary doesn't work, and I don't know why. FreeBSD keeps complaining it can't execute it.
Free Pascal Compiler version 2.3.1 [2007/06/05] for x86_64 Copyright (c) 1993-2007 by Florian Klaempfl
Is this it?
I cross compiled using:
cd ~/fpc
gmake distclean
# next all on one line
gmake all install CPU_TARGET=x86_64 OS_TARGET=freebsd CROSSBINDIR=/vol2/fp-amd/fpc/cross/bin BINUTILSPREFIX=x86_64-freebsd -INSTALL_PREFIX=/vol2/fp-amd/amd64
How do I tell it where to look for the rtl units?
Tried compiling a simple progrma like:
compiler/ppcrossx64 -Xr rtl/ programs/crtxy.pp
Thr crtxy.pp is a trivial program that uses the crt unit.
Gave me the error:
Fatal: Can't find unit System used by crtxy
Fatal: Compilation aborted
Also tried putting
{$UNITPATH /data/fpc/rtl}
At the top most line of my program.
When I installed in i386 I used the FreeBSD port so this is my first install from source.. specially cross-compiling..
Just trying to see if my cross compile worked.
Trying on my laptop, which is FreeBSD AMD64.
Compiled on my desktop with FreeBSD i386.
usually fpc.cfg is configured to find the units, but because you installed the compiled units in a different folder, you will need to either change fpc.cfg, or pass the options to ppcrossx64. the relevant lines in fpc.cfg are:
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
you will also want to tell ppcrossx64 what your binutils prefix is by using -XPx86_64-freebsd-. also make sure that the compiler can find your binutils (put it on the path).
henry
Henry Vermaak wrote-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/* -Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl
To which directory do I point it to?
find . -name "crt*"
shows me that the only compiled rtl are in rtl/units/i386-freebsd
Was the cross compile supposed to do the rtl in a different directory?
you will also want to tell ppcrossx64 what your binutils prefix is by using -XPx86_64-freebsd-. also make sure that the compiler can find your binutils (put it on the path).
Ok.
usually fpc.cfg is configured to find the units, but because you installed the compiled…
Henry Vermaak wroteeither change fpc.cfg, or pass the options to ppcrossx64. the relevant lines in fpc.cfg are:
Where do I put that file?
I only see one file in /usr/local/etc that was installed from the port. The other 2 I see are in fpcbuild instead of the fpc directory.
Do I create the file in /usr/local/etc in my amd64 machine?
usually fpc.cfg is configured to find the units, but because you installed the compiled…
Henry Vermaak wroteusually fpc.cfg is configured to find the units, but because you installed the compiled units in a different folder, you will need to either change fpc.cfg
How do I tell the compiler where to look for the fpc.cfg? I copied the fpc.cfg from my i386 machine, made the change and tried. Didn't help. Put it in the same place I have it in the i386 architecture. /usr/local/etc/
On the command line I added -Fu<path> and found the diretory.
Now I have a different problem.
PPU Loading /data/fpc/rtl/units/i386-freebsd/system.ppu PPU is compiled for another processor
How do I compile the units for AMD64?
Do I need to cross compile them or can I compile them with this compiler in the AMD64.
you will also want to tell ppcrossx64 what your binutils prefix is by using -XPx86_64-freebsd-.
Was there a dash at the end there or is that a typo?
also make sure that the compiler can find your binutils (put it on the path).
I don't see a directory by that name. Is the directory called something other than binutils?
Originally I embarked on this cross compile because I was told that the freebsd port did not support AMD64 because of some problems. Is what I have done so far further than previously achieved? Just wondering if this that I am trying is of any person that reported the issue with the amd64 port was Marco van de Voort, in this same thread.
In particular he wrote.
It is possible to create a binary for amd64, but that binary doesn't work, and I don't know why. FreeBSD keeps complaining it can't execute it.
usually fpc.cfg is configured to find the units, but because you installed the compiled…
Henry Vermaak wroteyou will also want to tell ppcrossx64 what your binutils prefix is by using -XPx86_64-freebsd-. also make sure that the compiler can find your binutils (put it on the path).
Based on some searching it seems I need to build the rtl in the AMD64 machine. After some inspection of the Makefile it seemed like I needed to point to variables:
FPC
BINUTILSPREFIX
From what I can tell BINUTILSPREFIX needs to point to among other things
where the assember is so I set those to variables to: setenv FPC "/data/fpc/compiler/ppcrossx64"
setenv BINUTILSPREFIX "/usr/bin/"
Now when I try to run gmake on the rtl directory I get: gmake[1]: Entering directory `/data/fpc/rtl/freebsd' gmake[1]: *** No rule to make target `x86_64/cprt0.as', needed by `cprt0.o'. Stop.
gmake[1]: Leaving directory `/data/fpc/rtl/freebsd' gmake: *** [freebsd_all] Error 2
Don't think I can go any further without help. :-(
Also how do I tell gmake that I am doing freebsd only? gmake -C freebsd all ?
That is what I see after typing "gmake" in the rtl directory.
How do I tell the compiler where to look for the fpc.cfg? I copied the fpc.cfg from my…
I don't think I can help with the rest of your cross-compiling adventure, but maybe I can help with an brief explanation of binutils. The binutils package is the set of GNU "binary utilities". This includes the assembler (as), linker (ld) and other utilities for working with binary program files. In order to make files that will run on 64 bit freebsd, you'll want to find (or build) a binutils package that works with binaries for 64 bit freebsd.
I hope this is helpful.
Best regards,
Pete C.
(actualy more to Francisco:)
Note that all of this is described in the buildfaq already published earlier.
That also contains examples for crosscompiling (hint: look for OS_TARGET CPU_TARGET )
Marco van de Voort wroteNote that all of this is described in the buildfaq already published earlier.
I thought I already had cross compiled.
I posted earlier what I used:
cd fpc
gmake distclean
# next all on one line
gmake all install CPU_TARGET=x86_64 OS_TARGET=freebsd CROSSBINDIR=/vol2/fp-amd/fpc/cross/bin BINUTILSPREFIX=x86_64-freebsd -INSTAL L_PREFIX=/vol2/fp-amd/amd64
The /vol2/fp-amd/amd64 is empty. Should it have something?
I think one of my problems may be the CROSSBINDIR. Reading the buildfaq I am not sure what that is supposed to point it to.
The buildfaq reads:
1. Cross binutils have been compiled, and are installed with $PREFIX=~/cross. The correct prefix has been identified (probably something like i686-ming32- and x86-64-linux- in our example)
In my case what does the cross binutils constitute? Copying some files from the FreeBSD amd64 machine? When I do man "as" it says it can do 64bit code, but when I try to compile one of the ".as" files with --64 it complaints that it could not do it.
Also when I do "file ppcrossx64" it reports it is 32bits. Therefore I don't think my cross compile produced amd64 code. The fact i386 units were created also points to that.
Francisco Reyes wroteAlso when I do "file ppcrossx64" it reports it is 32bits.
At least this is normal, since you are working on a 32 bit machine: this is a cross compiler from 32 bits to 64 bits (i.e., the compiler itself is a 32 bit program, but generates 64 bit code).
Jonas
I thought I already had cross compiled. I posted earlier what I used: cd fpc gmake…
this doesn't look right you've got BINUTILSPREFIX=x86_64-freebsd -INSTALL_PREFIX=... where you should have
BINUTILSPREFIX=x86_64-freebsd- INSTALL_PREFIX=... (note the space after freebsd)
did you copy in paste or is this a typo?
The /vol2/fp-amd/amd64 is empty. Should it have something?
it should contain a directory structure with the compiled units of the rtl, etc.
I think one of my problems may be the CROSSBINDIR. Reading the buildfaq I am not sure what that is supposed to point it to.
this is the folder with the files x86_64-freebsd-* in it (e.g. as, ld)
henry
It was a typo.
Corrected. Thanks.
> I think one of my problems may be the CROSSBINDIR. Reading the buildfaq I > am not sure what that is supposed to point it to. this is the folder with the files x86_64-freebsd-* in it (e.g. as, ld)
So I copy /usr/bin/as to /vol2/fp-amd/fpc/crossbin and name it x86_64-freebsd-as?
Did that.
Tried again. Got a number of errors from the assembler. Errors like: /vol2/fp-amd/fpc/crossbin/x86_64-freebsd-as -o
/vol2/fp-amd/fpc/rtl/units/x86_64-freebsd/prt0.o x86_64/prt0.as x86_64/prt0.as: Assembler messages:
x86_64/prt0.as:31: Error: suffix or operands invalid for `push' x86_64/prt0.as:33: Error: suffix or operands invalid for `movq' x86_64/prt0.as:37: Error: `-8(%rbp)' is not a valid 32 bit base/index expression
x86_64/prt0.as:38: Error: `-16(%rbp)' is not a valid 32 bit base/index expression
Can you manually assemble prt0.as?
Maybe the assembler needs --64 to be in 64 bits mode. In that case you may need to write some wrapper scripts to add that parameter.
Vincent
It was a typo. Corrected. Thanks. So I copy /usr/bin/as to /vol2/fp-amd/fpc/crossbin and…
no, this is wrong. there is a reason that they have the prefix. you need to get the cross binutils that cross assembles and cross links from your platform to x86_64 freebsd. you might be able to download them from somewhere or build them with a suitable tool./script like dan kegel's crosstool. just search.
i urge you to read marco's excellent document on this. it will save you a lot of time.
good luck
henry
Henry Vermaak wroteno, this is wrong. there is a reason that they have the prefix. you need to get the cross binutils that cross assembles and cross links from your platform to x86_64 freebsd.
Ok.
you might be able to download them from somewhere or build them with a suitable tool./script like dan kegel's crosstool. just search.
OK. Will do.
i urge you to read marco's excellent document on this. it will save you a lot of time.
I have read it a few times, but it is likely that something that is obvious to more experienced users is not clear to someone new like myself.
Francisco Reyes wroteI have read it a few times, but it is likely that something that is obvious to more experienced users is not clear to someone new like myself.
o.k., no problems, we all gotta learn ;) on which platform are you compiling on at the moment? (sorry, i've lost the story line a bit)
henry
Can you manually assemble prt0.as? Maybe the assembler needs --64 to be in 64 bits mode.…
Even though my very first attempt did not produce compiled rtl units for x86. It seems I did get a compiler.
I am trying to use that compiler to then do an install in the amd64 machine. It crashes trying to run:
as -o /data/fpc/rtl/units/i386-freebsd/prt0.o i386/prt0.as
However if I add --64 to the same line.. (manually.. and including the missing path) it works.
Will try two things now..
1- See if I can find the crosscompile tools needed 2- See if somehow I can pass the right parameter to the 'as' on the amd64 and see if I am able to finish the build on that environment.
o.k., no problems, we all gotta learn ;) on which platform are you compiling on at the…
Henry Vermaak wroteo.k., no problems, we all gotta learn ;) on which platform are you compiling on at the moment? (sorry, i've lost the story line a bit)
Compiling on FreeBSD 6.2 i386
I started this whole project because the FreeBSD port doesn't compile in amd64.
I have a laptop which is AMD64 and since I spend a good hour plus on the train every day.. I want to get free pascal there so I can code during my commute.
Right now my next step is to search for the cross binutils. Already posted on a freebsd list and also searching on google to see if there is a way I can build them myself.
You can't compile on amd64, since you still have to create the compiler (and debug the…
Marco van de Voort wroteIt is possible to create a binary for amd64, but that binary doesn't work, and I don't know why. FreeBSD keeps complaining it can't execute it.
Marco, since you were able to do this cross compile once, doesn't that mean you have the cross-binutils for 6.2? Any chance you could put them somewhere for me?
Where did you get them or how did you compile them?
Thanks.
Compiled them from Gnu.org sources ? Only trick is to add --disable-nls and set the target to configure.
IIRC there is a script to mass-build crossbinutils on *nix in the fpcbuild repository. (install/scripts or so)