Skip to content

SourceKit-LSP appears to interfere with SwiftPM build plugins #676

Closed
@adam-fowler

Description

@adam-fowler

It appears that SourceKit-LSP is interfering in the build process when building a project that includes a build plugin. While running VS Code on a package that include a build plugin the linker fails to find the generated code. Sometimes subsequent builds are successful but not always. The same project compiles fine if the sourcekit-lsp process is killed.

I used VSCode with Swift extension installed to reproduce this issue. I have a sample project which you can use to reproduce.
Steps to reproduce:

  1. git clone https://github.com/adam-fowler/soto-codegenerator-plugin-test
  2. cd soto-codegenerator-plugin-test
  3. code .
  4. wait for project to load in VS Code
  5. swift build (either in VS Code or from the command line)

This will produce the following link errors

Undefined symbols for architecture arm64:
  "_$s7SotoSNS0B0V0A4Core10AWSServiceAAMc", referenced from:
      _$s7SotoSNS0B0VAC0A4Core10AWSServiceAAWl in SNSTest.swift.o
  "_$s7SotoSNS0B0V11createTopic_6logger2onAC06CreateD8ResponseVAC0gD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKF", referenced from:
      _$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
     (maybe you meant: _$s7SotoSNS0B0V11createTopic_6logger2onAC06CreateD8ResponseVAC0gD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKFfA0_)
  "_$s7SotoSNS0B0V11createTopic_6logger2onAC06CreateD8ResponseVAC0gD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKFTu", referenced from:
      _$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
  "_$s7SotoSNS0B0V11deleteTopic_6logger2onyAC06DeleteD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKF", referenced from:
      _$s7SNSTest3RunV4mainyyYaKFZTY2_ in SNSTest.swift.o
     (maybe you meant: _$s7SotoSNS0B0V11deleteTopic_6logger2onyAC06DeleteD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKFfA0_)
  "_$s7SotoSNS0B0V11deleteTopic_6logger2onyAC06DeleteD5InputV_7Logging6LoggerV7NIOCore9EventLoop_pSgtYaKFTu", referenced from:
      _$s7SNSTest3RunV4mainyyYaKFZTY2_ in SNSTest.swift.o
  "_$s7SotoSNS0B0V16CreateTopicInputV10attributes20dataProtectionPolicy4name4tagsAESDyS2SGSg_SSSgSSSayAC3TagVGSgtcfC", referenced from:
      _$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
  "_$s7SotoSNS0B0V16DeleteTopicInputV8topicArnAESS_tcfC", referenced from:
      _$s7SNSTest3RunV4mainyyYaKFZTY2_ in SNSTest.swift.o
  "_$s7SotoSNS0B0V6client6region9partition8endpoint7timeout19byteBufferAllocator7optionsAC0A4Core9AWSClientC_AK6RegionVSgAK12AWSPartitionVSSSg7NIOCore10TimeAmountVSgAT04ByteiJ0VAK16AWSServiceConfigC7OptionsVtcfC", referenced from:
      _$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
  "_$s7SotoSNS0B0VN", referenced from:
      _$s7SNSTest3RunV4mainyyYaKFZTY0_ in SNSTest.swift.o
      _$s7SotoSNS0B0VAC0A4Core10AWSServiceAAWl in SNSTest.swift.o
ld: symbol(s) not found for architecture arm64
```_

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions