Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

dyld: Library not loaded: @rpath/lib_InternalSwiftSyntaxParser.dylib #3

Closed
bonyadmitr opened this issue May 15, 2020 · 6 comments
Closed

Comments

@bonyadmitr
Copy link

bonyadmitr commented May 15, 2020

Added SwiftSyntaxHighlighter using SPM in new macOS project and got error:

dyld: Library not loaded: @rpath/lib_InternalSwiftSyntaxParser.dylib
  Referenced from: {USER_FOLDER}/Library/Developer/Xcode/DerivedData/SwiftSyntaxMac-dcedkjjsloqegmatufrxjfbzzxub/Build/Products/Debug/SwiftSyntaxMac.app/Contents/MacOS/SwiftSyntaxMac
  Reason: image not found

Also found similar problems in other projects:
realm/SwiftLint#3105
uber/mockolo#108

Couldn't find solution.

Xcode Version 11.4.1 (11E503a)

@bonyadmitr
Copy link
Author

@mattt
Copy link
Member

mattt commented May 20, 2020

Added SwiftSyntaxHighlighter using SPM in new macOS project and got error:

When do you get this error? Is it when you try building and running your package executable with Xcode?

@bonyadmitr
Copy link
Author

Added SwiftSyntaxHighlighter using SPM in new macOS project and got error:

When do you get this error? Is it when you try building and running your package executable with Xcode?

yes, on running with Xcode.

@mattt
Copy link
Member

mattt commented May 20, 2020

@bonyadmitr Thanks for confirming. This looks like the same issue as SwiftDocOrg/SwiftSemantics#2:

Until a better solution is provided upstream, my suggestion would be to run swift package generate-xcodeproj to generate an Xcode project and then xed <#Package#>.xcodeproj to open the generated project directly.

@bonyadmitr
Copy link
Author

bonyadmitr commented May 20, 2020

@bonyadmitr Thanks for confirming. This looks like the same issue as SwiftDocOrg/SwiftSemantics#2:

Until a better solution is provided upstream, my suggestion would be to run swift package generate-xcodeproj to generate an Xcode project and then xed <#Package#>.xcodeproj to open the generated project directly.

yea, seems the same.

maybe it should be fixed by doc link:
https://github.com/apple/swift-syntax#embedding-swiftsyntax-in-an-application

i tried it but couldn't build it yourself from the Swift repository, . i got build-parser-lib script error.

and thanks for answer!

@mattt
Copy link
Member

mattt commented May 4, 2021

I was able to get this working in Xcode 12.5 using the latest OSS Toolchain. I just updated the README with details about how to do this with 72f1496.

@mattt mattt closed this as completed May 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants