I've been trying to build Swift for Flatpak, and...well, it starts perfectly fine. Key word: starts.
Once LLVM and Clang are built, I get errors like this:
/run/build/swift/llvm/include/llvm/Support/AlignOf.h:18:10: fatal error: 'cstddef' file not
found
#include <cstddef>
^~~~~~~~~
1 error generated.
Further research (-v
) shows that the Swift-built version of Clang isn't passing the appropriate include (or library) directories:
clang -cc1 version 5.0.0 based upon LLVM 5.0.0 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/app/include"
ignoring nonexistent directory "/usr/usr/local/include"
ignoring nonexistent directory "/usr/usr/include"
#include "..." search starts here:
#include <...> search starts here:
stdlib/public/Reflection
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/swift/stdlib/public/Reflection
include
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/swift/include
/run/build/swift/llvm/include
/run/build/swift/build/Ninja-ReleaseAssert/llvm-linux-x86_64/include
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/build/Ninja-ReleaseAssert/llvm-linux-x86_64/tools/clang/include
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/llvm/tools/clang/include
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/cmark/src
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/build/Ninja-ReleaseAssert/cmark-linux-x86_64/src
/run/build/swift-2/build/Ninja-ReleaseAssert/llvm-linux-x86_64/lib/clang/5.0.0/include
/usr/include
End of search list.
You can see that there are no C++ include paths.
For comparison, this is what Flatpak's system Clang binaries show:
clang -cc1 version 4.0.1 based upon LLVM 4.0.1 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/app/include"
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
stdlib/public/Reflection
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/swift/stdlib/public/Reflection
include
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/swift/include
/run/build/swift/llvm/include
/run/build/swift/build/Ninja-ReleaseAssert/llvm-linux-x86_64/include
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/build/Ninja-ReleaseAssert/llvm-linux-x86_64/tools/clang/include
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/llvm/tools/clang/include
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/cmark/src
/home/ryan/stuff/org.freedesktop.Sdk.Extension.swift-real/.flatpak-builder/build/swift-2/build/Ninja-ReleaseAssert/cmark-linux-x86_64/src
/usr/bin/../lib/x86_64-unknown-linux/6.2.0/../../../include/c++/6.2.0
/usr/bin/../lib/x86_64-unknown-linux/6.2.0/../../../include/c++/6.2.0/x86_64-unknown-linux
/usr/bin/../lib/x86_64-unknown-linux/6.2.0/../../../include/c++/6.2.0/backward
/usr/bin/../lib/clang/4.0.1/include
/usr/include
End of search list.
TL;DR: Several include paths are missing, and the same goes for library directories (/usr/lib/x86_64-linux-linux
, in particular, is missing).
I'm guessing there's some option I need to pass to build-script
to make the shiny new Clang binaries pick up the correct directories...but what are they?