Sign in Join

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

Mailing lists / lazarus / 2010-02

lazbuild and cross-compiling

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Seth Grover

I'm not sure if this is a bug, or if I'm just not doing it right...

I am running in a 64-bit Linux environment with FPC 2.4.0 with cross-compiling set up (ie., I have both ppcx64 and ppc386 installed, FPC's default is to use ppx64) If I save a project (the default new application with the single empty form is fine for this example) and I set the Target CPU to i386, and do a "Run | Build All" from within Lazarus, the file that's generated is a 32-bit application, which is correct.

However, if I do "lazbuild project1.lpi" I can see from the command line that's printed out and from examining the resultant file that it's a 64-bit application. If I do "lazbuild --cpu=i386" it works correctly, but lazbuild's help says "--cpu" is used to "orverride the project cpu." Since my .lpi file contains <TargetCPU Value="i386"/> shouldn't lazbuild figure it out and do the right thing (build a 32-bit application) by default?

-SG

This email is fiction. Any resemblance to actual events or persons living or dead is purely coincidental. Seth Grover sethdgrover[at]gmail[dot]com

Reply by email

Seth Grover
to Seth Grover: I'm not sure if this is a bug, or if I'm just not doing it right... I am running in a…

I dug into the code a little bit and here's what seems to be the problem:

In "TLazBuildApplication.BuildProject" after the
"Project1:=LoadProject(AFilename);" the TargetCPU is correct:

(gdb) print PROJECT1^.FCOMPILEROPTIONS^.FTARGETCPU $51 = 0x7ffff7fe7e10 'i386'

However, a few lines after that, it gets overridden by "CPUOverride", which I haven't even set:

Project1.CompilerOptions.TargetCPU:=CPUOverride;

(gdb) print CPUOVERRIDE
$53 = 0x0
(gdb) print PROJECT1^.FCOMPILEROPTIONS^.FTARGETCPU $54 = 0x0

It seems like there needs to be a check on CPUOverride to make sure it's actually set to something before it's used. I'll log a bug in mantis.

-SG

This email is fiction. Any resemblance to actual events or persons living or dead is purely coincidental. Seth Grover sethdgrover[at]gmail[dot]com On Tue, Feb 9, 2010 at 3:17 PM, Seth Grover wrote: > I'm not sure if this is a bug, or if I'm just not doing it right... > > I am running in a 64-bit Linux environment with FPC 2.4.0 with > cross-compiling set up (ie., I have both ppcx64 and ppc386 installed, > FPC's default is to use ppx64) If I save a project (the default new > application with the single empty form is fine for this example) and I > set the Target CPU to i386, and do a "Run | Build All" from within > Lazarus, the file that's generated is a 32-bit application, which is > correct. > > However, if I do "lazbuild project1.lpi" I can see from the command > line that's printed out and from examining the resultant file that > it's a 64-bit application. If I do "lazbuild --cpu=i386" it works > correctly, but lazbuild's help says "--cpu" is used to "orverride the > project cpu." Since my .lpi file contains <TargetCPU Value="i386"/> > shouldn't lazbuild figure it out and do the right thing (build a > 32-bit application) by default? > > -SG > > -- > This email is fiction. Any resemblance to actual events > or persons living or dead is purely coincidental. > > Seth Grover > sethdgrover[at]gmail[dot]com >

Reply by email