Issue with latest ubuntu docker images (sqlite3.h missing, and more)

Hello :wave:

I'm having an issue when building on latest Ubuntu a package that depends on ArgumentParser and SwiftPM. I'm not sure this is the correct place in the forum, I'm having this issue both with local Docker images and Github Actions, but this might go as well in the llBuild category.

I'm running Docker with docker run -it swift:latest

$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.4 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Error when building the package:

/root/sourcedocs/.build/checkouts/swift-llbuild/lib/Core/SQLiteBuildDB.cpp:28:10: fatal error: 'sqlite3.h' file not found
#include <sqlite3.h>
         ^~~~~~~~~~~
1 error generated.
[40/78] Compiling llbuildCore MakefileDepsParser.cpp
Makefile:16: recipe for target 'build' failed

Same error on Github Actions on ubuntu-latest can be seen in this log

Installing sqlite3 dependency on the docker image seems to make the build go further, but still fails.

apt-get update && apt-get upgrade
apt-get install libsqlite3-dev

Error after installing sqlite3:

/usr/bin/ld.gold: error: cannot find -lncurses
/usr/bin/ld.gold: error: cannot find -lncurses
.build/checkouts/swift-llbuild/lib/llvm/Support/Unix/Process.inc:357: error: undefined reference to 'setupterm'
.build/checkouts/swift-llbuild/lib/llvm/Support/Unix/Process.inc:375: error: undefined reference to 'tigetnum'
.build/checkouts/swift-llbuild/lib/llvm/Support/Unix/Process.inc:379: error: undefined reference to 'set_curterm'
.build/checkouts/swift-llbuild/lib/llvm/Support/Unix/Process.inc:380: error: undefined reference to 'del_curterm'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
[54/55] Linking sourcedocs
Makefile:16: recipe for target 'build' failed

Which other dependencies are needed for swift-llbuild to build on Ubuntu bionic?

Thank you!
Eneko

I was recently using nightly-bionic to test sourcekit-lsp (which depends on llbuild/swiftpm), and I have the following in my Dockerfile

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      sudo \
      ninja-build \
      python \
      libsqlite3-dev \
      libedit-dev

Of those, I think libsqlite3-dev and libedit-dev are the only ones that should impact swiftpm/llbuild when built as a package.

Ok, thanks, that helped.

For reference, I was installing the following, but still getting some errors:

apt-get install -y llvm clang libblocksruntime-dev

Installing libedit-dev solved the linking issue.

My package depends on SourceKitten which depends on sourcekit, so similar issue. Thanks!

I asked about including these sorts of dependencies before, but got no answer:

If you are only working with SwiftPM (not sourcekitā€lsp), all you need are these:

1 Like