How do you build FPC?

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

How do you build FPC?

Jon Foster
I'm using i386 32bit Linux for most of my development and currently
using FPC 2.6.0. I'm trying to understand how to build FPC for various
scenarios: Cross-compiling FPC for another architecture. Building FPC
crosscompilers and related units so I can compile for them from my Linux
machine. And building new FPC versions.

There seems to be a massive lack of documentation about the FPC build
process and many things I try get me know where. I'll do something like
"make deb" and I get "/bin/cp: cannot stat `logs': No such file or
directory ..." Or I do "make build OS_TARGET=win32 SMARTLINK=YES
DEFAULTUNITS=YES NOGDB=1" and it builds a i386-linux RTL with i386-win32
packages!?!?

I've tried building on I386 Linux, PPC Linux, PPC OSX, just to name the
ones that I remember. I've tried simple builds of newer FPCs, cross
compiling FPC, building crosscompilers and units. Building Debian packages.

Not once have I ever been able to get it to do what I want. There is
obviously a lot of pieces I'm missing from what I've dug up on the wiki,
docs and included text files.

Is there documentation for compiling FPC? Am I just missing it
somewhere? FPC seems incredibly flexible and I'd like to take advantage
of it on some other platforms but so far it looks like that is reserved
for a wizard elite somewhere and nobody is saying how to get there.

TIA - Jon

--
Sent from my Debian Linux workstation -- http://www.debian.org/intro/about

Jon Foster
JF Possibilities, Inc.
[hidden email]
541-410-2760
Making computers work for you!

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

Mark Morgan Lloyd-5
Jon Foster wrote:

> I'm using i386 32bit Linux for most of my development and currently
> using FPC 2.6.0. I'm trying to understand how to build FPC for various
> scenarios: Cross-compiling FPC for another architecture. Building FPC
> crosscompilers and related units so I can compile for them from my Linux
> machine. And building new FPC versions.
>
> There seems to be a massive lack of documentation about the FPC build
> process and many things I try get me know where. I'll do something like
> "make deb" and I get "/bin/cp: cannot stat `logs': No such file or
> directory ..." Or I do "make build OS_TARGET=win32 SMARTLINK=YES
> DEFAULTUNITS=YES NOGDB=1" and it builds a i386-linux RTL with i386-win32
> packages!?!?
>
> I've tried building on I386 Linux, PPC Linux, PPC OSX, just to name the
> ones that I remember. I've tried simple builds of newer FPCs, cross
> compiling FPC, building crosscompilers and units. Building Debian packages.
>
> Not once have I ever been able to get it to do what I want. There is
> obviously a lot of pieces I'm missing from what I've dug up on the wiki,
> docs and included text files.
>
> Is there documentation for compiling FPC? Am I just missing it
> somewhere? FPC seems incredibly flexible and I'd like to take advantage
> of it on some other platforms but so far it looks like that is reserved
> for a wizard elite somewhere and nobody is saying how to get there.

The document that is usually cited is
http://www.stack.nl/~marcov/buildfaq.pdf which I think is still
generally valid. I don't know whether this is the only URL, or if it's
also hosted on the FreePascal site.

In all cases the correct compiler to start with is the current one (i.e.
at the time of writing v2.6.4), the makefiles generally check and
enforce this and it is unwise to override it.

Apart from that, and with the caveat that I am not a core developer and
this is probably not an orthodox opinion or advice, for building
natively on Linux (also Solaris, OS X etc.) I simply use something like

make NOGDB=1 OPT='-O- -gl -Xs-' all

That's a very conservative build, with minimal optimisation etc. so that
if something goes wrong a backtrace can be had without having to
rebuild. Alternatively see http://wiki.freepascal.org/fpcup

To get the idea of how bootstrapping and cross compilers hang together,
you might find http://wiki.freepascal.org/Native_MIPS_Systems useful. I
tweaked that a few days ago since I think a couple of steps were in the
wrong order.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

Marco van de Voort
In reply to this post by Jon Foster
In our previous episode, Jon Foster said:
> Is there documentation for compiling FPC? Am I just missing it
> somewhere? FPC seems incredibly flexible and I'd like to take advantage
> of it on some other platforms but so far it looks like that is reserved
> for a wizard elite somewhere and nobody is saying how to get there.

Did you read the buildfaq mentioned on the more information page of FPC?

http://www.freepascal.org/moreinfo.var

It is somewhat outdated, but describes general principles and dependencies
very well.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

Mark Morgan Lloyd-5
Marco van de Voort wrote:

> In our previous episode, Jon Foster said:
>> Is there documentation for compiling FPC? Am I just missing it
>> somewhere? FPC seems incredibly flexible and I'd like to take advantage
>> of it on some other platforms but so far it looks like that is reserved
>> for a wizard elite somewhere and nobody is saying how to get there.
>
> Did you read the buildfaq mentioned on the more information page of FPC?
>
> http://www.freepascal.org/moreinfo.var
>
> It is somewhat outdated, but describes general principles and dependencies
> very well.

If you update that, check the embedded URL: it's lost the ~ (tilde) so 404s.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

leledumbo
Administrator
In reply to this post by Jon Foster
> FPC seems incredibly flexible and I'd like to take advantage
of it on some other platforms but so far it looks like that is reserved
for a wizard elite somewhere and nobody is saying how to get there.

Other than the buildfaq, reading the Makefile.fpc might help (assuming you already know make) since all Makefiles are generated by fpcmake. The process is currently run hybrid with fpmake in many places (but as far as I can see, not all make has been replaced). Reading and understanding fpmake might help you, too.

I myself customize my FPC directory layout, such that I can easily update my FPC from svn and cross build to 8 different targets (excluding host) with a single script execution, using only single fpc.cfg for all of them.

The build process is no magic and easily understandable. Section 7 of the cross compiling wiki explains the prerequisites well, and in general, make all CPU_TARGET=<target cpu> OS_TARGET=<target os> suffices (optionally install if you want), except perhaps for arm targets where there are multiple implementations of FPU mode which you have to choose at make time.
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

Jon Foster
In reply to this post by Mark Morgan Lloyd-5
Mark Morgan Lloyd wrote:

> Jon Foster wrote:
>> [...]
>> There seems to be a massive lack of documentation about the FPC build
>> process and many things I try get me know where. I'll do something like
>> "make deb" and I get "/bin/cp: cannot stat `logs': No such file or
>> directory ..." Or I do "make build OS_TARGET=win32 SMARTLINK=YES
>> DEFAULTUNITS=YES NOGDB=1" and it builds a i386-linux RTL with i386-win32
>> packages!?!?
>> [...]
>
> The document that is usually cited is
> http://www.stack.nl/~marcov/buildfaq.pdf which I think is still
> generally valid. I don't know whether this is the only URL, or if it's
> also hosted on the FreePascal site.
>
> [...]
Thanks for that link! I have something to read tonight. :-)

--
Sent from my Debian Linux workstation -- http://www.debian.org/intro/about

Jon Foster
JF Possibilities, Inc.
[hidden email]
541-410-2760
Making computers work for you!

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

vfclists .
In reply to this post by leledumbo


On 20 February 2015 at 15:40, leledumbo <[hidden email]> wrote:
> FPC seems incredibly flexible and I'd like to take advantage
of it on some other platforms but so far it looks like that is reserved
for a wizard elite somewhere and nobody is saying how to get there.

Other than the buildfaq, reading the Makefile.fpc might help (assuming you
already know make) since all Makefiles are generated by fpcmake. The process
is currently run hybrid with fpmake in many places (but as far as I can see,
not all make has been replaced). Reading and understanding fpmake might help
you, too.

I myself customize my FPC directory layout, such that I can easily update my
FPC from svn and cross build to 8 different targets (excluding host) with a
single script execution, using only single fpc.cfg for all of them.

The build process is no magic and easily understandable. Section 7 of the
cross compiling wiki explains the prerequisites well, and in general, make
all CPU_TARGET=<target cpu> OS_TARGET=<target os> suffices (optionally
install if you want), except perhaps for arm targets where there are
multiple implementations of FPU mode which you have to choose at make time.



--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/How-do-you-build-FPC-tp5721047p5721051.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Do you have some FPC/Lazarus compilation scripts or sample fpc.cfg files you can share?

--
Frank Church

=======================
http://devblog.brahmancreations.com

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

Anthony Walter-3
Although it's not for the faint of heart, but you can follow this guide if you are determined to build it yourself:


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

vfclists .


On 13 March 2015 at 15:09, Anthony Walter <[hidden email]> wrote:
Although it's not for the faint of heart, but you can follow this guide if you are determined to build it yourself:



I have already checked that page. I want to see Leledumbo's scripts as well as he is crosscompiling for 8 different targets.

--
Frank Church

=======================
http://devblog.brahmancreations.com

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

leledumbo
Administrator
In reply to this post by vfclists .
> Do you have some FPC/Lazarus compilation scripts or sample fpc.cfg files you can share?

The build script:
build-fpc-cross-all.sh
My fpc.cfg:
fpc.cfg

Now read carefully. The final directory layout is now:
$outdir
+ <fpc built binaries except the actual compiler>
+ $stableversion
++ <standard $fpcdir/lib/fpc/$stableversion layout>
+ $svnversion
++ <standard $fpcdir/lib/fpc/$svnversion layout>
+ $srcdir
+ lexyacc
+ tmp

* The script assumes you have proper assembler/linker accessible in PATH and use above fpc.cfg
* Adjust fpc.cfg above to your environment
* Please start with latest release, since the script doesn't pass OVERRIDEVERSIONCHECK=1 to make. If you insist, however, just add that flag to make
* The script passes GDBMI=1 when building host, so you can still have debugger enabled for fpIDE without libgdb.a exists
* tmp will be temporary destination folder, before the contents are mv-ed and rsynced with $outdir
* In case of failure, there will be build-fpc-cross-all.log in the current directory from which you can search for triple asterisks (***) to find what went wrong
* $stableversion doesn't have to be there, I just do it for single fpc.cfg requirement
* $srcdir too, but I never move it out of $outdir, though
Reply | Threaded
Open this post in threaded view
|

Re: How do you build FPC?

vfclists .


On 14 March 2015 at 09:27, leledumbo <[hidden email]> wrote:
> Do you have some FPC/Lazarus compilation scripts or sample fpc.cfg files
you can share?

The build script:
build-fpc-cross-all.sh
<http://free-pascal-general.1045716.n5.nabble.com/file/n5721321/build-fpc-cross-all.sh>
My fpc.cfg:
fpc.cfg
<http://free-pascal-general.1045716.n5.nabble.com/file/n5721321/fpc.cfg>

Now read carefully. The final directory layout is now:
$outdir
+ <fpc built binaries except the actual compiler>
+ $stableversion
++ <standard $fpcdir/lib/fpc/$stableversion layout>
+ $svnversion
++ <standard $fpcdir/lib/fpc/$svnversion layout>
+ $srcdir
+ lexyacc
+ tmp

* The script assumes you have proper assembler/linker accessible in PATH and
use above fpc.cfg
* Adjust fpc.cfg above to your environment
* Please start with latest release, since the script doesn't pass
OVERRIDEVERSIONCHECK=1 to make. If you insist, however, just add that flag
to make
* The script passes GDBMI=1 when building host, so you can still have
debugger enabled for fpIDE without libgdb.a exists
* tmp will be temporary destination folder, before the contents are mv-ed
and rsynced with $outdir
* In case of failure, there will be build-fpc-cross-all.log in the current
directory from which you can search for triple asterisks (***) to find what
went wrong
* $stableversion doesn't have to be there, I just do it for single fpc.cfg
requirement
* $srcdir too, but I never move it out of $outdir, though




--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/How-do-you-build-FPC-tp5721047p5721321.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Thanks.

The building process needs as much help as it can get.

--
Frank Church

=======================
http://devblog.brahmancreations.com

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

FPC 3.0 deb packages?

Jon Foster
In reply to this post by Jon Foster
I'm trying to get FPC to build again and although I'm getting along a
lot better I still don't seem to be able to get the knack of it. First
I'd like to know if anyone has any updated build instructions? I've been
on the wiki and read the "build faq" PDF document. Both are good as far
as they go. But neither is anywhere near complete.

My first major dilemma, and what this email pertains to, is building
Debian packages. I went to grab the latest FPC 3 from SF and found that
the usual tarball of Debian packages doesn't exist. So I downloaded the
"fpcbuild" tarball for FPC 3.0.0 and tried the "make deb".

After I banged on it for many hours applying several crude patches it
finally makes packages again. But all of this leads me to believe that
Debian packages for FPC are no longer maintained / supported? If so
what's the story? Maybe my crude hacks could be put to use or I could
help out some way?

After installing the packages and doing some simple builds I thought all
was good... Nope! Turns out several of the compiled units, from the
packages folder aren't getting packaged. I fixed a few of the
*.install.in files to include the missing package unit folders. However,
at least in some situations, it looks like some of the additional unit
files are getting missed by the deb packaging.

My current need is the StrUtils unit, which I must say I'm shocked to
find is not part of the core RTL but is in a package?!?! I don't get
that but that's your decision. Through injecting breakpoints in the
package build process I have found that the unit files are getting built
and installed into the temporary distribution folders. But somehow they
aren't making it into the final packages.

I'm still working on it but I thought I'd ask and see if anyone knows
where in the Debian package building stuff things are getting lost?

I do want to commend the FPC developers. There are only two pieces of
software that continue to impress me release after release: the Linux
kernel and FreePascal compiler (not Lazarus).

My system stats: Debian 7 i386. FPC 3.0.0 as the currently installed
compiler, first from the binary tarball package and then from my package
build attempts, which are mostly functional.

TIA - Jon

--
Sent from my Debian Linux workstation -- http://www.debian.org/intro/about

Jon Foster
JF Possibilities, Inc.
[hidden email]
541-410-2760
Making computers work for you!

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC 3.0 deb packages?

Karoly Balogh (Charlie/SGR)
Hi,

On Mon, 5 Sep 2016, Jon Foster wrote:

> After I banged on it for many hours applying several crude patches it
> finally makes packages again. But all of this leads me to believe that
> Debian packages for FPC are no longer maintained / supported? If so
> what's the story? Maybe my crude hacks could be put to use or I could
> help out some way?

Well, I guess the main issue is, Debian splits the FPC "packages" into
separate packages. :) Because it not only installs the package, but all of
its dependencies (for example C static link libs), therefore a global FPC
"packages" package with all its dependencies would be *HUGE*. But maybe
for 3.0 that decision should have been modified, and Debian should have
bundled a 'set of packages' as a .deb package, instead of each package as
a separate .deb alone... I mean the various FCL or the various RTL
packages are certainly just one "package" from the user PoV...

And yes, I'm not sure if the .deb packaging is still maintained in FPC's
own build system. Maybe the people doing the actual packaging for Debian
could help you there?

 > My current need is the StrUtils unit, which I must say I'm shocked to
> find is not part of the core RTL but is in a package?!?! I don't get
> that but that's your decision.

Again, that's because FPC doesn't think about "packages" the way Debian
and Linux distributions in general think. Remember, we deploy the same
structure on all of our supported platforms. We even provide Linux binary
builds, where "packages" is just one archive, with a specific directory
structure and that's it.

So we moved out large chunks from the RTL (including strutils) to separate
packages, because it reduces compiler build times and therefore speeds up
development. Also, it's makes easier the maintenance of some RTL features,
which are in fact separate from the rest of the RTL really. I guess the
Debian packaging situation was simply not considered while making that
decision, given most FPC developers themselves don't use distribution
provided packages.

Anyway, packages not finding a given unit in another package could be
probably fixed by adding additional dependencies to that other package.

That said, if anyone feels like helping out with the current packaging
situation on whatever platform, he's certainly very welcomed to do so. :)

Cheers,
--
Charlie
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC 3.0 deb packages?

Tomas Hajny-2
On Tue, September 6, 2016 10:36, Karoly Balogh (Charlie/SGR) wrote:
> On Mon, 5 Sep 2016, Jon Foster wrote:


Hello everybody,

Please note that the original poster (Jon Foster) is apparently not
subscribed to the mailing list (although he has not mentioned this in his
post). I suggest that you include him in Cc: of your replies - forwarding
the response of Charlie to his e-mail below to make sure it gets to him...

Regards

Tomas
(one of fpc-pascal mailing list moderators)


> Hi,
>
>> After I banged on it for many hours applying several crude patches it
>> finally makes packages again. But all of this leads me to believe that
>> Debian packages for FPC are no longer maintained / supported? If so
>> what's the story? Maybe my crude hacks could be put to use or I could
>> help out some way?
>
> Well, I guess the main issue is, Debian splits the FPC "packages" into
> separate packages. :) Because it not only installs the package, but all of
> its dependencies (for example C static link libs), therefore a global FPC
> "packages" package with all its dependencies would be *HUGE*. But maybe
> for 3.0 that decision should have been modified, and Debian should have
> bundled a 'set of packages' as a .deb package, instead of each package as
> a separate .deb alone... I mean the various FCL or the various RTL
> packages are certainly just one "package" from the user PoV...
>
> And yes, I'm not sure if the .deb packaging is still maintained in FPC's
> own build system. Maybe the people doing the actual packaging for Debian
> could help you there?
>
>  > My current need is the StrUtils unit, which I must say I'm shocked to
>> find is not part of the core RTL but is in a package?!?! I don't get
>> that but that's your decision.
>
> Again, that's because FPC doesn't think about "packages" the way Debian
> and Linux distributions in general think. Remember, we deploy the same
> structure on all of our supported platforms. We even provide Linux binary
> builds, where "packages" is just one archive, with a specific directory
> structure and that's it.
>
> So we moved out large chunks from the RTL (including strutils) to separate
> packages, because it reduces compiler build times and therefore speeds up
> development. Also, it's makes easier the maintenance of some RTL features,
> which are in fact separate from the rest of the RTL really. I guess the
> Debian packaging situation was simply not considered while making that
> decision, given most FPC developers themselves don't use distribution
> provided packages.
>
> Anyway, packages not finding a given unit in another package could be
> probably fixed by adding additional dependencies to that other package.
>
> That said, if anyone feels like helping out with the current packaging
> situation on whatever platform, he's certainly very welcomed to do so. :)
>
> Cheers,
> --
> Charlie


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPC 3.0 deb packages?

Tomas Hajny-2
In reply to this post by Karoly Balogh (Charlie/SGR)
On Tue, September 6, 2016 10:36, Karoly Balogh (Charlie/SGR) wrote:
> On Mon, 5 Sep 2016, Jon Foster wrote:


Hi,

(now putting my "mailing list member" hat on ;-) )

>> After I banged on it for many hours applying several crude patches it
>> finally makes packages again. But all of this leads me to believe that
>> Debian packages for FPC are no longer maintained / supported? If so
>> what's the story? Maybe my crude hacks could be put to use or I could
>> help out some way?

The Debian rules are primarily maintained by a Debian package maintainer,
not directly inside the SVN repository of FPC (although we're more than
happy to merge them to mainstream if they are supplied to us) and not
necessarily up to the latest changes of FPC. See
https://packages.debian.org/source/sid/fpc for information about the
current status there.


> Well, I guess the main issue is, Debian splits the FPC "packages" into
> separate packages. :) Because it not only installs the package, but all of
> its dependencies (for example C static link libs), therefore a global FPC
> "packages" package with all its dependencies would be *HUGE*. But maybe
> for 3.0 that decision should have been modified, and Debian should have
> bundled a 'set of packages' as a .deb package, instead of each package as
> a separate .deb alone... I mean the various FCL or the various RTL
> packages are certainly just one "package" from the user PoV...
 .
 .

See the link above (or install/debian/*.in in fpcbuild) - such a grouping
is indeed performed in Debian.

I leave the other parts of the original message to others knowing more
about the current status than me.

Tomas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal