Forum > macOS / Mac OS X

ProjectXC

(1/2) > >>

Frank:
Hi All,
I have 2 Delphi 10.2 projects I am converting to Freepascal. Both have made the trip from FMX -> VCL -> LCL & compile/run on macOS 10.12.6 (32bit/carbon). To make signing them easier I have used ProjectXC to re-compile them. One works great... The other which uses the "Printers" unit, Xcode fails while running the FPC script.

The Error (in part)  :
   "Undefined symbols for architecture i386:", "
   "_PMPaperGetName", referenced from:
      _OSPRINTERS$_$TCARBONPRINTER_$__$$_BEGINENUMPAPERS$TSTRINGS in osprinters.o"
  "ld: symbol(s) not found for architecture i386"

Lazarus IDE (svn 1.9) gives no such error...

What am I missing? Any ideas?
Frank 

Phil:

--- Quote from: Frank on January 02, 2018, 10:43:55 pm ---The Error (in part)  :
   "Undefined symbols for architecture i386:", "
   "_PMPaperGetName", referenced from:
      _OSPRINTERS$_$TCARBONPRINTER_$__$$_BEGINENUMPAPERS$TSTRINGS in osprinters.o"
  "ld: symbol(s) not found for architecture i386"

--- End quote ---

This is a rather obscure bug in Lazarus. _PMPaperGetName and _PMSetResolution are deprecated in 10.10 but are used by Lazarus Carbon and Cocoa widgetset code (osprinter.pp). Try setting the Deployment Target to 10.9 instead of 10.10 or higher in Xcode. This will "unhide" those deprecated symbols. I believe Lazarus sets the target to 10.4 or something (bad idea, in my opinion) so you don't see the problem in the Laz IDE.

In general, I would never target less than 10.10, but for testing a Laz app in Xcode you'll have to reduce the target to work around this bug. (Note that according to netmarketshare.com, about 95% of Mac users are on 10.10 or later - and I would guess that the remaining 5% are probably too lazy to upgrade, meaning you probably don't want them.)

Frank:
@Phil : Brilliant !
           
I wouldn't have discovered that in years...
Resetting to 10.6 (lowest my Xcode would allow) allowed it to compile it & run.

Now to find a way to reset to 10.10...

Thank you Phil

esvignolo:
Hi Phil, i have the same problem, but in lazarus, do you know how i can change this in a lazarus project?

Thanks!


--- Quote from: Phil on January 02, 2018, 11:17:56 pm ---
--- Quote from: Frank on January 02, 2018, 10:43:55 pm ---The Error (in part)  :
   "Undefined symbols for architecture i386:", "
   "_PMPaperGetName", referenced from:
      _OSPRINTERS$_$TCARBONPRINTER_$__$$_BEGINENUMPAPERS$TSTRINGS in osprinters.o"
  "ld: symbol(s) not found for architecture i386"

--- End quote ---

This is a rather obscure bug in Lazarus. _PMPaperGetName and _PMSetResolution are deprecated in 10.10 but are used by Lazarus Carbon and Cocoa widgetset code (osprinter.pp). Try setting the Deployment Target to 10.9 instead of 10.10 or higher in Xcode. This will "unhide" those deprecated symbols. I believe Lazarus sets the target to 10.4 or something (bad idea, in my opinion) so you don't see the problem in the Laz IDE.

In general, I would never target less than 10.10, but for testing a Laz app in Xcode you'll have to reduce the target to work around this bug. (Note that according to netmarketshare.com, about 95% of Mac users are on 10.10 or later - and I would guess that the remaining 5% are probably too lazy to upgrade, meaning you probably don't want them.)

--- End quote ---

Phil:

--- Quote from: esvignolo on February 09, 2018, 05:32:59 pm ---Hi Phil, i have the same problem, but in lazarus, do you know how i can change this in a lazarus project?

--- End quote ---

Post a small project that illustrates the problem.

Navigation

[0] Message Index

[#] Next page

Go to full version