3

I am getting an error when running my app on macos 10.15.4

The error is:

dyld: Library not loaded: @rpath/Frameworks/libQt5Solutions_SingleApplication-head.1.dylib
Referenced from: /Users/raulsanchez/Documents/workspace/Myapp.app/Contents/MacOS/Myapp
Reason: no suitable image found.  Did find:
/Users/raulsanchez/Documents/workspace/Myapp.app/Contents/MacOS/../Frameworks/libQt5Solutions_SingleApplication-head.1.dylib: code signing blocked mmap() of '/Users/raulsanchez/Documents/workspace/Myapp.app/Contents/MacOS/../Frameworks/libQt5Solutions_SingleApplication-head.1.dylib'
/Users/raulsanchez/Documents/workspace/Myapp.app/Contents/MacOS/../Frameworks/libQt5Solutions_SingleApplication-head.1.dylib: stat() failed with errno=1
zsh: abort      

I have deleted and reinstalled my certificate but still same error.

Any ideas please?

Thanks in advance

1 Answer 1

2

I experienced the similar issue after Xcode has been updated (in my case to 11.4.1) Nothing helped: neither re-creating certificates nor updating entitlements nor rebooting nor changing trust level for certificates nor upgrading Xcode.

I solved it temporary by downgrading my Xcode (Xcode_11.3.1)

I noticed that libraries that fails to be loaded has no LC_VERSION_MIN_MACOSX/sdk. It is set 'n/a'. Then I found this issue https://bugreports.qt.io/browse/QTBUG-83100 It helped!

In a few words:

otool -l myApp.app/Contents/Frameworks/libMyVnaApi_x64.0.dylib  | grep -B1 -A3 LC_VERSION_MIN_MACOSX
Load command 8
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.13
      sdk n/a

If there is no sdk then hardened runtime library validation fails.

After I added linker flag and rebuilt

QMAKE_LFLAGS += -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

Issue is solved: sdk is set properly. Signed hardened application works

   otool -l myApp.app/Contents/Frameworks/libMyVnaApi_x64.0.dylib  | grep -B1 -A3 LC_VERSION_MIN_MACOSX
Load command 8
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.13
      sdk 10.15.4
3
  • I was able to fix the issue adding entitlements but I will test your solution. It seems safer! Thanks
    – RuLoViC
    Commented May 11, 2020 at 12:35
  • Could you please share which entitlement helped you?
    – Mnt DXM
    Commented May 11, 2020 at 18:31
  • 1
    com.apple.security.cs.disable-library-validation. But in any case maybe your solution is better since as my understanding entitlements can lead into security problems
    – RuLoViC
    Commented May 11, 2020 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.