A Linux executable built by the Flatpak crafter-build links the libc++,
libc++abi and libunwind in its /app/lib and the Sdk's glibc, so it runs
inside crafter-build's sandbox and practically nowhere else: a host
needs glibc 2.38 or newer and all three LLVM libraries, which not even
Arch has. A program built here is meant to run in a Flatpak, so it can
now be laid out as one: with cfg.packaging = Packaging::Flatpak, or
--packaging=flatpak where the project.cpp crafter-build was pointed at
calls ApplyStandardArgs, its BinDir() holds files/, what becomes /app in
the app's sandbox, and -r runs the program there against the libraries
the app carries.
The program is linked into files/bin, where its shaders, files and
assets land too (ProgramDir()), with $ORIGIN/../lib as its one run path,
and the new :Flatpak partition writes the rest of files/: files/lib with
the LLVM runtime libraries, located one by one through clang, and
whatever else the program needs, read with llvm-readelf, that the
directories of the shared libraries it is built on hold, the ones an
unpackaged link records as run paths, or the toolchain's own lib dir,
/app/lib in crafter-build's Flatpak, which the link searches too; and
the desktop entry, metainfo and icons under the app-id in files/share,
the entry refused when its Icon= is not the app-id or
desktop-file-validate, where there is one, rejects it, and an icon that
is not an .svg or a square .png. The metadata and export/ of a build
directory are flatpak build-finish's to write, and crafter-build keeps
no copy of its rules: what a permission means and what the host sees of
an app change with flatpak's releases, and a copy would have to follow
every one. The writer copies a file only when its content differs,
compared a block at a time so that a large file costs no more memory
than a small one, and writes one only when what it would write differs,
never deciding by an mtime, which ostree sets to 0 for every file of
/app, and works the program's libraries out on every write, which reads
only their dynamic sections, since a library replaced in place, as by a
toolchain update, can need others, which FlatpakLibraryChange checks; it
prunes from files/bin each top-level entry an earlier build put there
and this one does not, reporting those the program wrote there itself.
What cannot be a Flatpak is refused before anything is built, saying
why: a Windows or wasm executable, a build against a sysroot or for
musl, another architecture than the runtime's, a build against
CRAFTER_BUILD_LIBCXX_DIR, whose libc++ the Flatpak would not carry, and
a build by a native crafter-build, which links the host's glibc: a
native process knows no Flatpak runtime, from /.flatpak-info, unless
CRAFTER_BUILD_FLATPAK_INFO, the tests' hook, names a file with one.
Default stays the executable as linked for now, RunTests runs every test
as linked, whatever its Configuration asks for, and RunLint works out
its compile command so, and a forwarded --packaging= leaves a
dependency's executables alone, since consumers run them by path. A
dependency that packages its own executable gets its desktop file,
metainfo and icons rebased by the loader as its cfg.files are, so they
are its own whatever directory the consumer builds from. Only a Flatpak
is keyed into VariantId, so every other configuration keeps its
directory, but for one given --packaging=, which was a project arg,
hashed into VariantId, and is a standard arg now, a dependency's
included. The app-id and what a Flatpak is installed as are not keyed:
they change files/share, never what is compiled. The asset name map,
kept three times, twice in Build() and once for the browser runtime's
files.json, is one function now, CompressedAssetName; CompressAsset, in
Crafter.Build-Asset.cpp, keeps the list of the extensions it loads,
which has to agree with it. Each copy a Flatpak build makes into the
program's directory, of its shaders, assets, cfg.files and what its
dependencies forward, records the top-level name it places there, the
names of what a directory holds for one copied into it itself ("data/",
"data/."), and those are what the writer keeps in files/bin; a build
that fails after copying adds them to the writer's record all the same,
so the next write removes what no build places any more.
SharedLibraryRuns now also packages its program as a Flatpak, whose
files/lib has to carry libgreet.so for it to start.
391 lines
18 KiB
C++
391 lines
18 KiB
C++
// SPDX-License-Identifier: LGPL-3.0-only
|
|
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
|
|
module;
|
|
// Supplied on the command line by build.sh and project.cpp (from the
|
|
// CRAFTER_BUILD_VERSION environment variable or `git describe`); a build
|
|
// that passes nothing is a development build.
|
|
#ifndef CRAFTER_BUILD_VERSION
|
|
#define CRAFTER_BUILD_VERSION "0.0.0-dev"
|
|
#endif
|
|
module Crafter.Build:Toolchain_impl;
|
|
import std;
|
|
import :Toolchain;
|
|
import :Platform;
|
|
namespace fs = std::filesystem;
|
|
using namespace Crafter;
|
|
|
|
namespace {
|
|
constexpr std::string_view EnvVars[] = {
|
|
"CRAFTER_BUILD_LLVM_DIR",
|
|
"CRAFTER_BUILD_LIBCXX_DIR",
|
|
"CRAFTER_BUILD_LIBCLANG",
|
|
"CRAFTER_BUILD_WASI_SYSROOT",
|
|
"CRAFTER_BUILD_FLATPAK_INFO",
|
|
"CRAFTER_MINGW_DIR",
|
|
};
|
|
|
|
// The arch and branch of the runtime=runtime/<id>/<arch>/<branch> line
|
|
// in the [Application] group of a .flatpak-info; empty when it has none.
|
|
std::pair<std::string, std::string> FlatpakRuntimeOf(std::string_view info) {
|
|
bool inApplication = false;
|
|
for (std::size_t begin = 0; begin < info.size();) {
|
|
std::size_t end = info.find('\n', begin);
|
|
if (end == std::string_view::npos) end = info.size();
|
|
std::string_view line = info.substr(begin, end - begin);
|
|
begin = end + 1;
|
|
if (line.ends_with('\r')) line.remove_suffix(1);
|
|
if (line.starts_with("[")) {
|
|
inApplication = line == "[Application]";
|
|
continue;
|
|
}
|
|
if (!inApplication || !line.starts_with("runtime=")) continue;
|
|
std::vector<std::string_view> parts;
|
|
std::string_view ref = line.substr(std::string_view("runtime=").size());
|
|
for (std::size_t at = 0;;) {
|
|
const std::size_t slash = ref.find('/', at);
|
|
parts.push_back(ref.substr(at, slash == std::string_view::npos ? std::string_view::npos : slash - at));
|
|
if (slash == std::string_view::npos) break;
|
|
at = slash + 1;
|
|
}
|
|
if (parts.size() == 4 && parts[0] == "runtime" && !parts[2].empty() && !parts[3].empty()) {
|
|
return {std::string(parts[2]), std::string(parts[3])};
|
|
}
|
|
}
|
|
return {};
|
|
}
|
|
|
|
std::string_view Env(const ToolchainInputs& in, std::string_view name) {
|
|
auto it = in.env.find(name);
|
|
return it == in.env.end() ? std::string_view{} : std::string_view(it->second);
|
|
}
|
|
|
|
// "Arch Linux clang version 22.1.8" / "clang version 22.1.8" -> "22.1.8".
|
|
std::string ShortVersion(std::string_view versionLine) {
|
|
constexpr std::string_view Marker = "version ";
|
|
std::size_t at = versionLine.find(Marker);
|
|
if (at == std::string_view::npos) return "unknown";
|
|
std::string_view rest = versionLine.substr(at + Marker.size());
|
|
std::size_t end = rest.find_first_of(" \t(");
|
|
return std::string(rest.substr(0, end));
|
|
}
|
|
|
|
std::string Trimmed(std::string s) {
|
|
while (!s.empty() && (s.back() == '\n' || s.back() == '\r' || s.back() == ' ')) s.pop_back();
|
|
return s;
|
|
}
|
|
|
|
// `link` made a symbolic link to `target`, or found one already. Another
|
|
// crafter-build may make the same link at the same moment, which is as
|
|
// good as making it; a link to anything else is an error.
|
|
void EnsureSymlink(const fs::path& target, const fs::path& link) {
|
|
std::error_code ec;
|
|
if (fs::read_symlink(link, ec) == target) return;
|
|
fs::create_directories(link.parent_path());
|
|
fs::create_directory_symlink(target, link, ec);
|
|
std::error_code ignored;
|
|
if (ec && fs::read_symlink(link, ignored) != target) {
|
|
throw fs::filesystem_error("cannot make a link", target, link, ec);
|
|
}
|
|
}
|
|
|
|
// `dir` made absolute and spelled one way, once, when the toolchain is
|
|
// resolved. The mingw prefix ends up as the target of links and in the
|
|
// names of build and cache directories: a relative path read later from
|
|
// another working directory would name something else, and /opt/mingw/
|
|
// next to /opt/mingw would rebuild everything for the same directory.
|
|
fs::path PrefixPath(const fs::path& dir) {
|
|
fs::path normal = fs::absolute(dir).lexically_normal();
|
|
if (!normal.has_filename() && normal.has_relative_path()) normal = normal.parent_path();
|
|
return normal;
|
|
}
|
|
|
|
// The view MingwSysroot() made and the prefix it shows, for
|
|
// MingwViewToPrefix. Written once, before ViewMade is set.
|
|
fs::path MadeView;
|
|
fs::path ViewedPrefix;
|
|
std::atomic<bool> ViewMade = false;
|
|
}
|
|
|
|
std::string Toolchain::LibcxxCompileFlags() const {
|
|
if (libcxxDir.empty()) return {};
|
|
return std::format(" -nostdinc++ -isystem {}", (libcxxDir / "include" / "c++" / "v1").string());
|
|
}
|
|
|
|
// clang searches its per-target runtime directory and the system library
|
|
// paths for -lc++, not <prefix>/lib, so a toolchain outside /usr with the
|
|
// classic layout needs the search path as well as the run-time path.
|
|
fs::path Toolchain::LibcxxLibDir() const {
|
|
if (!libcxxDir.empty()) return libcxxDir / "lib";
|
|
if (!prefix.empty() && prefix != "/usr") return prefix / "lib";
|
|
return {};
|
|
}
|
|
|
|
std::string Toolchain::LibcxxLinkFlags() const {
|
|
const fs::path lib = LibcxxLibDir();
|
|
if (lib.empty()) return {};
|
|
return std::format(" -L{} -Wl,-rpath,{}", lib.string(), lib.string());
|
|
}
|
|
|
|
std::string Toolchain::LibcxxSearchFlags() const {
|
|
const fs::path lib = LibcxxLibDir();
|
|
if (lib.empty()) return {};
|
|
return std::format(" -L{}", lib.string());
|
|
}
|
|
|
|
std::string Toolchain::Key() const {
|
|
std::string identity;
|
|
for (const std::string& part : {clangxx.string(), clangVersion, libcxxDir.string(), stdCppm.string()}) {
|
|
identity += part;
|
|
identity += '\0';
|
|
}
|
|
return std::format("{}-{:08x}", ShortVersion(clangVersion), static_cast<std::uint32_t>(std::hash<std::string>{}(identity)));
|
|
}
|
|
|
|
Toolchain Crafter::ResolveToolchain(const ToolchainInputs& in) {
|
|
Toolchain tc;
|
|
|
|
// 1. The compiler: an explicit prefix, else one installed beside
|
|
// crafter-build, else PATH. An explicit prefix without a clang++ is an
|
|
// error rather than a fallback, for the same reason CRAFTER_BUILD_LIBCLANG
|
|
// is exclusive: an override that silently yields to something else
|
|
// cannot be used to diagnose which compiler is in play.
|
|
if (std::string_view dir = Env(in, "CRAFTER_BUILD_LLVM_DIR"); !dir.empty()) {
|
|
tc.prefix = fs::path(dir);
|
|
if (!fs::exists(tc.prefix / "bin" / "clang++")) {
|
|
tc.error = std::format("clang++ not found at {} (CRAFTER_BUILD_LLVM_DIR)", (tc.prefix / "bin" / "clang++").string());
|
|
}
|
|
} else if (!in.crafterPrefix.empty() && fs::exists(in.crafterPrefix / "bin" / "clang++")) {
|
|
tc.prefix = in.crafterPrefix;
|
|
}
|
|
if (tc.prefix.empty()) {
|
|
tc.clangxx = "clang++";
|
|
tc.clang = "clang";
|
|
tc.llvmAr = "llvm-ar";
|
|
tc.llvmReadelf = "llvm-readelf";
|
|
} else {
|
|
tc.clangxx = tc.prefix / "bin" / "clang++";
|
|
tc.clang = tc.prefix / "bin" / "clang";
|
|
tc.llvmAr = tc.prefix / "bin" / "llvm-ar";
|
|
tc.llvmReadelf = tc.prefix / "bin" / "llvm-readelf";
|
|
if (tc.prefix != "/usr" && fs::exists(tc.prefix / "include" / "clang-c" / "Index.h")) {
|
|
tc.llvmIncludeDir = tc.prefix / "include";
|
|
}
|
|
}
|
|
|
|
// 2. libclang. The override is exclusive and unchecked on purpose: a
|
|
// broken path must fail loudly when dlopened, not be papered over.
|
|
if (std::string_view pinned = Env(in, "CRAFTER_BUILD_LIBCLANG"); !pinned.empty()) {
|
|
tc.libclang = fs::path(pinned);
|
|
} else if (!tc.prefix.empty() && fs::exists(tc.prefix / "lib" / "libclang.so")) {
|
|
tc.libclang = tc.prefix / "lib" / "libclang.so";
|
|
}
|
|
|
|
// 3. libc++ and its std module source. The compiler's own copy lives at
|
|
// <prefix>/share/libc++/v1 when the prefix carries libc++; the system
|
|
// copy is the last resort either way. The headers of the same install
|
|
// say which release the source belongs to.
|
|
fs::path libcxxRoot = "/usr";
|
|
if (std::string_view dir = Env(in, "CRAFTER_BUILD_LIBCXX_DIR"); !dir.empty()) {
|
|
tc.libcxxDir = fs::path(dir);
|
|
libcxxRoot = tc.libcxxDir;
|
|
} else if (!tc.prefix.empty() && fs::exists(tc.prefix / "share" / "libc++" / "v1" / "std.cppm")) {
|
|
libcxxRoot = tc.prefix;
|
|
}
|
|
tc.stdCppm = libcxxRoot / "share" / "libc++" / "v1" / "std.cppm";
|
|
tc.libcxxVersion = LibcxxVersion(libcxxRoot / "include" / "c++" / "v1");
|
|
if (!in.crafterPrefix.empty()) {
|
|
tc.stdModulesDir = in.crafterPrefix / "share" / "crafter-build" / "libc++-modules";
|
|
}
|
|
|
|
// 4. Sysroots for the cross targets that have a conventional location.
|
|
if (std::string_view dir = Env(in, "CRAFTER_BUILD_WASI_SYSROOT"); !dir.empty()) {
|
|
tc.wasiSysroot = fs::path(dir);
|
|
} else if (!tc.prefix.empty() && fs::exists(tc.prefix / "share" / "wasi-sysroot")) {
|
|
tc.wasiSysroot = tc.prefix / "share" / "wasi-sysroot";
|
|
} else {
|
|
tc.wasiSysroot = "/usr/share/wasi-sysroot";
|
|
}
|
|
if (std::string_view dir = Env(in, "CRAFTER_MINGW_DIR"); !dir.empty()) {
|
|
tc.mingwPrefix = PrefixPath(fs::path(dir));
|
|
// A prefix that holds a Linux system as well as mingw-w64, /usr
|
|
// itself, has that system's C library in include/: features.h, which
|
|
// every glibc and musl header includes and mingw-w64 has no use for.
|
|
// One that holds mingw-w64 alone stays the sysroot, so Windows
|
|
// libraries installed into its include/ and lib/ stay visible.
|
|
tc.mingwPrefixIsSystem = fs::exists(tc.mingwPrefix / "include" / "features.h");
|
|
} else if (!in.hostRoot.empty() && fs::exists(in.hostRoot / "usr" / "x86_64-w64-mingw32")) {
|
|
// The sandbox has no mingw-w64 of its own, and no mingw gcc on PATH
|
|
// for clang to find one by. The host's /usr is the host's system,
|
|
// whether or not its C library's headers are installed.
|
|
tc.mingwPrefix = PrefixPath(in.hostRoot / "usr");
|
|
tc.mingwPrefixIsSystem = true;
|
|
}
|
|
std::tie(tc.flatpakArch, tc.flatpakBranch) = FlatpakRuntimeOf(in.flatpakInfo);
|
|
return tc;
|
|
}
|
|
|
|
const Toolchain& Crafter::GetToolchain() {
|
|
static const Toolchain Resolved = []() {
|
|
ToolchainInputs in;
|
|
for (std::string_view name : EnvVars) {
|
|
if (const char* value = std::getenv(std::string(name).c_str()); value && *value) {
|
|
in.env.emplace(std::string(name), value);
|
|
}
|
|
}
|
|
// GetCrafterBuildHome throws when no share/crafter-build is found
|
|
// near the executable; a toolchain can still come from PATH then.
|
|
try {
|
|
in.crafterPrefix = GetCrafterBuildHome().parent_path().parent_path();
|
|
} catch (const std::exception&) {}
|
|
if (fs::exists("/.flatpak-info")) in.hostRoot = "/run/host";
|
|
{
|
|
auto it = in.env.find("CRAFTER_BUILD_FLATPAK_INFO");
|
|
const fs::path info = it != in.env.end() ? fs::path(it->second) : fs::path("/.flatpak-info");
|
|
if (std::ifstream file(info, std::ios::binary); file) {
|
|
in.flatpakInfo.assign(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
|
|
}
|
|
}
|
|
|
|
Toolchain tc = ResolveToolchain(in);
|
|
if (!tc.error.empty()) return tc;
|
|
|
|
CommandResult triple = RunCommandChecked(std::format("{} -print-target-triple", tc.clangxx.string()));
|
|
if (triple.exitCode != 0) {
|
|
tc.error = std::format("could not run {} (exit {}): {}", tc.clangxx.string(), triple.exitCode, Trimmed(triple.output));
|
|
if (tc.prefix.empty()) tc.error += "; install clang or set CRAFTER_BUILD_LLVM_DIR";
|
|
return tc;
|
|
}
|
|
tc.hostTriple = Trimmed(std::move(triple.output));
|
|
CommandResult version = RunCommandChecked(std::format("{} --version", tc.clangxx.string()));
|
|
if (version.exitCode == 0) {
|
|
std::string first = version.output.substr(0, version.output.find('\n'));
|
|
tc.clangVersion = Trimmed(std::move(first));
|
|
}
|
|
return tc;
|
|
}();
|
|
return Resolved;
|
|
}
|
|
|
|
const Toolchain& Crafter::RequireToolchain() {
|
|
const Toolchain& tc = GetToolchain();
|
|
if (!tc.error.empty()) throw std::runtime_error(tc.error);
|
|
return tc;
|
|
}
|
|
|
|
fs::path Crafter::MakeMingwSysroot(const fs::path& prefix, std::span<const fs::path> parents) {
|
|
std::string reasons;
|
|
for (const fs::path& parent : parents) {
|
|
// One view per prefix: two shells with different CRAFTER_MINGW_DIRs
|
|
// share one cache and would otherwise rewrite each other's.
|
|
const fs::path sysroot = parent / "mingw-sysroot" / std::format("{:016x}", std::hash<std::string>{}(prefix.string()));
|
|
try {
|
|
// All clang's mingw driver takes from a sysroot other than its
|
|
// include/ and the rest of its lib/: the mingw-w64 tree (headers,
|
|
// libraries, and libstdc++ where a distro's cross gcc installs
|
|
// it) and gcc's per-target directory (crtbegin.o, libgcc, and the
|
|
// version that names libstdc++'s header directory), which
|
|
// openSUSE keeps under lib64. A link to nothing is skipped like a
|
|
// missing directory.
|
|
for (std::string_view entry : {"x86_64-w64-mingw32", "lib/gcc", "lib64/gcc"}) {
|
|
EnsureSymlink(prefix / entry, sysroot / entry);
|
|
}
|
|
return sysroot;
|
|
} catch (const std::exception& e) {
|
|
reasons += std::format("; {}", e.what());
|
|
}
|
|
}
|
|
throw std::runtime_error(std::format("cannot make a sysroot that shows clang only the mingw-w64 parts of {}{}", prefix.string(), reasons));
|
|
}
|
|
|
|
const fs::path& Crafter::MingwSysroot() {
|
|
// Made on first use rather than by GetToolchain(), so that only what
|
|
// compiles for the mingw target, a build or an AST lint of one, writes
|
|
// anything for it, and a failure surfaces as that command's error
|
|
// instead of on every command.
|
|
static const fs::path Sysroot = []() -> fs::path {
|
|
const Toolchain& tc = GetToolchain();
|
|
if (!tc.mingwPrefixIsSystem) return tc.mingwPrefix;
|
|
// In the cache, or where the XDG spec promises symbolic links when
|
|
// the cache's filesystem takes none (vfat, exFAT, CIFS without unix
|
|
// extensions), which costs nothing else crafter-build caches.
|
|
// Absolute, because CMake runs the compiler from directories of its
|
|
// own.
|
|
std::vector<fs::path> parents = { fs::absolute(GetCacheDir()) };
|
|
if (const char* runtime = std::getenv("XDG_RUNTIME_DIR"); runtime && *runtime) {
|
|
parents.push_back(fs::absolute(fs::path(runtime) / "crafter.build"));
|
|
}
|
|
fs::path view = MakeMingwSysroot(tc.mingwPrefix, parents);
|
|
MadeView = view;
|
|
ViewedPrefix = tc.mingwPrefix;
|
|
ViewMade.store(true, std::memory_order_release);
|
|
return view;
|
|
}();
|
|
return Sysroot;
|
|
}
|
|
|
|
std::string Crafter::MingwViewToPrefix(std::string text) {
|
|
if (!ViewMade.load(std::memory_order_acquire)) return text;
|
|
// With the separator, so a --sysroot= naming the view itself, in a
|
|
// command line the output quotes, stays what was run.
|
|
const std::string view = (MadeView / "").string();
|
|
const std::string prefix = (ViewedPrefix / "").string();
|
|
for (std::size_t at = text.find(view); at != std::string::npos; at = text.find(view, at + prefix.size())) {
|
|
text.replace(at, view.size(), prefix);
|
|
}
|
|
return text;
|
|
}
|
|
|
|
std::int32_t Crafter::LibcxxVersion(const fs::path& includeDir) {
|
|
// "# define _LIBCPP_VERSION 230102", the one place libc++ states its
|
|
// release in a form the preprocessor does not have to be run for.
|
|
constexpr std::string_view Marker = "define _LIBCPP_VERSION ";
|
|
std::ifstream config(includeDir / "__config");
|
|
std::string line;
|
|
while (std::getline(config, line)) {
|
|
const std::size_t at = line.find(Marker);
|
|
if (at == std::string::npos) continue;
|
|
const std::string_view digits = std::string_view(line).substr(at + Marker.size());
|
|
std::int32_t version = 0;
|
|
if (std::from_chars(digits.data(), digits.data() + digits.size(), version).ec == std::errc{}) return version;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
std::string Crafter::LibcxxVersionString(std::int32_t version) {
|
|
return std::format("{}.{}.{}", version / 10000, version / 100 % 100, version % 100);
|
|
}
|
|
|
|
StdModuleSource Crafter::SysrootStdModule(const Toolchain& tc, const fs::path& sysroot) {
|
|
const fs::path own = sysroot / "usr" / "share" / "libc++" / "v1" / "std.cppm";
|
|
if (fs::exists(own)) return {own, {}};
|
|
|
|
const fs::path includeDir = sysroot / "usr" / "include" / "c++" / "v1";
|
|
if (!fs::exists(includeDir / "__config")) {
|
|
return {{}, std::format("sysroot {} has no libc++ headers at {}; install its libc++ development package", sysroot.string(), includeDir.string())};
|
|
}
|
|
const std::int32_t wanted = LibcxxVersion(includeDir);
|
|
const bool comparable = wanted != 0 && tc.libcxxVersion != 0;
|
|
// Releases are matched on the major version: a release branch only takes
|
|
// fixes, so 22.1.3 headers and the 22.1.8 module source name the same
|
|
// declarations.
|
|
if (comparable && wanted / 10000 == tc.libcxxVersion / 10000 && fs::exists(tc.stdCppm)) return {tc.stdCppm, {}};
|
|
if (wanted != 0 && !tc.stdModulesDir.empty()) {
|
|
const fs::path shipped = tc.stdModulesDir / std::to_string(wanted / 10000) / "std.cppm";
|
|
if (fs::exists(shipped)) return {shipped, {}};
|
|
}
|
|
// One of the two releases is unknown, so there is nothing to compare:
|
|
// hand over the toolchain's source and let the compile decide, which is
|
|
// what happened for every sysroot before releases were compared.
|
|
if (!comparable && fs::exists(tc.stdCppm)) return {tc.stdCppm, {}};
|
|
|
|
const std::string sysrootRelease = wanted != 0 ? LibcxxVersionString(wanted) : std::string("of an unknown release");
|
|
const std::string toolchainSource = !fs::exists(tc.stdCppm)
|
|
? std::string("the toolchain has no std module source at all")
|
|
: std::format("the toolchain's is for libc++ {}", LibcxxVersionString(tc.libcxxVersion));
|
|
return {{}, std::format("sysroot {} carries libc++ {} without its std module source, and crafter-build has none for that release ({}); install the share/libc++/v1 directory of that libc++ release (std.cppm and std/) as {}", sysroot.string(), sysrootRelease, toolchainSource, own.parent_path().string())};
|
|
}
|
|
|
|
std::string_view Crafter::CrafterBuildVersion() {
|
|
return CRAFTER_BUILD_VERSION;
|
|
}
|