Sign in Join

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

Mailing lists / lazarus / 2011-12

Custom OS/CPU targets for FPC - build help

20 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

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

David Unric

Hi,

as I'm unable to sign-up on Lazarus forums (as control question "1+2=" rejects answer 3) the question is placed here.

Free Pascal Compiler version 2.7.1 [2011/12/25] for x86_64 Copyright (c) 1993-2011 by Florian Klaempfl and others c:\Lazarus\fpc\2.7.1\bin\x86_64-win64\ppcx64.exe [options] <inputfile> [options]

...

-T<x> Target operating system:
-Tdarwin Darwin/Mac OS X
-Tlinux Linux
-Twin64 Win64 (64 bit Windows systems)

As you can see, three operating system targets are currently supported by installed freepascal compiler.
What commands do I have to use to rebuild FPC another target OS/CPU like Win32/i386 will be supported ?

Thx.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111230/396eac20/attachment.html>

Reply by email

David Unric
to leledumbo

Hi,

I've read about cross compiling on the wiki, finaly managed to rebuild sources and install compiled binaries and units however fpc's target OSes did not changed and still missing support for Win64. Sources were built with

make all OS_TARGET=win64 CPU_TARGET=x86_64
make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=\path\to\my\fpc

I can produce x86_64/win64 binaries manually with 'ppcrossx64' but the main fpc.exe still lacks win64 target, so I'm not able switch in Lazarus between win32 and win64 targets.

The question is about including another target in fpc compiler so I need not to call separate cross-compiler.

Take care.

leledumbo wrote 16 lines
> What commands do I have to use to rebuild FPC another target OS/CPU like Win32/i386 will be supported ? http://wiki.lazarus.freepascal.org/Cross_compiling -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Custom-OS-CPU-targets-for-FPC-build-help-tp3621041p3621677.html Sent from the Free Pascal - Lazarus mailing list . -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120103/a90b52b6/attachment.html>

Reply by email

Vincent Snijders
to David Unric

2012/1/3 David Unric :

The question is about including another target in fpc compiler so I need not to call separate cross-compiler.

If you installed the cross compiler correctly, you can use fpc -Px86_64, which will call the cross compiler.

Vincent

Reply by email

Sven Barth
to David Unric: I've read about cross compiling on the wiki, finaly managed to rebuild sources and…
David Unric wrote
I can produce x86_64/win64 binaries manually with 'ppcrossx64' but the main fpc.exe still lacks win64 target, so I'm not able switch in Lazarus between win32 and win64 targets.

The fpc.exe simply calls the default ppcXXX.exe for which it was compiled if no "-PXXX" was given and displays the help options of that. So if your default compiler is ppc386 then "fpc -h" will display all i386 targets. If you now do a "fpc -Px86_64 -h" it should display all targets for x86_64.

Regards,
Sven

Reply by email

David Unric
to Vincent Snijders: 2012/1/3 David Unric : If you installed the cross compiler correctly, you can use fpc…

Thx Vincent,

by supplying -P switch to fpc, I can finally produce x86_64 executables. I'm surprised this switch is not mentioned in interactive help (fpc -? or -h).
Why compiler fails when supplied with documented -T<target os> option ?

fpc -Twin64 consoleapp.dpr

Error: Illegal parameter: -Twin64
Error: c:\Lazarus\fpc\2.7.1\bin\i386-win32\ppc386.exe returned an error exitcode
(normal if you did not specify a source file to be compiled)

Lazarus 0.9.31 seems to do not use -P option as it still produces i386 code even if target CPU family is set to x86_64 in Project options and exe is rebuilt from scratch (console app).

I'd like to ask somebody to shed some light on this subjects:
1) why supplying target OS option (-T) fails ? If I'd like to build win64 exe on win32 system have I pass CPU Target and fpc "automagically" selects appropriate OS Target ?
2) How to tweak Lazarus so I can simply switch between win32/win64 targets ?

I'd appreciate any hint.

David

On Tue, Jan 3, 2012 at 1:52 PM, Vincent Snijders <

Show quoted text 18 lines
wrote: 2012/1/3 David Unric : > The question is about including another target in fpc compiler so I need not > to call separate cross-compiler. If you installed the cross compiler correctly, you can use fpc -Px86_64, which will call the cross compiler. Vincent -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120103/f462b776/attachment.html>

Reply by email

David Unric
to Sven Barth: The fpc.exe simply calls the default ppcXXX.exe for which it was compiled if no "-PXXX"…

I got it, thank You Sven.
Now I just need to set Lazarus to use -P option if I set target CPU family target in Project options. It seems to be ignored by my current installed version 0.9.31 .

Regards.

David

Sven Barth wrote 22 lines
Am 03.01.2012 13:45, schrieb David Unric: I can produce x86_64/win64 binaries manually with 'ppcrossx64' but the > main fpc.exe still lacks win64 target, so I'm not able switch in Lazarus > between win32 and win64 targets. > The fpc.exe simply calls the default ppcXXX.exe for which it was compiled if no "-PXXX" was given and displays the help options of that. So if your default compiler is ppc386 then "fpc -h" will display all i386 targets. If you now do a "fpc -Px86_64 -h" it should display all targets for x86_64. Regards, Sven -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120103/efe0df12/attachment-0001.html>

Reply by email

zeljko
to David Unric: by supplying -P switch to fpc, I can finally produce x86_64 executables. I'm surprised…
David Unric wrote
I'd like to ask somebody to shed some light on this subjects: 1) why supplying target OS option (-T) fails ? If I'd like to build win64 exe on win32 system have I pass CPU Target and fpc "automagically" selects appropriate OS Target ?

You don't need anything to pass to fpc, lazarus can do that via project options (compiler options), you can set various build modes there.

2) How to tweak Lazarus so I can simply switch between win32/win64 targets ?

You have project build modes ... it's easy to switch.

zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120103/d1885f00/attachment.html>

Reply by email

Sven Barth
to David Unric: by supplying -P switch to fpc, I can finally produce x86_64 executables. I'm surprised…
David Unric wrote
Lazarus 0.9.31 seems to do not use -P option as it still produces i386 code even if target CPU family is set to x86_64 in Project options and exe is rebuilt from scratch (console app).

Are you sure that it's a 32-Bit application?

I'd like to ask somebody to shed some light on this subjects: 1) why supplying target OS option (-T) fails ? If I'd like to build win64 exe on win32 system have I pass CPU Target and fpc "automagically" selects appropriate OS Target ?

This is the same problem I mentioned in my other mail. Without the "-PXXX" argument fpc selects the i386 compiler which does not know about the win64 target, thus the error.

2) How to tweak Lazarus so I can simply switch between win32/win64 targets ? I'd appreciate any hint.

Normally this works by changing the CPU family in the compiler options. Are you sure that you've set Lazarus to use the correct compiler?

Regards,
Sven

Reply by email

Mattias Gaertner
to David Unric: by supplying -P switch to fpc, I can finally produce x86_64 executables. I'm surprised…
Show quoted text 5 lines
Thx Vincent, by supplying -P switch to fpc, I can finally produce x86_64 executables. I'm surprised this switch is not mentioned in interactive help (fpc -? or -h).

Indeed. Please create a bug report.

Show quoted text 6 lines
Why compiler fails when supplied with documented -T<target os> option ? >fpc -Twin64 consoleapp.dpr Error: Illegal parameter: -Twin64 Error: c:\Lazarus\fpc\2.7.1\bin\i386-win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled)

ppc386.exe does not know about the target 'win64'.

Lazarus 0.9.31 seems to do not use -P option as it still produces i386 code even if target CPU family is set to x86_64 in Project options and exe is rebuilt from scratch (console app).

It does use the -P and -T switch. But it passes them only if they differ from the default.

Show quoted text 5 lines
I'd like to ask somebody to shed some light on this subjects: 1) why supplying target OS option (-T) fails ? If I'd like to build win64 exe on win32 system have I pass CPU Target and fpc "automagically" selects appropriate OS Target ? 2) How to tweak Lazarus so I can simply switch between win32/win64 targets ?

1. Fix your installation, so that setting "Target OS" and "Target CPU" in the IDE compiler options works.
2. Add another build mode.

http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Build_modes

Mattias

Reply by email

David Unric
to Sven Barth: Are you sure that it's a 32-Bit application? This is the same problem I mentioned in my…

Hi,

Sven Barth wrote 10 lines
Am 03.01.2012 15:55, schrieb David Unric: Lazarus 0.9.31 seems to do not use -P option as it still produces i386 > code even if target CPU family is set to x86_64 in Project options and > exe is rebuilt from scratch (console app). > Are you sure that it's a 32-Bit application?

It is detected as i386 app by PE Information tool from GExperts. If I compile source from command line by fpc -Px86_64, the produced exe is detected as 64bit (AMD x64).

Show quoted text 12 lines
I'd like to ask somebody to shed some light on this subjects: > 1) why supplying target OS option (-T) fails ? If I'd like to build > win64 exe on win32 system have I pass CPU Target and fpc "automagically" > selects appropriate OS Target ? > This is the same problem I mentioned in my other mail. Without the "-PXXX" argument fpc selects the i386 compiler which does not know about the win64 target, thus the error.

Ok, fpc -P argument is mandatory, there is no default CPU target for OS target.

2) How to tweak Lazarus so I can simply switch between win32/win64 targets

Show quoted text 11 lines
> ? > I'd appreciate any hint. > Normally this works by changing the CPU family in the compiler options. Are you sure that you've set Lazarus to use the correct compiler? Regards, Sven

Yes, the path to fpc compiler in Lazarus options is coorect. "Compiler path" is "C:\Lazarus\fpc\2.7.1\bin\i386-win32\fpc.exe" .

Show quoted text 8 lines
-- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120103/19d9dfcd/attachment.html>

Reply by email

David Unric
to Mattias Gaertner: On Tue, 3 Jan 2012 15:55:58 +0100 Indeed. Please create a bug report. ppc386.exe does not…

Hi Mattias,

Mattias Gaertner wrote 11 lines
On Tue, 3 Jan 2012 15:55:58 +0100 David Unric wrote: > Thx Vincent, > > by supplying -P switch to fpc, I can finally produce x86_64 executables. > I'm surprised this switch is not mentioned in interactive help (fpc -? or > -h). Indeed. Please create a bug report.

I'm going to fill a bug report. Just attempted to make sure I did not miss something, ie. I'm mistaken.

Show quoted text 9 lines
> Why compiler fails when supplied with documented -T<target os> option ? > >fpc -Twin64 consoleapp.dpr > Error: Illegal parameter: -Twin64 > Error: c:\Lazarus\fpc\2.7.1\bin\i386-win32\ppc386.exe returned an error > exitcode > (normal if you did not specify a source file to be compiled) ppc386.exe does not know about the target 'win64'.

Allright, CPU target is a mandatory option.

Show quoted text 9 lines
> Lazarus 0.9.31 seems to do not use -P option as it still produces i386 code > even if target CPU family is set to x86_64 in Project options and exe is > rebuilt from scratch (console app). It does use the -P and -T switch. But it passes them only if they differ from the default.

I'm still confused here. I did peek into .lpi project options file and it contains the following tag:

<CodeGeneration>
<TargetCPU Value="x86_64"/>
<TargetOS Value="win64"/>
</CodeGeneration>
Although a clean rebuild of source produces i386 executable. No error messages during compilation phase.
???

Show quoted text 23 lines
> I'd like to ask somebody to shed some light on this subjects: > 1) why supplying target OS option (-T) fails ? If I'd like to build win64 > exe on win32 system have I pass CPU Target and fpc "automagically" selects > appropriate OS Target ? > 2) How to tweak Lazarus so I can simply switch between win32/win64 targets ? 1. Fix your installation, so that setting "Target OS" and "Target CPU" in the IDE compiler options works. 2. Add another build mode. http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Build_modes Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120103/2fdcc518/attachment-0001.html>

Reply by email

Mattias Gaertner
to David Unric
Show quoted text 19 lines
[...] > > Lazarus 0.9.31 seems to do not use -P option as it still produces i386 > code > > even if target CPU family is set to x86_64 in Project options and exe is > > rebuilt from scratch (console app). > > It does use the -P and -T switch. But it passes them only if they > differ from the default. > I'm still confused here. I did peek into .lpi project options file and it contains the following tag: <CodeGeneration> <TargetCPU Value="x86_64"/> <TargetOS Value="win64"/> </CodeGeneration> Although a clean rebuild of source produces i386 executable. No error messages during compilation phase. ???

Hmm. Maybe your fpc.exe and lazarus.exe were compiled differently and have different defaults.
I changed the IDE to always pass the -T and -P if they are set.

[...]

Mattias

Reply by email

David Unric
to Mattias Gaertner
Mattias Gaertner wrote 30 lines
On Tue, 3 Jan 2012 17:19:57 +0100 David Unric wrote: >[...] > > > Lazarus 0.9.31 seems to do not use -P option as it still produces i386 > > code > > > even if target CPU family is set to x86_64 in Project options and exe is > > > rebuilt from scratch (console app). > > > > It does use the -P and -T switch. But it passes them only if they > > differ from the default. > > > I'm still confused here. I did peek into .lpi project options file and it > contains the following tag: > > <CodeGeneration> > <TargetCPU Value="x86_64"/> > <TargetOS Value="win64"/> > </CodeGeneration> > Although a clean rebuild of source produces i386 executable. No error > messages during compilation phase. > ??? Hmm. Maybe your fpc.exe and lazarus.exe were compiled differently and have different defaults. I changed the IDE to always pass the -T and -P if they are set. Just had a look at command line options Lazarus passes to FPC (Show

options in Project options) and can confirm, the cpu target -P is missing if x86_64 is explicitly selected.

How did you changed IDE to always pass -T and -P options ?

Thx.

David

Show quoted text 11 lines
>[...] Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120103/12c43cc9/attachment-0001.html>

Reply by email

Marco van de Voort
to Sven Barth: The fpc.exe simply calls the default ppcXXX.exe for which it was compiled if no "-PXXX"…
Sven Barth wrote 10 lines
Am 03.01.2012 13:45, schrieb David Unric: > I can produce x86_64/win64 binaries manually with 'ppcrossx64' but the > main fpc.exe still lacks win64 target, so I'm not able switch in Lazarus > between win32 and win64 targets. The fpc.exe simply calls the default ppcXXX.exe for which it was compiled if no "-PXXX" was given and displays the help options of that. So if your default compiler is ppc386 then "fpc -h" will display all i386 targets. If you now do a "fpc -Px86_64 -h" it should display all targets for x86_64.

Or, if you kinky, try the effect of -V

Reply by email

Sven Barth
to Marco van de Voort
Marco van de Voort wrote 13 lines
On Tue, Jan 03, 2012 at 02:03:44PM +0100, Sven Barth wrote: > Am 03.01.2012 13:45, schrieb David Unric: >> I can produce x86_64/win64 binaries manually with 'ppcrossx64' but the >> main fpc.exe still lacks win64 target, so I'm not able switch in Lazarus >> between win32 and win64 targets. > > The fpc.exe simply calls the default ppcXXX.exe for which it was > compiled if no "-PXXX" was given and displays the help options of that. > So if your default compiler is ppc386 then "fpc -h" will display all > i386 targets. If you now do a "fpc -Px86_64 -h" it should display all > targets for x86_64. Or, if you kinky, try the effect of -V

Somehow I have the feeling that this should also be added to the help fpc/ppcX displays...

Regards,
Sven

Reply by email

Marco van de Voort
to Sven Barth
Sven Barth wrote
Somehow I have the feeling that this should also be added to the help fpc/ppcX displays...

They are fpc features not ppc<x> features. And the help you see is from ppc<x>.

Maybe ppc<x> could display something like

-hfpc Help of fpc binary

and then fpc could process -hfpc to be the "own" help.

Reply by email

Sven Barth
to Marco van de Voort
Marco van de Voort wrote 8 lines
On Wed, Jan 04, 2012 at 09:28:17AM +0100, Sven Barth wrote: > > Somehow I have the feeling that this should also be added to the help > fpc/ppcX displays... They are fpc features not ppc<x> features. And the help you see is from ppc<x>.

Yes, I'm aware of this, but there often seem to be people that don't know the one or other option of fpc (I myself didn't know about "-V" for example).

Show quoted text 5 lines
Maybe ppc<x> could display something like -hfpc Help of fpc binary and then fpc could process -hfpc to be the "own" help.

Might be an idea.

Regards,
Sven

Reply by email