Recent

Author Topic: ProjectXC  (Read 11522 times)

Frank

  • Jr. Member
  • **
  • Posts: 69
ProjectXC
« on: January 02, 2018, 10:43:55 pm »
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

  • Hero Member
  • *****
  • Posts: 2737
Re: ProjectXC
« Reply #1 on: January 02, 2018, 11:17:56 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"

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

  • Jr. Member
  • **
  • Posts: 69
Re: ProjectXC
« Reply #2 on: January 02, 2018, 11:33:58 pm »
@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

  • Full Member
  • ***
  • Posts: 159
  • Using FPC in Windows, Linux, Macos
Re: ProjectXC
« Reply #3 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?

Thanks!

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"

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.)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: ProjectXC
« Reply #4 on: February 10, 2018, 06:00:36 pm »
Hi Phil, i have the same problem, but in lazarus, do you know how i can change this in a lazarus project?

Post a small project that illustrates the problem.

esvignolo

  • Full Member
  • ***
  • Posts: 159
  • Using FPC in Windows, Linux, Macos
Re: ProjectXC
« Reply #5 on: March 20, 2018, 12:52:39 pm »
Hi @Phil sorry the delay, i think the problem raise using lazreports in trunk (a trunk 3 months old. Is working fine)

I attach a sample.
« Last Edit: March 24, 2018, 06:05:58 pm by esvignolo »

esvignolo

  • Full Member
  • ***
  • Posts: 159
  • Using FPC in Windows, Linux, Macos
Re: ProjectXC
« Reply #6 on: March 20, 2018, 12:58:14 pm »
And a screenshot

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: ProjectXC
« Reply #7 on: March 27, 2018, 03:19:11 pm »
Hi @Phil sorry the delay, i think the problem raise using lazreports in trunk (a trunk 3 months old. Is working fine)

I attach a sample.

I can't reproduce. Your example links fine with Carbon from trunk Laz.

The bug reported by Frank above can be remedied by setting the deployment target. Use the FPC -WM switch to do that, eg, -WM10.10 to set it to 10.10.




xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: ProjectXC
« Reply #8 on: November 08, 2018, 04:08:42 pm »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018