Uploaded image for project: 'Swift'
  1. Swift
  2. SR-14139

Undefined symbols for architecture x86_64

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: swift-format, SwiftSyntax
    • Labels:
      None
    • Environment:

      I am running this on 11.1 MacOS Big Sur with 12.0 XCode.

      Description

      Hi!

       

      I hope this is not a silly question; how do you use this library inside another Swift library? I am maintaining a GraphQL client library that heavily relies on code generation. Since the code is mainly unformatted, I'd like to format it before writing it out on a disk.

       

      I am trying to use `swift-format` (which relies on `swift-syntax`) and I am getting a strange error when using the library.

       

      ```

      Undefined symbols for architecture x86_64:
      "_$s11SwiftFormat0A9FormatterC13configuration16diagnosticEngineAC0aB13Configuration0G0V_0A6Syntax010DiagnosticF0CSgtcfC", referenced from:
      _$sSS19SwiftGraphQLCodegenE6formatSSyKF in String+Format.swift.o
      "_$s11SwiftFormat0A9FormatterC6format6source15assumingFileURL2toySS_10Foundation0H0VSgxztKs16TextOutputStreamRzlF", referenced from:
      _$sSS19SwiftGraphQLCodegenE6formatSSyKF in String+Format.swift.o
      "_$s11SwiftFormat0A9FormatterCMa", referenced from:
      _$sSS19SwiftGraphQLCodegenE6formatSSyKF in String+Format.swift.o
      "_$s24SwiftFormatConfiguration0C0VACycfC", referenced from:
      _$sSS19SwiftGraphQLCodegenE6formatSSyKF in String+Format.swift.o
      ld: symbol(s) not found for architecture x86_64

      ```

      I've seen the note in swift-syntax's README that talks about linking the library, and I've found a similar issue (and its [fix|https://github.com/SwiftDocOrg/homebrew-formulae/commit/af4cd47]), but the other libraries in the examples section in that README don't rely on any such script.

       

      Can you help me? What am I doing wrong? What should I look at to understand the error message?

       

      Thank you!

       

      > I know this is not ideal, but you can find all the code in [SwiftGraphQL|https://github.com/maticzav/swift-graphql/tree/next]'s repo.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            maticzav Matic Zavadlal
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: