Sign in Join

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

Mailing lists / fpc-pascal / 2012-10

fpmake compiles the same unit multiple times

5 messages · 3 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'm using FPC 2.6.0 and have a fpmake.pas program for fpGUI. To be honest I don't really use it, but to keep it up to date. Anyway, I noticed that if I do a 'fpmake build', that fpmake compiles many of my units multiple times. Anywhere from 2-4 times. I double checked my fpmake.pas unit, and I haven't added those units multiple times in the code, so why is fpmake building them more than once?

The fpmake.pas unit in question can be viewed at the following URL with your web browser:

https://github.com/graemeg/fpGUI/blob/master/src/fpmake.pas

Belowo you can see the fpmake output. The first part is going well... units are only compiled once. But then later most units are compiled 2-4 times??

--------------------------------------------
[src (wip)]$ ./fpmake build -UG
/home/graemeg/devel/fpc-2.6.0/x86_64-linux/lib/fpc/2.6.0/units/x86_64-linux/ Start building package fpgui for target x86_64-linux. Compiling corelib/fpg_base.pas
Compiling ./corelib/x11/fpg_impl.pas
Compiling corelib/fpg_main.pas
Compiling ./corelib/x11/fpg_interface.pas
Compiling ./corelib/x11/fpg_x11.pas
Compiling ./corelib/x11/fpg_xft_x11.pas
Compiling ./corelib/x11/fpg_netlayer_x11.pas
Compiling corelib/fpg_main.pas
Compiling ./corelib/x11/fpg_interface.pas
Compiling corelib/fpg_imgfmt_bmp.pas
Compiling corelib/fpg_utils.pas
...snip...
Compiling gui/fpg_spinedit.pas
Compiling gui/fpg_spinedit.pas
Compiling gui/fpg_colorwheel.pas
Compiling gui/fpg_colorwheel.pas
Compiling gui/fpg_colormapping.pas
Compiling gui/fpg_colormapping.pas
Compiling gui/fpg_editbtn.pas
Compiling reportengine/u_command.pas
Compiling reportengine/u_pdf.pas
Compiling reportengine/u_report.pas
Compiling reportengine/u_command.pas
Compiling reportengine/u_visu.pas
Compiling reportengine/u_reportimages.pas
Compiling reportengine/u_reportimages.pas
Compiling reportengine/u_pdf.pas
Compiling reportengine/u_report.pas
Compiling reportengine/u_report.pas
Compiling reportengine/u_visu.pas
Compiling reportengine/u_visu.pas
[100%] Built target fpgui
--------------------------------------------

Regards,
- Graeme -

Jonas Maebe
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
I'm using FPC 2.6.0 and have a fpmake.pas program for fpGUI. To be honest I don't really use it, but to keep it up to date. Anyway, I noticed that if I do a 'fpmake build', that fpmake compiles many of my units multiple times. Anywhere from 2-4 times. I double checked my fpmake.pas unit, and I haven't added those units multiple times in the code, so why is fpmake building them more than once?

fpmake does not know about unit dependencies, so it compiles all units once. The compiler may however already compile a unit earlier on because it's required by another unit. At least the trunk version of fpmake supports automatically generating a "build unit" that simply adds all the to be compiled units to the uses clause. It then compiles only this build unit, so that every unit will be compiled only once.

Jonas

Graeme Geldenhuys
to Jonas Maebe
Jonas Maebe wrote
fpmake does not know about unit dependencies,....

Ah OK. Thanks for the explanation. So if I ordered my units better in the fpmake program, then that might reduce the multiple compiling too.

Graeme.

Unknown author
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
On 2012-10-17 11:17, Jonas Maebe wrote: > > fpmake does not know about unit dependencies,.... Ah OK. Thanks for the explanation. So if I ordered my units better in the fpmake program, then that might reduce the multiple compiling too.

If you specify the dependencies right, it should figure out the order by itself.

Michael.

Graeme Geldenhuys
to Unknown author
If you specify the dependencies right, it should figure out the order by itself.

I tried but it seems impossible, especially with uses clause pulling in other dependencies.

I then tried fpmake from FPC 2.7.1... WOW, that made a huge difference in compiling speed, and all units were compiled only once.

So it seems that to improve fpmake with FPC 2.6.0 is a lost cause, as 2.7.1 works so much better without any extra effort.

Anyway, it wasn't a major issue to start with, I was just curious as to why there was so many duplicate compilations.

Graeme.