Sign in Join

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

Mailing lists / fpc-devel / 2008-05

The status of fpmake ?

7 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Graeme Geldenhuys

Hi,

What's the status of 'fpmake'. Can it already be used for our custom written software? As a command line build system, instead of Makefile's? I'm using FPC 2.2.1 at the moment.

I'm trying to use fpmake with a simple single unit command line application. The applications in Linux only, but will later be for Windows as well. I would also like the Linux compiled executable to have a '.elf' extension. And when compiled under Windows, the default '.exe' extension.

Below is what I make so far. I can't even manage to compile the fpmake.pas unit. :-(

-----------[ fpmake.pas ]-------------
program fpmake;
uses
   fpmkunit;
var
   t: TTarget;
begin
   with Installer do
   begin
     Targets.DefaultOS := [linux]; // it's a linux only app
     t := Targets.AddUnit('mydialer'); // main program unit mydialer.pas
     Run;
   end;
end.
-----------------------------

Errors when compiled using: fpc fpmake.pas
---------------------------
fpc fpmake.pas
Free Pascal Compiler version 2.2.1 [2008/04/21] for i386 Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Linux for i386
Compiling fpmake.pas
fpmake.pas(12,12) Error: Identifier not found "Targets" fpmake.pas(13,17) Error: Identifier not found "Targets" fpmake.pas(18) Fatal: There were 2 errors compiling module, stopping Fatal: Compilation aborted
Error: /opt/fpc_2.2.1/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
---------------------------

Errors when compiled using: fppkg build
---------------------------
fppkg build
The FPC Package tool encountered the following error: Could not find package "rtl"
---------------------------

Can anybody help me here... I've read the fpmake wiki page and use one of it's examples as my starting point, but no luck yet.

Regards,
- Graeme -

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

Reply by email

Peter Vreman
Show quoted text 17 lines
Hi, What's the status of 'fpmake'. Can it already be used for our custom written software? As a command line build system, instead of Makefile's? I'm using FPC 2.2.1 at the moment. I'm trying to use fpmake with a simple single unit command line application. The applications in Linux only, but will later be for Windows as well. I would also like the Linux compiled executable to have a '.elf' extension. And when compiled under Windows, the default '.exe' extension. Below is what I make so far. I can't even manage to compile the fpmake.pas unit. :-( fpmake.pas(12,12) Error: Identifier not found "Targets" fpmake.pas(13,17) Error: Identifier not found "Targets"

Basic functionality works. Look at the fpmake.pp files in the fpc source tree under packages/ how to use it.

Show quoted text 5 lines
Errors when compiled using: fppkg build --------------------------- fppkg build The FPC Package tool encountered the following error: Could not find package "rtl"

run 'fppkg build --debug' to get more information where it is looking for files.

Peter

Reply by email

Graeme Geldenhuys
to Peter Vreman
Peter Vreman wrote 8 lines
> Below is what I make so far. I can't even manage to compile the > fpmake.pas unit. :-( > > fpmake.pas(12,12) Error: Identifier not found "Targets" > fpmake.pas(13,17) Error: Identifier not found "Targets" Basic functionality works. Look at the fpmake.pp files in the fpc source tree under packages/ how to use it.

I'm busy doing that now. The wiki page is way out of date! None of those examples are compilable.

* Targets is not a property of Installer any more but of TPackage.
* It seems you must at least add one Package to Installer
* DefaultOS property doesn't exist in Installer. I still can't find it elsewhere either.

I've no managed to compile my fpmake.pas unit, but trying to run it via 'fpmake build' to compile my actual project fails because it can't locate RTL package.

I'm getting closer, but still not quite there. ;-)

--------------[ fpmake.pas ]-----------------------
{$mode objfpc}{$H+}
program fpmake;
uses
   fpmkunit;
var
   t: TTarget;
   p: TPackage;
begin
   with Installer do
   begin
     p := AddPackage('MyPackage');
     // don't know where to find DefaultOS...
//    Targets.DefaultOS := [linux]; // it's a linux only app
     t := p.Targets.AddUnit('mydialer'); // main program unit
     Run;
   end;
end.
------------------------- end --------------------

Output from command line....
--------------------
./fpmake build
The installer encountered the following error:
Could not find unit directory for dependency package "rtl" --------------------

I gather fpmake doesn't use the default ~/.fpc.cfg file on my system to locate the normal FPC units and lib files.

Regards,
- Graeme -

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

Reply by email

Graeme Geldenhuys
to Peter Vreman: Basic functionality works. Look at the fpmake.pp files in the fpc source tree under…
Peter Vreman wrote 6 lines
> fppkg build > The FPC Package tool encountered the following error: > Could not find package "rtl" run 'fppkg build --debug' to get more information where it is looking for files.

I tried to do the same now that I have fpmake.pas compiled. So I ran it with the '-l' parameter to list what it's trying to do. Still no luck. I think fpmake is stuck in 'stupid_mode = True' state. ;)

./fpmake compile -l
The installer encountered the following error:
Could not find unit directory for dependency package "rtl"

Regards,
- Graeme -

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

Reply by email

Peter Vreman
Show quoted text 15 lines
Peter Vreman wrote: >> fppkg build >> The FPC Package tool encountered the following error: >> Could not find package "rtl" > > run 'fppkg build --debug' to get more information where it is looking for files. > I tried to do the same now that I have fpmake.pas compiled. So I ran it with the '-l' parameter to list what it's trying to do. Still no luck. I think fpmake is stuck in 'stupid_mode = True' state. ;) ./fpmake compile -l The installer encountered the following error: Could not find unit directory for dependency package "rtl"

You need to use --verbose or --debug to show what it is doing. The list mode is only for the actual compile commands. This is all startup.

If you don't have fpc installed in the default locations /usr/[local/]lib/fpc/<version> you need to set FPCDIR. There is no other way to detect the location.

The /etc/fpc.cfg and ~/.fpc.cfg are for the standalone compiler only and will not be used for package building. fpmake and fppkg have their own configuration files where optimizer/debug options will be passed to the compiler.

Reply by email

Graeme Geldenhuys
to Peter Vreman
Peter Vreman wrote
If you don't have fpc installed in the default locations /usr/[local/]lib/fpc/<version> you need to set FPCDIR. There is no other way to detect the location.

I have it install in /opt/fpc/
See below for details...

The /etc/fpc.cfg and ~/.fpc.cfg are for the standalone compiler only and will not be used for package building. fpmake and fppkg have their own configuration files where optimizer/debug options will be passed to the compiler.

Then why does fpmake mention fpc.cfg in it's help output. <snip>
Where options is one or more of the following:
-h --help This message.
-l --list-commands list commands instead of actually executing them. -n --nofpccfg Compiler will not use fpc.cfg -v --verbose Be verbose when working.
<snip>

It would make sense for the build system to use the global or user's fpc.cfg file. After all, I can compile any application from the command line by simply typing 'fpc <simpleproject.pas>'

Anyway, here are my attempts at helping fpmake along...

Attempt #1
export FPCDIR=/opt/fpc/

./fpmake build -l -v
The installer encountered the following error:
Could not find unit directory for dependency package "rtl"

Attempt #2
export FPCDIR=/opt/fpc/bin

./fpmake build -l -v
The installer encountered the following error:
Could not find unit directory for dependency package "rtl"

... and then finally ....

Attempt #3
export FPCDIR=/opt/fpc/lib/fpc/2.2.1/

./fpmake build -l -v
Warning: Source file "mydialer" not found for i386-linux Compiling package MyPackage
Creating output dir "units/i386-linux"
Compiling target mydialer
Executing command "/opt/fpc/bin/fpc -Tlinux -FUunits/i386-linux -Fu/opt/fpc/lib/fpc/2.2.1/units/i386-linux/rtl "
/opt/fpc/bin/fpc -Tlinux -FUunits/i386-linux
-Fu/opt/fpc/lib/fpc/2.2.1/units/i386-linux/rtl

OK, so with that looking good, I tried the build for real without the '-l' parameter.

Attempt #4
./fpmake build -v
Warning: Source file "mydialer" not found for i386-linux Compiling package MyPackage
Compiling target mydialer
Executing command "/opt/fpc/bin/fpc -Tlinux -FUunits/i386-linux -Fu/opt/fpc/lib/fpc/2.2.1/units/i386-linux/rtl "
Free Pascal Compiler version 2.2.1 [2008/04/21] for i386 Copyright (c) 1993-2008 by Florian Klaempfl
Fatal: No source file name in command line
Fatal: Compilation aborted
Error: /opt/fpc_2.2.1/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
The installer encountered the following error:
External command "/opt/fpc/bin/fpc" failed with exit code 1

Makefile's was so much easier! :)
Or my custom method using in fpGUI:
fpc @extrafpc.cfg <project.pas>

Regards,
- Graeme -

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

Reply by email

Peter Vreman
Show quoted text 20 lines
Peter Vreman wrote: > If you don't have fpc installed in the default locations /usr/[local/]lib/fpc/<version> you need > to set FPCDIR. There is no other way to detect the location. I have it install in /opt/fpc/ See below for details... > > The /etc/fpc.cfg and ~/.fpc.cfg are for the standalone compiler only and will not be used for > package building. fpmake and fppkg have their own configuration files where optimizer/debug > options will be passed to the compiler. Then why does fpmake mention fpc.cfg in it's help output. <snip> Where options is one or more of the following: -h --help This message. -l --list-commands list commands instead of actually executing them. -n --nofpccfg Compiler will not use fpc.cfg -v --verbose Be verbose when working. <snip>

For fpmake this is correct, but fppkg will use the --nofpccfg flag when calling fpmake.

Show quoted text 16 lines
Attempt #3 export FPCDIR=/opt/fpc/lib/fpc/2.2.1/ ./fpmake build -l -v Warning: Source file "mydialer" not found for i386-linux Compiling package MyPackage Creating output dir "units/i386-linux" Compiling target mydialer Executing command "/opt/fpc/bin/fpc -Tlinux -FUunits/i386-linux -Fu/opt/fpc/lib/fpc/2.2.1/units/i386-linux/rtl " /opt/fpc/bin/fpc -Tlinux -FUunits/i386-linux -Fu/opt/fpc/lib/fpc/2.2.1/units/i386-linux/rtl OK, so with that looking good, I tried the build for real without the '-l' parameter.

Please run with --debug to get more information.

Show quoted text 17 lines
Attempt #4 ./fpmake build -v Warning: Source file "mydialer" not found for i386-linux Compiling package MyPackage Compiling target mydialer Executing command "/opt/fpc/bin/fpc -Tlinux -FUunits/i386-linux -Fu/opt/fpc/lib/fpc/2.2.1/units/i386-linux/rtl " Free Pascal Compiler version 2.2.1 [2008/04/21] for i386 Copyright (c) 1993-2008 by Florian Klaempfl Fatal: No source file name in command line Fatal: Compilation aborted Error: /opt/fpc_2.2.1/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled) The installer encountered the following error: External command "/opt/fpc/bin/fpc" failed with exit code 1

You ignored a warning. You need to specify the full source name including extension. There is no support for default extension in fpmake, because it makes things unclear and unnecessary complex. fpmake also needs the filename for creating a source archive.

Makefile's was so much easier! :) Or my custom method using in fpGUI: fpc @extrafpc.cfg <project.pas>

fppkg and fpmake are something different. They are made to install packages and support multiple optimizer/pic/debug configurations (this is not yet working) and targets for each package. Also it allows you to install updated versions of packages per user. That is the reason why fppkg and fpmake want to handle the search order of the unit dirs. A real world example is the zstream unit that was delivered in 2.2.0 in the fcl. There have been some fixes to this unit and it is available in the new paszlib package. When compiling fpmkunit the directory of the new paszlib and fcl-base packages needs to be used and not the old fcl directory still available in the 2.2.0 release. These kind of issues were not solvable by the Makefile. They can be solved in extrafpc.cfg by experienced users, but it is manual and error-prone work.

Also fppkg will take care that all installed packages are in a consistent state. E.g. updating paszlib will trigger an implciit re-compile of all dependent (e.g. fpmkunit) packages. Extreme example: updating the rtl means that fppkg will re-compile all packages.

Reply by email