vslavik / poedit

Translations editor for Mac, Windows and Unix
https://poedit.net
MIT License
1.8k stars 279 forks source link

Poedit 3.3 startup crash on macOS High Sierra 10.13.6 due to missing Swift runtime #800

Closed diogob003 closed 1 year ago

diogob003 commented 1 year ago

Main problem

Crash on startup

Causes

Probably missing Swift libraries

Crash log

Process:               Poedit [64194]
Path:                  /Applications/Poedit.app/Contents/MacOS/Poedit
Identifier:            net.poedit.Poedit
Version:               3.3.2 (6726)
Code Type:             X86-64 (Native)
Responsible:           Poedit [64194]

Date/Time:             2023-08-04 17:48:53.572 -0300
OS Version:            Mac OS X 10.13.6 (17G14042)

Time Awake Since Boot: 110000 seconds
Time Since Wake:       17000 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x1] Library missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /Applications/Poedit.app/Contents/MacOS/Poedit
  Reason: image not found

Binary Images:
       0x10a014000 -        0x10ad9bfef +net.poedit.Poedit (3.3.2 - 6726) <CC18F3F5-FF6E-3ACB-8467-B80D6F1D8D85> /Applications/Poedit.app/Contents/MacOS/Poedit
       0x10af8f000 -        0x10afd2ff7 +org.sparkle-project.Sparkle (1.22.0 - 1.22.0) <FE6CDCE9-E401-3469-BC9E-1322976E6FFB> /Applications/Poedit.app/Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle
       0x11a737000 -        0x11a781adf  dyld (551.5) <CB9BFB56-4511-36F1-A546-891FF770C01C> /usr/lib/dyld
    0x7fff26b9a000 -     0x7fff279f8fff  com.apple.AppKit (6.9 - 1561.61.100) <4E6EA3FA-8C2C-3B21-BFF9-6F8C458B7BE1> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
...

Fix attempt

Copy Swift libs from Xcode.app to Poedit.app

cp /Applications/Xcode.app/Contents/Frameworks/*swift* /Applications/Poedit.app/Contents/Frameworks

Attempting to fix the problem did not work

Fix attempt crash log

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x4] Symbol missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Symbol not found: _$sBOWV
  Referenced from: /Applications/Poedit.app/Contents/MacOS/Poedit
  Expected in: /Applications/Poedit.app/Contents/MacOS/../Frameworks/libswiftCore.dylib
 in /Applications/Poedit.app/Contents/MacOS/Poedit

Aditional info

vslavik commented 1 year ago

This must be accidentally being pulled via Sentry SDK... I'll investigate and see if there's a reasonably easy fix. If not, I'll just bump the minimum version to 10.14 — that it took 3 months since release for anybody to complain implies it's OK to do.

As you observed, this is new in Poedit 3.3, so the fix is to downgrade for now.

vslavik commented 1 year ago

@diogob003 Can you please test if this build works? https://download.poedit.net/Poedit-3.3.2-high_sierra_test.zip

diogob003 commented 1 year ago

It's not working. Sentry is linking with libraries that is not present on the Poedit.app bundle. Running app:

➜  Poedit.app ./Contents/MacOS/Poedit
dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: /Applications/Poedit.app/Contents/Frameworks/Sentry.framework/Versions/A/Sentry
  Reason: image not found
[1]    9421 abort      ./Contents/MacOS/Poedit

Sentry linked libs:

➜  Poedit.app otool -L Contents/Frameworks/Sentry.framework/Sentry
Contents/Frameworks/Sentry.framework/Sentry:
    @rpath/Sentry.framework/Versions/A/Sentry (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1953.255.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2299.30.112)
    /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData (compatibility version 1.0.0, current version 1244.6.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0)
    /System/Library/Frameworks/MetricKit.framework/Versions/A/MetricKit (compatibility version 1.0.0, current version 1.0.0, weak)
    /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 1241.60.3)
    /usr/lib/swift/libswiftMetricKit.dylib (compatibility version 1.0.0, current version 6.0.0, weak)
    @rpath/libswiftAppKit.dylib (compatibility version 1.0.0, current version 111.0.0, weak)
    @rpath/libswiftCore.dylib (compatibility version 1.0.0, current version 5.7.1)
    @rpath/libswiftCoreFoundation.dylib (compatibility version 1.0.0, current version 120.100.0, weak)
    @rpath/libswiftCoreImage.dylib (compatibility version 1.0.0, current version 2.0.0, weak)
    @rpath/libswiftDarwin.dylib (compatibility version 1.0.0, current version 0.0.0, weak)
    @rpath/libswiftDispatch.dylib (compatibility version 1.0.0, current version 17.0.0, weak)
    @rpath/libswiftIOKit.dylib (compatibility version 1.0.0, current version 1.0.0, weak)
    @rpath/libswiftMetal.dylib (compatibility version 1.0.0, current version 306.3.4, weak)
    @rpath/libswiftObjectiveC.dylib (compatibility version 1.0.0, current version 6.0.0, weak)
    @rpath/libswiftQuartzCore.dylib (compatibility version 1.0.0, current version 3.0.0, weak)
    @rpath/libswiftXPC.dylib (compatibility version 1.0.0, current version 6.0.0, weak)
    @rpath/libswiftos.dylib (compatibility version 1.0.0, current version 1034.0.0, weak)
    @rpath/libswiftCoreGraphics.dylib (compatibility version 1.0.0, current version 120.100.0, weak)
    @rpath/libswiftFoundation.dylib (compatibility version 1.0.0, current version 1.0.0)

Searching for swift files in Poedit.app returns nothing

➜  Poedit.app find . -iname "*swift*" -print

Is it working on other macOS versions? I don't know this Framework. Did you try one of the recommended package managers https://docs.sentry.io/platforms/apple/guides/macos/install/ to get Sentry dependencies? Remember to set ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to YES on Xcode as the docs request. See: getsentry/sentry-react-native#11

vslavik commented 1 year ago

Thanks for testing!

Sentry is linking with libraries that is not present on the Poedit.app bundle.

I am aware, yes. But Sentry.framework is weak-linked and its symbols are not used when running on 10.13. My expectation was that failure to load the framework by ld would be equivalent to it missing completely. Apparently, it is not so.

Is it working on other macOS versions?

The Swift runtime is included as part of the OS since macOS 10.14.4. It is missing on 10.13 only.

I don't know this Framework. Did you try one of the recommended package managers https://docs.sentry.io/platforms/apple/guides/macos/install/ to get Sentry dependencies?

Yes, I can read too... That's the cause of the problem and what I was attempting in the test build was to avoid hard linking.

Remember to set ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to YES on Xcode as the docs request. See: getsentry/sentry-react-native#11

The documentation does not say that. You're repeating a 6 years old comment on some unrelated project...

Six years ago, it made sense to embed Swift runtime. But in 2023 I explicitly don't want to do that, because it would increase the already-large download size by another ~8 MB (and more for the on-disk unpacked app size), for the benefit of only 10.13 High Sierra. That's less than 0.4% of Poedit's Mac users these days...

So it seems that — as much as I don't like it — the time has come to bump the minimum required version to 10.14. In theory you should be able to run Poedit 3.3 after installing Swift 5 Runtime Support for Command Line Tools but that's not something that could be "officially" supported.