swiftlang / swiftlang/swift-syntax
Installing swift-syntax with `cmake --install` fails
- Dominant language
- Swift
- Stars
- 3.7k
- Forks
- 553
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 16
Description
### Description
In the interest of establishing swift-syntax as an ordinary dependency in a project, I would like to be able to `install` swift-syntax using CMake so that it can be later found like any other library dependency.
It does not look like the install target for swift-syntax is well-formed.
```
% cmake --install . --prefix ../../.deps
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/lib_SwiftLibraryPluginProviderCShims.a
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive library: ../../.deps/lib/lib_SwiftLibraryPluginProviderCShims.a the table of contents is empty (no object file members in the library define global symbols)
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/lib_SwiftSyntaxCShims.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftBasicFormat.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftSyntax.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftDiagnostics.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftLexicalLookup.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftLibraryPluginProvider.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftParser.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftParserDiagnostics.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftRefactor.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftOperators.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftIfConfig.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftSyntaxBuilder.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftSyntaxMacros.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftSyntaxMacroExpansion.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftCompilerPluginMessageHandling.a
-- Installing: /Users/me/code/project/extern/swift-syntax/build/../../.deps/lib/swift/host/libSwiftIDEUtils.a
CMake Error at Sources/SwiftCompilerPlugin/cmake_install.cmake:41 (file):
file INSTALL cannot find
"/Users/me/code/project/extern/swift-syntax/build/lib/swift/host/libSwiftCompilerPlugin.a":
No such file or directory.
Call Stack (most recent call first):
Sources/cmake_install.cmake:127 (include)
cmake_install.cmake:42 (include)
```
### Steps to Reproduce
1. Successfully build swift-syntax using ordinary CMake idioms:
```
mkdir build && cd build
cmake .. -G Ninja
cmake --build .
```
2. Attempt to install swift-syntax somewhere using `cmake --install --prefix `
Contributor guide
Research direction
Reproduce with the listed CMake and Ninja commands, then inspect Sources/SwiftCompilerPlugin/cmake_install.cmake and the generated Sources/cmake_install.cmake around the missing libSwiftCompilerPlugin.a path. Trace why the ordinary build does not produce the file expected by installation, and verify that cmake --install --prefix completes successfully and installs the Swift libraries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, swift
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100