Recent

Author Topic: BGRABitmap 5.7.1 won't compile on OS X  (Read 19100 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
BGRABitmap 5.7.1 won't compile on OS X
« on: April 09, 2012, 04:49:08 pm »
Hello,

I am getting an error in bgrasse.pas:

'Generating PIC, but reference is not PIC-safe'

Any ideas on why? 5.6 compiles fine.

Cheers,
Frederick

OS X 10.6.8, Intel
Lazarus 0.9.31
Free Pascal 2.6.0
« Last Edit: April 09, 2012, 04:50:51 pm by Frederick »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #1 on: April 12, 2012, 04:25:00 pm »
Maybe compiler options for the package (optimization level or linking options) could be changed to solve this.
Conscience is the debugger of the mind

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #2 on: April 13, 2012, 02:01:59 pm »
Thanks Circular,

I can try some different setting, but am not really sure what I am doing. My options should be standard, Level 1 debugger optimization, no special linking options (GDB, Automatic, line numbers).

I will probably wait for the next version, and see if others run into similar issues on OS X.

By the way, many, many thanks for your work on BGRABitmap. It is extraordinarily useful to me.

Cheers,
Frederick   
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #3 on: April 14, 2012, 12:44:02 am »
I'm happy that it's useful  :)

About compiler options, there is a difference between your app config and my library config. You need to open the package, and in the package window, go to the compiler options.
Conscience is the debugger of the mind

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #4 on: May 09, 2012, 03:05:45 pm »
Hi, i'm updating today to Laz 1.1 and with that decided to update all components i use from SVN, but BGRABitmap is not compiling, all revisions from 388 and up are generating this type of error in multiple places:

Code: [Select]
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(108,15) Error: Generating PIC, but reference is not PIC-safe
p.s. fpc 2.6.0 - laz 1.1

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #5 on: May 09, 2012, 07:03:34 pm »
What is on line 108 that could bring this error ?
Conscience is the debugger of the mind

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #6 on: May 10, 2012, 09:40:36 am »
It's in ASM code part that is
Code: [Select]
cmp UseSSE, 0
What is on line 108 that could bring this error ?
It's from rev.388

Here is rev.402 errors
Code: [Select]
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(130,15) Error: Generating PIC, but reference is not PIC-safe
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(169,15) Error: Generating PIC, but reference is not PIC-safe
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(204,15) Error: Generating PIC, but reference is not PIC-safe
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(306,15) Error: Generating PIC, but reference is not PIC-safe
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(347,15) Error: Generating PIC, but reference is not PIC-safe
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(353,16) Error: Generating PIC, but reference is not PIC-safe
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(411,22) Error: Generating PIC, but reference is not PIC-safe
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(469,22) Error: Generating PIC, but reference is not PIC-safe
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(527,22) Error: Generating PIC, but reference is not PIC-safe
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(680) Fatal: There were 9 errors compiling module, stopping

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #7 on: May 10, 2012, 10:48:06 am »
So it is about accessing global variable with asm ?

I don't know what to do about this, except adding a compiler directive to disable all assembler and thus SSE on OSX. Any other idea ?
Conscience is the debugger of the mind

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #8 on: May 10, 2012, 12:30:31 pm »
So it is about accessing global variable with asm ?

I don't know what to do about this, except adding a compiler directive to disable all assembler and thus SSE on OSX. Any other idea ?
(i'm poor experienced with asm and really no experience with SSE) How about not use asm to compare UseSSE?

This was working well before 388
Code: [Select]
  {$ifdef CPUI386}
    if UseSSE then
    asm
      mov eax, v1
      movups xmm0, [eax]
      mov eax, v2
      movups xmm1, [eax]
      addps xmm0, xmm1

      mov eax,result
      movups [eax],xmm0
    end else
  {$endif}
Maybe compiler will optimise that simple comparison well and you will not loose any speed.
« Last Edit: May 10, 2012, 12:32:12 pm by Shebuka »

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #9 on: May 10, 2012, 02:44:27 pm »
Well I think it would be less optimized, and more complex cases, it can get quite mixed between asm and pascal. But you're right, if there is no other way, we can adapt the code that way. It's still better than no SSE at all.

I found something about a compiler option. Can you go package compiler options, in Other and in Custom options textbox add :

-Cg-

Does this fix the problem ?
Conscience is the debugger of the mind

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #10 on: May 10, 2012, 03:51:39 pm »
ASM PArt is ok, but now this:
Code: [Select]
10/05/12 15.49.12 [0x0-0x2f22f2].lazarus[58656] [TExternalToolList.Run] CmdLine="/Users/fbk/fpc/compiler/ppc386  -MObjFPC -Scgi -O3 -OoREGVAR -gs -gl -vewnhi -l -Fu/Developer/lazarus/lcl/units/i386-darwin/carbon -Fu/Developer/lazarus/lcl/units/i386-darwin -Fu/Developer/lazarus/components/lazutils/lib/i386-darwin -Fu/Developer/lazarus/packager/units/i386-darwin -Fu/Developer/lazarus/components/bgrabitmap/ -FU/Developer/lazarus/components/bgrabitmap/lib/i386-darwin/2.6.0/ -dL
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] CL -dLCLcarbon -Cg- bgrabitmappack.pas" WorkDir="/Developer/lazarus/components/bgrabitmap/"
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] Hint: Start of reading config file /etc/fpc.cfg
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] Hint: End of reading config file /etc/fpc.cfg
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] Free Pascal Compiler version 2.6.0 [2012/01/16] for i386
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] Copyright (c) 1993-2011 by Florian Klaempfl and others
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] Target OS: Darwin for i386
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] Compiling bgrabitmappac{standard input}:570:no instruction mnemonic suffix given and no register operands; can't size instruction
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] {standard input}:582:no instruction mnemonic suffix given and no register operands; can't size instruction
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] {standard input}:594:no instruction mnemonic suffix given and no register operands; can't size instruction
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] {standard input}:606:no instruction mnemonic suffix given and no register operands; can't size instruction
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] {standard input}:817:no instruction mnemonic suffix given and no register operands; can't size instruction
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] {standard input}:837:no instruction mnemonic suffix given and no register operands; can't size instruction
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] {standard input}:857:no instruction mnemonic suffix given and no register operands; can't size instruction
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] {standard input}:877:no instruction mnemonic suffix given and no register operands; can't size instruction
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] k.pas
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] Compiling bgrascene3d.pas
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] Compiling bgracolorint.pas
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] Assembling (pipe)
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] /Developer/lazarus/components/bgrabitmap/lib/i386-darwin/2.6.0/bgracolorint.s
10/05/12 15.49.13 [0x0-0x2f22f2].lazarus[58656] bgracolorint.pas(300) Fatal: There were 1 errors compiling module, stopping

p.s. output is from console because Messages window display only the last fatal error line and nothing more...
« Last Edit: May 10, 2012, 03:53:28 pm by Shebuka »

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #11 on: May 10, 2012, 07:25:39 pm »
I don't understand this.

Well, maybe without this compiler option, but by replacing
Code: [Select]
  cmp UseSSE, 0by :
Code: [Select]
  cmp byte ptr [UseSSE], 0
Does it work ?
Conscience is the debugger of the mind

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #12 on: May 11, 2012, 09:35:01 am »
No, same Generating PIC, but reference is not PIC-safe error.

Don't know if it's relevant, but when i click on the error, carret is moved on '0', not on 'UseSSE' (there are also some UseSSE3 with same error).

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #13 on: May 13, 2012, 12:00:36 pm »
Oh so maybe if you replace it by
Code: [Select]
push eax
xor eax,eax
cmp UseSSE, al
pop eax
?
Conscience is the debugger of the mind

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: BGRABitmap 5.7.1 won't compile on OS X
« Reply #14 on: May 14, 2012, 10:24:12 am »
No...
Code: [Select]
/Developer/lazarus/components/bgrabitmap/bgrasse.pas(132,15) Error: Generating PIC, but reference is not PIC-safe

i'v tried this also
Code: [Select]
  push eax
  mov UseSSE, al
  cmp al, 0
  pop eax
with same result... but error points to mov line, so it must be caused by UseSSE...

 

TinyPortal © 2005-2018