[Done] Import asm errno - linker wrong version (purebasic.o?)

Post bugreports for the Mac OSX version here
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

[Done] Import asm errno - linker wrong version (purebasic.o?)

Post by mk-soft »

Purebasic Linker Error:
ld: warning: object file (/Users/Michael/Applications/Purebasic-v6.00-X64/PureBasic.app/Contents/Resources/compilers/debugger.a(Debugger.o)) was built for newer macOS version (10.10) than being linked (10.7)
ld: warning: object file (VectorDrawing.a(VectorDrawing.o)) was built for newer macOS version (10.10) than being linked (10.7)
ld: warning: object file (Event.a(Init.o)) was built for newer macOS version (10.10) than being linked (10.7)
ld: warning: object file (Cocoa.a(Cocoa.o)) was built for newer macOS version (10.10) than being linked (10.7)
ld: warning: object file (Image.a(Image.o)) was built for newer macOS version (10.10) than being linked (10.7)
ld: warning: object file (Memory.a(Memory.o)) was built for newer macOS version (10.10) than being linked (10.7)
ld: warning: object file (Network.a(Network.o)) was built for newer macOS version (10.10) than being linked (10.7)
...
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Code:

Code: Select all

;-TOP
; By mk-soft, v1.01.1, 08.01.2023
; Not work with ASM (Bug version)

CompilerIf Not Defined(PB_Compiler_Backend, #PB_Constant)
  #PB_Backend_Asm = 0
  #PB_Backend_C = 1
  #PB_Compiler_Backend = 0
CompilerEndIf

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  Macro GetLastError()
    GetLastError_()
  EndMacro
CompilerElse
  CompilerIf #PB_Compiler_Backend = #PB_Backend_C
    Procedure GetLastError()
      !#include "errno.h"
      !extern int errno;
      Protected r1
      !v_r1=errno;
      ProcedureReturn r1
    EndProcedure
  CompilerElse
    ImportC ""
      errno
    EndImport
    Procedure GetLastError()
      Protected r1
      r1 = errno
      ProcedureReturn r1
    EndProcedure
  CompilerEndIf
CompilerEndIf

; ----

CompilerIf #PB_Compiler_IsMainFile
  
  err = GetLastError()
  Debug "LastError = " + GetLastError()
  
CompilerEndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Fred
Administrator
Administrator
Posts: 16581
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Import asm errno - linker wrong version (purebasic.o?)

Post by Fred »

On OSX you can't reference 64-bit label directly. Instead of PUSH qword [_errno], I tried LEA, qword [errno] without success. I will try by using a PStub like I did for some API function, but it's a lot of internal change.
Fred
Administrator
Administrator
Posts: 16581
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Import asm errno - linker wrong version (purebasic.o?)

Post by Fred »

Fixed.
Post Reply