Recent

Author Topic: globtype all cpu types excluded  (Read 4796 times)

abtaylr

  • Full Member
  • ***
  • Posts: 107
globtype all cpu types excluded
« on: August 11, 2015, 03:13:29 am »
I am using Laz 1.4.2/FPC 2.6.4 on Kubuntu 15.04 x86_64.  I am getting an error every time I try to compile referring to globtype.  The errors refer to identifiers not found for PInt, AWord, & AInt.  The type declaration is shown above in several IFDEF's listing 64-bit, 32-bit, 16-bit and 8-bit cpu types.  The problem that I am seeing is that every type of cpu is grey'd out and not applicable.  Now that simply can't be right since the host cpu is identified as the first type listed.

In Project>project options>compiler options> I have selected Target OS (-T) Linux, Target CPU Family (-P) x86_64, Target Processor (-Cp) (Default). My host machine has an Intel i5-3570 CPU.  I have run a test on the CPU using the libgpm-1.20.7 which passed all tests.

I have examined my code and found numerous ints, but nothing directly tied to <globtype>, although I don't doubt that somewhere under the hood the reference is needed. I'm at a loss . . .

This is the selection from globtype:

       { Integer type corresponding to pointer size } <---------------- %)the following are all grey'd out:
{$ifdef cpu64bitaddr}
       PUint = qword;
       PInt = int64;
{$endif cpu64bitaddr}
{$ifdef cpu32bitaddr}
       PUint = cardinal;
       PInt = longint;
{$endif cpu32bitaddr}
{$ifdef cpu16bitaddr}
       PUint = word;
       PInt = Smallint;
{$endif cpu16bitaddr}

       { Natural integer register type and size for the target machine }
{$ifdef cpu64bitalu}
       AWord = qword;
       AInt = Int64;

     Const
       AIntBits = 64;
{$endif cpu64bitalu}
{$ifdef cpu32bitalu}
       AWord = longword;
       AInt = longint;

     Const
       AIntBits = 32;
{$endif cpu32bitalu}
{$ifdef cpu16bitalu}
       AWord = Word;
       AInt = Smallint;

     Const
       AIntBits = 16;
{$endif cpu16bitalu}
{$ifdef cpu8bitalu}
       AWord = Byte;
       AInt = Shortint;

     Const
       AIntBits = 8;
{$endif cpu8bitalu}  <grey out ends . . .>

     Type
       PAWord = ^AWord;     <------ error showing
       PAInt = ^AInt;

       { target cpu specific type used to store data sizes }
       ASizeInt = PInt;       <------------ error showing
       ASizeUInt = PUInt;  <------------error showing

       { type used for handling constants etc. in the code generator }
       TCGInt = Int64;

       { This must be an ordinal type with the same size as a pointer
         Note: Must be unsigned! Otherwise, ugly code like
         pointer(-1) will result in a pointer with the value
         $fffffffffffffff on a 32bit machine if the compiler uses
         int64 constants internally (JM) }
       TConstPtrUInt = AWord;    <--------------error showing
                                     
« Last Edit: August 11, 2015, 03:44:50 am by abtaylr »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11384
  • FPC developer.
Re: globtype all cpu types excluded
« Reply #1 on: August 11, 2015, 09:54:10 am »
The compiler sources are meant to compile via MAKE, and via make extra defines are set, so this is logical.


abtaylr

  • Full Member
  • ***
  • Posts: 107
Re: globtype all cpu types excluded
« Reply #2 on: August 11, 2015, 08:43:52 pm »
So . . . are you saying that if I check the boxes in Lazarus > Options for projects > Compiler Options for Target OS, Target CPU and/or Target Processor, I have to use fpcmake, but if I leave everything default, I can let compile and build run in Lazarus?

abtaylr

  • Full Member
  • ***
  • Posts: 107
Re: globtype all cpu types excluded
« Reply #3 on: August 11, 2015, 08:46:20 pm »
Well, I tried changing the target OS, CPU and Processor back to default, but got the same result.  I'll try to do a makefile next.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11384
  • FPC developer.
Re: globtype all cpu types excluded
« Reply #4 on: August 12, 2015, 11:30:37 am »
Yes. The compiler project is special since it needs two sets of such defines.

One for the platform it is being build on, one for the platform it is compiling for.

abtaylr

  • Full Member
  • ***
  • Posts: 107
Re: globtype all cpu types excluded
« Reply #5 on: August 18, 2015, 06:09:46 pm »
I think I have solved the problem.  In the Project Inspector, under Required Packages, I clicked on LCL and did the option Compile.  The error hasn't come up again.  I am cautiously optimistic ...

FPK

  • Full Member
  • ***
  • Posts: 118
Re: globtype all cpu types excluded
« Reply #6 on: August 18, 2015, 06:42:48 pm »
The compiler sources are meant to compile via MAKE, and via make extra defines are set, so this is logical.

The lazarus projects for the compiler (fpc/compiler/*.lpi) are in a good shape, I use them always.

abtaylr

  • Full Member
  • ***
  • Posts: 107
[SOLVED]Re: globtype all cpu types excluded
« Reply #7 on: August 27, 2015, 05:31:40 am »
For the sake of posterity in case someone else has the same problem that I had here is the solution.

With all of the possible CPU types grayed out I was unable to get to the declarations that I needed.  I knew that I needed to get <cpu64bitaddr> and <cpu64bitalu> defined for the rest of globtypes to work properly.  Being a refugee from C/C++, I knew they needed to be defined very early in the process.  Finally, I went on a quest looking at fpc.cfg, compiler switches, preprocessor directives, etc.  I finally found what I needed, very simply and intuitively placed in the Project Options >  Compiler Options > Other for all the world to see -- Custom Options.  I added:

-dcpu64bitaddr
-dcpu64bitalu

Job finished.  A tough learning curve to a simple solution.

Whew, I needed a cold one after that -- I'm kind of an old dog to be learning new tricks, but whatever ...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4460
  • I like bugs.
Re: [SOLVED]Re: globtype all cpu types excluded
« Reply #8 on: August 27, 2015, 09:38:05 am »
I finally found what I needed, very simply and intuitively placed in the Project Options >  Compiler Options > Other for all the world to see -- Custom Options.  I added:

-dcpu64bitaddr
-dcpu64bitalu

Job finished.  A tough learning curve to a simple solution.

In fact I was thinking of renaming the page "Other" to "Custom Options" in project options dialog. Custom options are needed often and deserve their own page. What to do with "Conditionals"? It is not used much, maybe it can be at the same page under custom options.
Then "Custom Options" and "Additions and Overrides" will be next to each other which hopefully clarifies their purpose a little.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4460
  • I like bugs.
Re: [SOLVED]Re: globtype all cpu types excluded
« Reply #9 on: August 28, 2015, 12:13:54 am »
In fact I was thinking of renaming the page "Other" to "Custom Options" in project options dialog.

Done in r49719. Please test.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018