Sign in Join

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

Mailing lists / fpc-pascal / 2014-04

How do fpmake dependencies work??

7 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Darius Blaszyk

Hi all,
I'm trying to use fpmake for my own project which is built up of a couple of packages. The final application has a dependency on these packages.

Which I have done like this:

P := AddPackage('my_app');
P.Directory := 'app';
T := P.Targets.AddProgram('hello.pp');
T.Dependencies.Add('my_pkg');

However, adding the dendencies does not add the units output dir to the target. I think it would be a good idea to do this by default. Do you agree?

Please find the output of my test case (which is also attached) below.

Regards, Darius

C:developrepositorytest>fpmake -v

Start compiling package my_pkg for target x86_64-win64.

Creating output dir "pkgunitsx86_64-win64"

Compiling target testunit

Executing command "fpc -Twin64 -Px86_64 -FUpkgunitsx86_64-win64 -FuC:lazarusfpc2.6.2unitsx86_64-win64rtl pkgtestunit.pas"

Free Pascal Compiler version 2.6.2 [2014/02/28] for x86_64

Copyright (c) 1993-2012 by Florian Klaempfl and others

Target OS: Win64 for x64

Compiling pkgtestunit.pas

14 lines compiled, 0.0 sec

Generating "pkgunitsx86_64-win64fpunits.cfg"

[ 67%] Compiled package my_pkg

Warning: Circular dependency detected when compiling package my_app with package my_app

Start compiling package my_app for target x86_64-win64.

Creating output dir "appunitsx86_64-win64"

Creating output dir "appbinx86_64-win64"

Warning: Target hello of package my_app depends on another package (my_pkg). These kind of dependencies are not processed

Compiling target hello

Executing command "fpc -Twin64 -Px86_64 -FEappbinx86_64-win64 -FUappunitsx86_64-win64 -FuC:lazarusfpc2.6.2unitsx86_64-win64rtl -Fuapp apphello.pp"

Free Pascal Compiler version 2.6.2 [2014/02/28] for x86_64

Copyright (c) 1993-2012 by Florian Klaempfl and others

Target OS: Win64 for x64

Compiling apphello.pp

hello.pp(6,3) Fatal: Can't find unit testunit used by hello

Fatal: Compilation aborted

Error: C:lazarusfpc2.6.2binx86_64-win64ppcx64.exe returned an error exitcode (normal if you did not specify a source file to be compiled)

The installer encountered the following error:

External command "fpc -Twin64 -Px86_64 -FEappbinx86_64-win64 -FUappunitsx86_64-win64 -FuC:lazarusfpc2.6.2unitsx86_64-win64rtl -Fuapp apphello.pp" failed with exit code 1. Console output:

Free Pascal Compiler version 2.6.2 [2014/02/28] for x86_64

Copyright (c) 1993-2012 by Florian Klaempfl and others

Target OS: Win64 for x64

Compiling apphello.pp

hello.pp(6,3) Fatal: Can't find unit testunit used by hello

Fatal: Compilation aborted

Error: C:lazarusfpc2.6.2binx86_64-win64ppcx64.exe returned an error exitcode (normal if you did not specify a source file to be compiled)

Reply by email

Darius Blaszyk
to Darius Blaszyk

I've implemented the basic workings of package dependency in fpmkunit. Please find attached a patch against tagged FPC2.6.2.

Could someone (like Michael f.i.) please review the patch and let me know (either on the list or by pm) what you think? The patch does not include code that recusively searches the packages, although I'm not sure this is what you would like as circular dependencies will get more difficult to find. Either way the patch will be expanded to include this kind of a check once the basic working version is approved. You can test with the test app that I attached earlier.

BTW: Lots of OSS nowadays use online review tools in combination with their bugtrackers. Would such a tool help the core developers in their work to review and resolve patches? One interesting tool is http://phabricator.org/ [2]

Regards, Darius

Darius Blaszyk schreef op 6 apr '14:

Show quoted text 92 lines
Hi all, I'm trying to use fpmake for my own project which is built up of a couple of packages. The final application has a dependency on these packages. Which I have done like this: P := AddPackage('my_app'); P.Directory := 'app'; T := P.Targets.AddProgram('hello.pp'); T.Dependencies.Add('my_pkg'); However, adding the dendencies does not add the units output dir to the target. I think it would be a good idea to do this by default. Do you agree? Please find the output of my test case (which is also attached) below. Regards, Darius C:developrepositorytest>fpmake -v Start compiling package my_pkg for target x86_64-win64. Creating output dir "pkgunitsx86_64-win64" Compiling target testunit Executing command "fpc -Twin64 -Px86_64 -FUpkgunitsx86_64-win64 -FuC:lazarusfpc2.6.2unitsx86_64-win64rtl pkgtestunit.pas" Free Pascal Compiler version 2.6.2 [2014/02/28] for x86_64 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Win64 for x64 Compiling pkgtestunit.pas 14 lines compiled, 0.0 sec Generating "pkgunitsx86_64-win64fpunits.cfg" [ 67%] Compiled package my_pkg Warning: Circular dependency detected when compiling package my_app with package my_app Start compiling package my_app for target x86_64-win64. Creating output dir "appunitsx86_64-win64" Creating output dir "appbinx86_64-win64" Warning: Target hello of package my_app depends on another package (my_pkg). These kind of dependencies are not processed Compiling target hello Executing command "fpc -Twin64 -Px86_64 -FEappbinx86_64-win64 -FUappunitsx86_64-win64 -FuC:lazarusfpc2.6.2unitsx86_64-win64rtl -Fuapp apphello.pp" Free Pascal Compiler version 2.6.2 [2014/02/28] for x86_64 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Win64 for x64 Compiling apphello.pp hello.pp(6,3) Fatal: Can't find unit testunit used by hello Fatal: Compilation aborted Error: C:lazarusfpc2.6.2binx86_64-win64ppcx64.exe returned an error exitcode (normal if you did not specify a source file to be compiled) The installer encountered the following error: External command "fpc -Twin64 -Px86_64 -FEappbinx86_64-win64 -FUappunitsx86_64-win64 -FuC:lazarusfpc2.6.2unitsx86_64-win64rtl -Fuapp apphello.pp" failed with exit code 1. Console output: Free Pascal Compiler version 2.6.2 [2014/02/28] for x86_64 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Win64 for x64 Compiling apphello.pp hello.pp(6,3) Fatal: Can't find unit testunit used by hello Fatal: Compilation aborted Error: C:lazarusfpc2.6.2binx86_64-win64ppcx64.exe returned an error exitcode (normal if you did not specify a source file to be compiled) _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [1]

Links:
------
[1] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [2] http://phabricator.org/

Reply by email

Michael Van Canneyt
to Darius Blaszyk
Darius Blaszyk wrote
I've implemented the basic workings of package dependency in fpmkunit. Please find attached a patch against tagged FPC2.6.2.

This does not belong in fpmkunit, it belongs in fppkg. So I won't apply this patch.

I understand you didn't get fppkg to work, but at the time of your post, I didn't have time to help you fix that. So let's try and fix that instead of going down the wrong road.

Michael.

Reply by email

Darius Blaszyk
to Michael Van Canneyt

It's very difficult to get things right when entering undocumented territories, but I'm willing to learn and create some documentation for the future. However if you could talk me through the process I would be gratefull.

Please see my last post on using fppkg which crashes on me.

http://free-pascal-general.1045716.n5.nabble.com/fpmake-dependecies-td5718762.html [2]

Regards, Darius

Michael Van Canneyt schreef op 6 apr '14:

Show quoted text 14 lines
On Sun, 6 Apr 2014, Darius Blaszyk wrote: > I've implemented the basic workings of package dependency in fpmkunit. Please find attached a patch against tagged FPC2.6.2. This does not belong in fpmkunit, it belongs in fppkg. So I won't apply this patch. I understand you didn't get fppkg to work, but at the time of your post, I didn't have time to help you fix that. So let's try and fix that instead of going down the wrong road. Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [1]

Links:
------
[1] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [2]
http://free-pascal-general.1045716.n5.nabble.com/fpmake-dependecies-td5718762.html

Reply by email

Darius Blaszyk
to Darius Blaszyk

The path for the FPC executable seems to be wrong. I'm on a 64bit machine. I will have a look to see where fppkg is getting the path from.

Could you talk me trough the procedure of fppkg Michael in general as well?

Regards, Darius

Darius Blaszyk schreef op 6 apr '14:

Show quoted text 23 lines
It's very difficult to get things right when entering undocumented territories, but I'm willing to learn and create some documentation for the future. However if you could talk me through the process I would be gratefull. Please see my last post on using fppkg which crashes on me. http://free-pascal-general.1045716.n5.nabble.com/fpmake-dependecies-td5718762.html [2] Regards, Darius Michael Van Canneyt schreef op 6 apr '14: On Sun, 6 Apr 2014, Darius Blaszyk wrote: I've implemented the basic workings of package dependency in fpmkunit. Please find attached a patch against tagged FPC2.6.2. This does not belong in fpmkunit, it belongs in fppkg. So I won't apply this patch. I understand you didn't get fppkg to work, but at the time of your post, I didn't have time to help you fix that. So let's try and fix that instead of going down the wrong road. Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [1]

Reply by email

Darius Blaszyk
to Michael Van Canneyt

Yes I did. And just to be sure I din't miss anything I read it again just now. I solved the path to FPC by letting fppg regenerate the config file. BTW this is at least not very userfriendly. At least fppkg should give a proper warning and not just crash. So now the package manager works, there is nothing mentioned on how to create a package in the wiki. So I tried a few things.

First I tried adding a "local" mirror. However my_repo does not show up when I do a fppkg list (also update does not help here). Would be nice to understand how this works.

<mirror name="my_repo">
<url>file:///C:/develop/repository/fpmake_test/</url> <contact>darius</contact>
<weight>100</weight>
</mirror>

Then I did a fppkg build. This simply only does a fpc fpmake and fpmake consecutively as I can see. So also here nothing that helps me further, as fpmake does not handle package dependencies this is where it ends.

Next I did a fppkg archive. This did not work as I don't have fpmake.pp (hardcoded filename) files in the packages directories but fpmake.inc files. So I renamed them just to realize that the zip packages are useless as the fpmake files are not valid program files. This implies that for a project all fpmake.pp files should contain the same IFDEF setup as in the FPC source tree. It works obviously (FPC proves it) but the sources are far from readable. One just has to make a stinky mess with defines to get something that is usable for the package manager.

Then I thought I would just test an existing package. So I did a "fppkg install zlib". Fppkg returned a message "Package "zlib" not found.". Perhaps it would be better that it would return a message the package is already installed? The current message is just confusing and not reflecting what is going on according to fppkg list. Next I installed the webdesign package. Everything worked fine as one might expect. However the packages are all installed in the central local repository. Is there a way for a project to allways install in the source folder itself? How will fppkg work if I then want to build a tagged or branched version for my project for testing? Will it overwrite the installed packages, will I have to force rebuild of the packages? I can imagine all sorts of mayhem with different versions of packages with this kind of central repository approach. What if another project has the same package name as my project has? What is the policy of fppkg on this?

Fppkg seems to be fine for small stand alone packages as with FPC but I doubt that it is the solution for projects where you have lot's of interproject dependencies. The reason behind being forced to install the project packages into a central repository are not clear and there are reasons not to do it as described above. For standalone projects it should however be enough to setup a buildfile that groups units into packages and and define the package and application dependencies. It's how cmake works except that the pascal build process is much cleaner in design.

Darius

Michael Van Canneyt schreef op 6 apr '14:

Show quoted text 13 lines
On Sun, 6 Apr 2014, Darius Blaszyk wrote: > The path for the FPC executable seems to be wrong. I'm on a 64bit machine. I will have a look to see where fppkg is getting the path from. Did you read: http://wiki.freepascal.org/fppkg [1] ? It is a good introduction. Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [2]

Links:
------
[1] http://wiki.freepascal.org/fppkg
[2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email