Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-9946] sourcekit-lsp doesn't link statically with a Toolchain #52349

Open
krzyzanowskim opened this issue Feb 17, 2019 · 2 comments
Open

[SR-9946] sourcekit-lsp doesn't link statically with a Toolchain #52349

krzyzanowskim opened this issue Feb 17, 2019 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@krzyzanowskim
Copy link
Contributor

Previous ID SR-9946
Radar rdar://47947049
Original Reporter @krzyzanowskim
Type Bug
Environment

macOS 10.14.3 (18D109)

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug
Assignee @mikeash
Priority Medium

md5: cac680cfa4b5f549f8d9dce48990b59f

Issue Description:

1. Install Toolchain: https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a/swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a-osx.pkg

2. Use sourcekit-lsp for the Toolchain https://github.com/apple/sourcekit-lsp/tree/swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a

3. Build using Toolchain, with static linking option enabled:

$ swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a-osx/usr/bin/swift-build --package-path swift-source/sourcekit-lsp/ --static-swift-stdlib 

Undefined symbols for architecture x86_64:
  "__objc_realizeClassFromSwift", referenced from:
      __ZL30_swift_updateClassMetadataImplPN5swift19TargetClassMetadataINS_9InProcessEEENS_16ClassLayoutFlagsEmPKPKNS_10TypeLayoutEPmb in libswiftCore.a(Metadata.cpp.o)
  "_objc_setHook_getClass", referenced from:
      __ZL19installGetClassHookv in libswiftCore.a(MetadataLookup.cpp.o)
ld: symbol(s) not found for architecture x86_64
: error: link command failed with exit code 1 (use -v to see invocation)

It's worth to mention that it compiles just fine without "--static-swift-stdlib". Also it worked fine with some Toolchains (not all)
option.

@benlangmuir
Copy link
Member

Reproduced with snapshot 2019-02-14-a on macOS 10.13.6. This is not specific to sourcekit-lsp. You can reproduce with a fresh executable package:

$ export TOOLCHAINS=org.swift.50201902141a
$ swift package init --type executable
$ swift build --static-swift-stdlib

@belkadan
Copy link
Contributor

Swift on macOS isn't going to support static linking at all, so we'll need a different answer for this.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants