* * *

Author Topic: Errors when trying to build Lazarus on High Sierra  (Read 3133 times)

hayanninja

  • New member
  • *
  • Posts: 45
Errors when trying to build Lazarus on High Sierra
« on: December 30, 2017, 12:44:23 am »
(For the record, if I remember correctly I had the same issues on vanilla Sierra too.)

Pre-built Lazarus install works, it's only when I try to rebuild it there are issues. However, I need to be able to rebuild in order to install design-time packages.

Setup:
- Late-2012 model Mac Mini
- Mac OS X High Sierra (the machine was reformatted with Sierra installed, then upgraded from there via App Store)
- XCode 9.2
- Lazarus 1.8.0
- FPC 3.0.4
- I also have access to Windows (10 Pro) and Linux (Ubuntu 16.04), so cross-compiling is an option if this might be more feasible

If I try to build with any widgetset with an i386 target, I get "Cannot find Interfaces unit used by Lazarus, incompatible ppu=[path to "interfaces.ppu" for relevant framework].

If I try to do the same with an x86_64 target, I instead get errors in CocoaGDIObjects.pas relating to identifiers not being found, specifically several that being with ATSU (eg. ATSUGetUnjustifiedBounds, ATSUCreateTextLayout, etc).

Once again, this happens no matter which widgetset I use.

I'm able to rebuild without issue on Windows (obviously, using the Win32/64 widgetset).

I've only tried so far to rebuild using the built-in "Build Lazarus" function; I haven't tried downloading the source code and building from scratch using only FPC, I'll try that if anyone thinks it'll be worthwhile.

Just to clarify, this happens regardless of whether it's an out-of-the-box build, or while trying to rebuild with extra packages installed.

Also, to clarify this as well - it is nothing to do with my own code. This will literally happen on a fresh install of Lazarus when I try to use the "Build Lazarus" option, no additional packages. (Saying this because while googling, I found another post where someone was mentioning a similar issue and one person insisted it must be a problem with the user's code.)

EDIT: Although I'd rather not, I am open to downgrading to an older version of Mac OS X if need be. I only use my Mac for development / testing and occasionally for some basic internet usage when I can't be bothered getting my Windows laptop out, so running an older version of the OS isn't a problem to me. I would need to know which one is best to use, though.
« Last Edit: December 30, 2017, 12:59:05 am by hayanninja »

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Errors when trying to build Lazarus on High Sierra
« Reply #1 on: December 30, 2017, 01:00:10 am »
If I try to build with any widgetset with an i386 target, I get "Cannot find Interfaces unit used by Lazarus, incompatible ppu=[path to "interfaces.ppu" for relevant framework].

If I try to do the same with an x86_64 target, I instead get errors in CocoaGDIObjects.pas relating to identifiers not being found, specifically several that being with ATSU (eg. ATSUGetUnjustifiedBounds, ATSUCreateTextLayout, etc).

On macOS, you should only build with Carbon, which is 32-bit only (ppc386 compiler).

hayanninja

  • New member
  • *
  • Posts: 45
Re: Errors when trying to build Lazarus on High Sierra
« Reply #2 on: December 30, 2017, 01:02:34 am »
If I try to build with any widgetset with an i386 target, I get "Cannot find Interfaces unit used by Lazarus, incompatible ppu=[path to "interfaces.ppu" for relevant framework].

If I try to do the same with an x86_64 target, I instead get errors in CocoaGDIObjects.pas relating to identifiers not being found, specifically several that being with ATSU (eg. ATSUGetUnjustifiedBounds, ATSUCreateTextLayout, etc).

On macOS, you should only build with Carbon, which is 32-bit only (ppc386 compiler).

Carbon / i386 gives the "Cannot find Interfaces unit..." error.

The source file for it is there, and the PPU (and O) file gets created, but the compiler output complains that it's incompatible. I've tried messing a bit with the defines that I can see in the Interfaces.pas code, but it makes no difference.

That aside, if I'm not mistaken, High Sierra is intended to be the last OSX release to support 32-bit apps, no? So long-term, a solution for 64-bit is needed anyway; but solving just for 32-bit in the meantime is fine. With that being said, I should also ask - if I'm building for 32-bit on Mac OS X, is there anything I need to be aware of when trying to compile my code for other platforms? In the short-term I only need to also support Windows (and this can be compiled on Windows, I don't need to be able to cross-compile; also, doesn't really matter if it's 32-bit or 64-bit there) but longer-term I want to be able to support Android too, and possibly also Linux and iOS. (The last one is a very distant future thing for now, as I don't currently have any iOS device.)
« Last Edit: December 30, 2017, 01:19:35 am by hayanninja »

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Errors when trying to build Lazarus on High Sierra
« Reply #3 on: December 30, 2017, 01:19:23 am »
Carbon / i386 gives the "Cannot find Interfaces unit..." error.

You're trying to build Laz with 64-bit Carbon, which does not exist. Try this from command line:

make LCL_PLATFORM=carbon CPU_TARGET=i386

I think this is related to change in FPC, where default compiler now builds for 64-bit. Probably wasn't tested on macOS.

That aside, if I'm not mistaken, High Sierra is intended to be the last OSX release to support 32-bit apps, no? So long-term, a solution for 64-bit is needed anyway; but solving just for 32-bit in the meantime is fine.

Not quite right. Here's what Apple actually said:

https://developer.apple.com/news/?id=06282017a

So we don't know for sure if Carbon will be part of next version of macOS. What we do know for sure is that in a few days the Mac App Store will have 64-bit requirement.

hayanninja

  • New member
  • *
  • Posts: 45
Re: Errors when trying to build Lazarus on High Sierra
« Reply #4 on: December 30, 2017, 01:28:20 am »
Carbon / i386 gives the "Cannot find Interfaces unit..." error.

You're trying to build Laz with 64-bit Carbon, which does not exist. Try this from command line:

make LCL_PLATFORM=carbon CPU_TARGET=i386

I think this is related to change in FPC, where default compiler now builds for 64-bit. Probably wasn't tested on macOS.

This itself succeeds (I'm assuming I do this from the "lcl" subdir of Lazarus dir?), but makes no difference when I try to build Lazarus again afterwards. Lazarus seems to ignore the output from this and try to rebuild the whole LCL again anyway, thus once again generating the invalid Interfaces.ppu file. This happens regardless of what I set the cleanup option to.

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Errors when trying to build Lazarus on High Sierra
« Reply #5 on: December 30, 2017, 01:30:20 am »
This itself succeeds (I'm assuming I do this from the "lcl" subdir of Lazarus dir?), but makes no difference when I try to build Lazarus again afterwards. Lazarus seems to ignore the output from this and try to rebuild the whole LCL again anyway, thus once again generating the invalid Interfaces.ppu file. This happens regardless of what I set the cleanup option to.

No, that would only build LCL. Run make from the main Laz folder where lazarus executable is. That's what you're trying to rebuild.

hayanninja

  • New member
  • *
  • Posts: 45
Re: Errors when trying to build Lazarus on High Sierra
« Reply #6 on: December 30, 2017, 01:54:32 am »
This worked and made a working build of Lazarus. However, when I try to install a package (which involves Lazarus rebuilding itself), this still fails. Any way around this? (I did try simply rebuilding via command-line after the failed build attempt within Lazarus, but this just built a clean copy without the new package.)

If it helps, the specific package I'm trying to install is Graphics32. There's one function that gives an error when trying to compile, that "GetDesktopColor" is an unknown identifier, but the control that contains this is not nessecary for me so I simply dummied out that line; with that change, Graphics32 itself compiles perfectly fine.

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Errors when trying to build Lazarus on High Sierra
« Reply #7 on: December 30, 2017, 01:58:41 am »
This worked and made a working build of Lazarus. However, when I try to install a package (which involves Lazarus rebuilding itself), this still fails. Any way around this?

I've only just looked at Laz for the first time since last summer, so give me a bit of time to investigate this.

In the meantime, under Tools | Configure, try setting the Target CPU to i386 the same as what you specified in make. That way Laz won't default to 64-bit compiler (I'm guessing). Like I said, I doubt if Laz 1.8 was tested much with FPC 3.0.4.

hayanninja

  • New member
  • *
  • Posts: 45
Re: Errors when trying to build Lazarus on High Sierra
« Reply #8 on: December 30, 2017, 02:10:38 am »
Do you mean Tools | Options? Or am I looking in the wrong place altogether? I've looked through it several times and can't seem to see any obvious place that target settings would be.

If you mean as in Tools | Configure Build Lazarus, I have already set widgettype "carbon", target OS "Darwin" and target CPU "i386" here.

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Errors when trying to build Lazarus on High Sierra
« Reply #9 on: December 30, 2017, 02:50:35 am »
Do you mean Tools | Options? Or am I looking in the wrong place altogether? I've looked through it several times and can't seem to see any obvious place that target settings would be.

If you mean as in Tools | Configure Build Lazarus, I have already set widgettype "carbon", target OS "Darwin" and target CPU "i386" here.

Hmm, no problem here rebuilding Laz with Carbon widgetset after adding a package.

Make sure you have the 32-bit compiler specified in Tools | Options: /usr/local/bin/ppc386

You may have borked something trying to compile for different widgetsets. Maybe run the uninstall.sh script and also delete the hidden ~/.lazarus folder and reinstall Laz.

hayanninja

  • New member
  • *
  • Posts: 45
Re: Errors when trying to build Lazarus on High Sierra
« Reply #10 on: December 30, 2017, 03:55:36 am »
Quote
Make sure you have the 32-bit compiler specified in Tools | Options: /usr/local/bin/ppc386

This is what I was missing. Thanks! :)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus