SourceKit-LSP build error on Ubuntu Docker

trying to build SourceKit-LSP inside docker.

[88/186] Compiling Swift Module 'POSIX' (11 sources)
[89/186] Compiling IndexStoreDB_Support Logging-NonMac.cpp
[90/186] Compiling IndexStoreDB_Support Logging-Mac.mm
[91/186] Compiling IndexStoreDB_Support FilePathWatcher.cpp
[92/186] Compiling IndexStoreDB_Support Concurrency-Mac.cpp
[93/186] Compiling Swift Module 'Basic' (38 sources)
/sourcekit-lsp/.build/checkouts/indexstore-db/lib/Support/Concurrency-Mac.cpp:19:10: fatal error: 'Block.h' file not found
#include <Block.h>
         ^~~~~~~~~
1 error generated.
The command '/bin/sh -c swift build -Xcxx -I/usr/lib/swift' returned a non-zero code: 1

here is the Dockerfile used for building sourcekit-lsp

FROM satishbabariya/swift:swift-DEVELOPMENT-SNAPSHOT-2019-03-04-a

# Print Installed Swift Version
RUN swift --version

# Setting absolute path of the toolchain.
ENV SOURCEKIT_TOOLCHAIN_PATH=/usr/lib/swift

RUN apt-get -q update && \
    apt-get -q install -y \
    sqlite3 \
    libsqlite3-dev

WORKDIR /sourcekit-lsp
COPY . .

RUN swift build -Xcxx -I/usr/lib/swift

RUN swift test

Swift version 5.0-dev (LLVM 8d1b92b83c, Swift 038a3a6a85)

Seems like you're missing the blocks runtime. We now build and package a copy of the blocks runtime with libdispatch, so we should be using that. You should add BlocksRuntime under the libdispatch source tree to the include paths.

I have libblocksruntime-dev installed since it's one of the dependencies listed for building swift itself. I guess adding a -I<path_to_swift_toolchain>/usr/lib/swift/Block/ should work too. At some point I'd like to propose we add these paths automatically in swiftpm when building c/c++/objc code, assuming the libdispatch owners are okay with it.

1 Like

@blangmuir - naw, we don't use that in the swift build unless you don't have libdispatch checked out.

Sure, I just mean it's on the list of required packages, so I have it installed and that's how I'm building sourcekit-lsp. I just copied and pasted the apt-get command from the swift README. If it's no longer required anywhere we could update the README.

thanks, it worked added it in apt-get list