Sign in Join

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

Mailing lists / lazarus / 2010-09

How to pass path of fpc to make command, and some thoughts on Lazarus/FPC Installation.

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Frank Church

I am trying to compile Lazarus from source using a different compiler and I have hit a snag.

These are the steps followed so far, but I need to pass the path of the new fpc to the Lazarus make command.

#create build and installation directories
mkdir ~/LazarusBuilds
mkdir ~/LazarusInstalls

#fpc
svn checkout http://svn.freepascal.org/svn/fpc/tags/release_2_4_0 fpc240 cd fpc240
make all PP=/usr/bin/fpc #use default fpc installed from Ubuntu package make install PP=/home/fchurch/LazarusBuilds/fpc240/compiler/ppc386 INSTALL_PREFIX=/home/fchurch/LazarusInstalls/fpc240

These are the issues I am having.

1. The fpc executable is installed in ~/LazarusInstalls/fpc240/bin/fpc When I execute ~/LazarusInstalls/fpc240/bin/fpc, the first 3 lines of output say:

Free Pascal Compiler version 2.2.4-3 [2009/06/03] for i386 Copyright (c) 1993-2008 by Florian Klaempfl
/usr/lib/fpc/2.2.4/ppc386 [options] <inputfile> [options]

Obviously fpc calls ppc386 that is in the path, perhaps there is no fpc.cfg available.

So how I can create an fpc.cfg and pass it the fpc I just compiled? Couldn't the install script create a suitable fpc.cfg to match the installation directory?

2. Onto Lazarus

cd ~/LazarusBuilds
svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus27446 cd lazarus27446

make obviously fails here because I don't know the option of passing my shiny new fpc 2.4.0 to the make command.

Is there an option for that, and are there other options to ensure that new compiler will only link
with files from its subdirectories?

There is also this hilarious bit in the README.txt that says.

==================
Compilation:
You don't need ./configure, just do

[]$ make clean all

This will create the lazarus executable. Start it and enjoy. ===================

What, doesn't even need FreePascal?

There may be some legacy reasons why Lazarus/FPC doesn't use the ./configure approach, but at least a well documented bash script which allows you to set some variables before compilation would be very helpful.

After all, the main idea of programming is never to use constants or literals where well documented
variables will do

/vfclists

Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100924/1067339c/attachment.html>

Reply by email

Sven Barth
to Frank Church
Frank Church wrote 11 lines
1. The fpc executable is installed in ~/LazarusInstalls/fpc240/bin/fpc When I execute ~/LazarusInstalls/fpc240/bin/fpc, the first 3 lines of output say: Free Pascal Compiler version 2.2.4-3 [2009/06/03] for i386 Copyright (c) 1993-2008 by Florian Klaempfl /usr/lib/fpc/2.2.4/ppc386 [options] <inputfile> [options] Obviously fpc calls ppc386 that is in the path, perhaps there is no fpc.cfg available.

There might be a .fpc.cfg in ~/ from your 2.2.4, but the ppc386 might indeed be called by using $PATH. You can check that by overriding it temporaily by calling fpc in the following way (please adjust the paths if necessary, I constructed them out of memory):

PATH=~/LazarusInstalls/fpc240/lib/fpc/2.4.0 ~/LazarusInstalls/fpc240/bin/fpc

So how I can create an fpc.cfg and pass it the fpc I just compiled? Couldn't the install script create a suitable fpc.cfg to match the installation directory?

There should be a makeskel or similar binary in fpc240/bin/fpc which you can call to create a config skeleton (you might call it with -h to see its help).

You might also copy your 2.2.4 config file and change all occurences of "/usr/lib/fpc/2.2.4" to "/home/???/LazarusInstalls/fpc240/lib/fpc/2.4.0".

Show quoted text 30 lines
2. Onto Lazarus cd ~/LazarusBuilds svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus27446 cd lazarus27446 make obviously fails here because I don't know the option of passing my shiny new fpc 2.4.0 to the make command. Is there an option for that, and are there other options to ensure that new compiler will only link with files from its subdirectories? There is also this hilarious bit in the README.txt that says. ================== Compilation: You don't need ./configure, just do []$ make clean all This will create the lazarus executable. Start it and enjoy. =================== What, doesn't even need FreePascal? There may be some legacy reasons why Lazarus/FPC doesn't use the ./configure approach, but at least a well documented bash script which allows you to set some variables before compilation would be very helpful.

There is no legacy reason besides FPC simply not using it cause FPC doesn't need it.

You can pass the used compiler binary by adding
"FPC=~/LazarusInstalls/fpc240/lib/fpc/2.4.0/ppc386" to the "make" command line (after "clean all"). Please note that you also need the ~/.fpc.cfg for this to work.

Note: You should(!) be able to use a different config file than "~/.fpc.cfg" by passing "" to the make command as well.

After all, the main idea of programming is never to use constants or literals where well documented variables will do

Yes, but setting up different versions of FPC needs a bit of a creative thinking process and I've yet to think of an easier way than using a "switch script" ^^

Regards,
Sven

Reply by email

Frank Church
to Sven Barth
Sven Barth wrote 33 lines
Am 24.09.2010 17:25, schrieb Frank Church: 1. The fpc executable is installed in ~/LazarusInstalls/fpc240/bin/fpc > When I execute ~/LazarusInstalls/fpc240/bin/fpc, the first 3 lines of > output say: > > Free Pascal Compiler version 2.2.4-3 [2009/06/03] for i386 > Copyright (c) 1993-2008 by Florian Klaempfl > /usr/lib/fpc/2.2.4/ppc386 [options] <inputfile> [options] > > Obviously fpc calls ppc386 that is in the path, perhaps there is no > fpc.cfg available. > > There might be a .fpc.cfg in ~/ from your 2.2.4, but the ppc386 might indeed be called by using $PATH. You can check that by overriding it temporaily by calling fpc in the following way (please adjust the paths if necessary, I constructed them out of memory): PATH=~/LazarusInstalls/fpc240/lib/fpc/2.4.0 ~/LazarusInstalls/fpc240/bin/fpc So how I can create an fpc.cfg and pass it the fpc I just compiled? > Couldn't the install script create a suitable fpc.cfg to match the > installation directory? > There should be a makeskel or similar binary in fpc240/bin/fpc which you can call to create a config skeleton (you might call it with -h to see its help).

I think the command in question is 'samplecfg'. It also generates some fp.xxx files under ~/.fp/. I hope they are for the command line version. Could they possibly interfere with other versions of FreePascal I might be using?

Show quoted text 59 lines
You might also copy your 2.2.4 config file and change all occurences of "/usr/lib/fpc/2.2.4" to "/home/???/LazarusInstalls/fpc240/lib/fpc/2.4.0". > 2. Onto Lazarus > > cd ~/LazarusBuilds > svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus27446 > cd lazarus27446 > > make obviously fails here because I don't know the option of passing my > shiny new fpc 2.4.0 to the make command. > > Is there an option for that, and are there other options to ensure that > new compiler will only link > with files from its subdirectories? > > There is also this hilarious bit in the README.txt that says. > > ================== > Compilation: > You don't need ./configure, just do > > []$ make clean all > > This will create the lazarus executable. Start it and enjoy. > =================== > > What, doesn't even need FreePascal? > > There may be some legacy reasons why Lazarus/FPC doesn't use the > ./configure approach, but at least a well documented bash script which > allows you to set some variables before compilation would be very helpful. > There is no legacy reason besides FPC simply not using it cause FPC doesn't need it. You can pass the used compiler binary by adding "FPC=~/LazarusInstalls/fpc240/lib/fpc/2.4.0/ppc386" to the "make" command line (after "clean all"). Please note that you also need the ~/.fpc.cfg for this to work. Note: You should(!) be able to use a different config file than "~/.fpc.cfg" by passing "" to the make command as well. > After all, the main idea of programming is never to use constants or > literals where well documented > variables will do > Yes, but setting up different versions of FPC needs a bit of a creative thinking process and I've yet to think of an easier way than using a "switch script" ^^

I am working through you suggestions and I notice that the 2.4.0 specific files seem to be in a directory lib/fpc/2.4.0 under ~/LazarusInstalls/fpc240, which contains a 'share' and a 'bin' directory.'share' contains a 'doc/2.4.0' directory.

Does that mean that the I could also use make install INSTALL_PREFIX='~/LazarusInstalls/fpc240' command to install all the fpc versions into the same directory without their executable's clashing?

I take it that the 'bin' folder in the INSTALL_PREFIX contains utilities which can be shared among the different installations, and that the 'share' folder will also have different docs for the versions.

Show quoted text 9 lines
Regards, Sven -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100924/f173e3dc/attachment.html>

Reply by email

Sven Barth
to Frank Church
Frank Church wrote 13 lines
On 24 September 2010 16:45, Sven Barth < <mailto:>> wrote: There should be a makeskel or similar binary in fpc240/bin/fpc which you can call to create a config skeleton (you might call it with -h to see its help). I think the command in question is 'samplecfg'. It also generates some fp.xxx files under ~/.fp/. I hope they are for the command line version. Could they possibly interfere with other versions of FreePascal I might be using?

As I'm now on my Linux PC again, I checked that: it is makeskel in ~/LazarusInstalls/fpc240/bin/makeskel. The help can be queried by using "-h" or "--help" as parameter.

FPC reads by default the configuration file from ~/.fpc.cfg (and /etc/fpc.cfg, but I'm not using that one). So every FPC version will use that file if it exists and you didn't tell it to exclude the default file with "-n" (I forgot that below).

But you can use the $fpcversion macros in the config file to "generalize" that (might be usable with the "one prefix" configuration below).

Show quoted text 13 lines
I am working through you suggestions and I notice that the 2.4.0 specific files seem to be in a directory lib/fpc/2.4.0 under ~/LazarusInstalls/fpc240, which contains a 'share' and a 'bin' directory.'share' contains a 'doc/2.4.0' directory. Does that mean that the I could also use make install INSTALL_PREFIX='~/LazarusInstalls/fpc240' command to install all the fpc versions into the same directory without their executable's clashing? I take it that the 'bin' folder in the INSTALL_PREFIX contains utilities which can be shared among the different installations, and that the 'share' folder will also have different docs for the versions.

Yes, the utilities in "bin" can be shared, but you need to make sure that they are from the newest version you are using, because the compiler might rely on them.

And I just noticed: you can force "fpc" to look in a certain directory for the compiler instead of relying on path:

fpc -Xp~/LazarusInstalls/fpc240/lib/fpc/2.4.0 {other parameters}

will search for the "ppc*" in the version 2.4.0 directory, while

fpc -Xp~/LazarusInstalls/fpc240/lib/fpc/2.5.1 {other parameters}

will search in the 2.5.1 directory

Regards,
Sven

Reply by email

Frank Church
to Sven Barth
Sven Barth wrote 22 lines
On 24.09.2010 21:53, Frank Church wrote: > > > On 24 September 2010 16:45, Sven Barth < > <mailto:>> wrote: > There should be a makeskel or similar binary in fpc240/bin/fpc which > you can call to create a config skeleton (you might call it with -h > to see its help). > > > I think the command in question is 'samplecfg'. It also generates some > fp.xxx files under ~/.fp/. I hope they are for the command line version. > Could they possibly interfere with other versions of FreePascal I might > be using? > As I'm now on my Linux PC again, I checked that: it is makeskel in ~/LazarusInstalls/fpc240/bin/makeskel. The help can be queried by using "-h" or "--help" as parameter.

makeskel has a whole lot of options but none of them mention fpc.cfg. Do you have a sample command? It appears to be some kind of xml generator.

Show quoted text 37 lines
FPC reads by default the configuration file from ~/.fpc.cfg (and /etc/fpc.cfg, but I'm not using that one). So every FPC version will use that file if it exists and you didn't tell it to exclude the default file with "-n" (I forgot that below). But you can use the $fpcversion macros in the config file to "generalize" that (might be usable with the "one prefix" configuration below). I am working through you suggestions and I notice that the 2.4.0 > specific files seem to be in a directory lib/fpc/2.4.0 under > ~/LazarusInstalls/fpc240, which contains a 'share' and a 'bin' > directory.'share' contains a 'doc/2.4.0' directory. > > Does that mean that the I could also use make install > INSTALL_PREFIX='~/LazarusInstalls/fpc240' command to install all the fpc > versions into the same directory without their executable's clashing? > > > I take it that the 'bin' folder in the INSTALL_PREFIX contains utilities > which can be shared among the different installations, and that the > 'share' folder will also have different docs for the versions. > Yes, the utilities in "bin" can be shared, but you need to make sure that they are from the newest version you are using, because the compiler might rely on them. And I just noticed: you can force "fpc" to look in a certain directory for the compiler instead of relying on path: fpc -Xp~/LazarusInstalls/fpc240/lib/fpc/2.4.0 {other parameters} will search for the "ppc*" in the version 2.4.0 directory, while fpc -Xp~/LazarusInstalls/fpc240/lib/fpc/2.5.1 {other parameters}

I have tested this and it works but it does not accept the ~ . It needs the full path name, it also rather odd because it does not allow the use of a space between the option and the parameter.

Can this be set in the Lazarus environment as well, for all projectsm and Lazarus IDE rebuilds?

Show quoted text 13 lines
will search in the 2.5.1 directory Regards, Sven -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100925/4ad64b71/attachment-0001.html>

Reply by email

Sven Barth
to Frank Church
Frank Church wrote 8 lines
As I'm now on my Linux PC again, I checked that: it is makeskel in ~/LazarusInstalls/fpc240/bin/makeskel. The help can be queried by using "-h" or "--help" as parameter. makeskel has a whole lot of options but none of them mention fpc.cfg. Do you have a sample command? It appears to be some kind of xml generator.

I must be very sleepy already... it is not makeskel, but fpcmkcfg. The options there in the help should be a lot more intuitive ^^ (makeskel is for the documentation tool fpdoc).

Show quoted text 13 lines
And I just noticed: you can force "fpc" to look in a certain directory for the compiler instead of relying on path: fpc -Xp~/LazarusInstalls/fpc240/lib/fpc/2.4.0 {other parameters} will search for the "ppc*" in the version 2.4.0 directory, while fpc -Xp~/LazarusInstalls/fpc240/lib/fpc/2.5.1 {other parameters} I have tested this and it works but it does not accept the ~ . It needs the full path name, it also rather odd because it does not allow the use of a space between the option and the parameter.

Oh yes, it doesn't interpret "~"... -.- You can use "$HOME" instead, that works ^^

And it's normal for the compiler and its utilities to disallow a space between parameter name and it's value (makes parsing of the parameters a bit easier).

Can this be set in the Lazarus environment as well, for all projectsm and Lazarus IDE rebuilds?

You might try the following (you need Lazarus 0.9.29 for this) - this it not tested by me though:

* Set the compiler in "Settings->Settings->Environment" to "/home/???/LazarusInstaller/fpc240/bin/fpc" as suggested by Mattias
* Open a new project and go to
"Project->Projectsettings->Compilersettings->Others" and add the "-Xp(...)" parameter into that memo
* Enable "Use this settings as default for new projects" (or similar, I'm using the German version)
* close dialog with ok
Note: existing projects must be adjusted manually

Regards,
Sven

Reply by email