trevordevore / levure

Application development framework for LiveCode
MIT License
32 stars 14 forks source link

Investigating a failing OSX build - can anyone suggest strategies? #185

Closed rodneytamblyn closed 2 years ago

rodneytamblyn commented 2 years ago

Can anyone offer insights into how to investigate a build that is failing on launch?

I am building a Levure app for OSX.

I have reviewed the standalone settings for the levure standalone launcher stack for

I think I have included all the necessary inclusions, but I wonder if this is the potential cause of the issue.

When I build an OSX (beta) build, the process appears to complete successfully.

The build.log doesn't display any obvious exceptions and code signing completes fine.

I have included an entitlements file at at app/build files/Litebreeze.entitlements. Does the build log file include any statements to confirm the entitlements were applied (or can anyone provide insight on how to check this step is working correctly)? I've copied my entitlements below.

What happens

When I launch the standalone it gets as far as the splash screen and then throws spinning ball of death. It is dying when going from the splash stack to the main UI stack of the application. This has a few widgets in it like the browser, but these are all selected in the stack includes on the Levure launcher stack.

My entitlements (just the default entitlements from the Livecode documentation page at https://lessons.livecode.com/m/4071/l/1293515-entitlements-for-signed-and-notarized-apps) are:

<dict>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <true/>
    <key>com.apple.security.cs.allow-dyld-environment-variables</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
    <key>com.apple.security.cs.disable-executable-page-protection</key>
    <true/>
    <key>com.apple.security.device.audio-input</key>
    <true/>
    <key>com.apple.security.device.camera</key>
    <true/>
    <key>com.apple.security.personal-information.location</key>
    <true/>
    <key>com.apple.security.personal-information.addressbook</key>
    <true/>
    <key>com.apple.security.personal-information.photos-library</key>
    <true/>
    <key>com.apple.security.automation.apple-events</key>
    <true/>
 </dict> 
rodneytamblyn commented 2 years ago

Does anyone know where inclusions should appear in the bundle? I see both a MacOS and _MacOS - is this correct? (Update: Yes. I found why OSX package resources needs the _MacOS folder in comments at bottom of https://lessons.livecode.com/m/4603/l/685074-the-standalone-application-settings. (search "panos"))

Are some of the inclusions compiled into the executable? For example where would I find the ask and answer dialogs (which are stacks). They are listed as included in the standalone settings, so I thought I would be able to find these somewhere in the package content?

image

rodneytamblyn commented 2 years ago

Further testing confirms the standalone crashes when attempting "go stack" to go from the splash screen to the main application UI stack.

rodneytamblyn commented 2 years ago

Still unable to get the main stack to load.

I've now tried disabling all stack and backscripts, and reviewed attached behaviour scripts. But it is still happening. Next I am going to try removing widgets and see if that will fix it.

trevordevore commented 2 years ago

Hi @rodneytamblyn .

Does the build log file include any statements to confirm the entitlements were applied

No it does not. This thread seems to have some info on checking from the command line:

https://apple.stackexchange.com/questions/52675/how-do-i-find-out-what-entitlements-an-app-has

You don't mention which version of LC you are building with. You do mention macOS beta, however. Do you mean the macOS Apple (experimental) standalone setting? If so, the Levure Packager hasn't been update to support that build platform.

You can see if that is the problem by doing the following:

  1. Open levure/packager/packager.livecodescript in your text editor
  2. Change the definition for kStandaloneBuilderPlatforms on line 2 to the following:
constant kStandaloneBuilderPlatforms = "MacOSX x86-32,MacOSX x86-64,MacOSX arm64,Windows,Windows x86-64,Linux,Linux x64,Linux armv6-hf,iOS,Android,Emscripten"
  1. Save your changes.
  2. Restart LiveCode and try building your standalone again.
rodneytamblyn commented 2 years ago

Hi Trevor,

Thanks for comments. I'm on Monterey 12.5 and LC 9.6.4. On my list to also test earlier LC release to eliminate that variable.

Re entitlements, thanks for confirming that. I think it would be good to include a statement in the build log to at least confirm that the entitlements file was found (e.g. "Found and applied entitlements file: "). If you agree, I will file that as a separate issue/feature-request.

I still think the most likely explanation is something to do with inclusions, so will try removing all widgets from stack causing crash and see if I can get it to open in standalone.

Rod

rodneytamblyn commented 2 years ago

This is the same issue I am having: https://forums.livecode.com/viewtopic.php?f=19&t=34619

Confirmed: after deleting the browser widget the standalone doesn't crash and I am able to go to the main UX stack window. The issue seems to be related to the entitlements either being incorrect, or not being applied. I will investigate further...

rodneytamblyn commented 2 years ago

Hi Trevor,

Trying to understand why the entitlements file is not being applied. I have configured my app.yaml as below. Entitlements are as above. Can you see what I'm doing wrong?

Rod

My app.yaml file

name: Litebreeze
...
build profiles:
  all profiles:
    packager callbacks stackfile:
    certificates:
      macos:
        name: "OceanBrowser Ltd (xxxxxxxxx)"
      macos resources:
        - filename: ../build files/Litebreeze.entitlements

image

rodneytamblyn commented 2 years ago

Resolved. I had not placed the macos resources YAML statement in the right place in the app.yml. Now working correctly. I also stepped through the packager code to see how the application signing process works. I wonder whether it should be a requirement to have a correctly configured entitlements file for OSX, then the packager could warn users to do this. Would there be many (any?) OSX signed application builds that would want to omit this step?

Rod