Repositories / jai.git

jai.git

Clone (read-only): git clone http://git.guha-anderson.com/git/jai.git

Branch

Put some Ubuntu notes in INSTALL. Make some common failure cases less opaque: - configure checks for a working C++23 compiler - jai bails earlier if it does not have root privileges

Put some Ubuntu notes in INSTALL.
Make some common failure cases less opaque:
  - configure checks for a working C++23 compiler
  - jai bails earlier if it does not have root privileges
Author
David Mazieres <dm@uun.org>
Date
2026-03-28 09:57:36 -0700
Commit
65ec121adcc24b7059706066598341f035efe610
INSTALL
index 6406022..b97d3b5 100644
--- a/INSTALL
+++ b/INSTALL
@@ -9,6 +9,13 @@ To build and use jai, you will need the following:
 
  - libacl (possible distro package names: acl, libacl1-dev)
 
+In Ubuntu, you may need the following to get a modern compiler:
+
+    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
+    sudo apt update
+    sudo apt install g++-15 libmount-dev libacl1-dev pkg-config
+    export CXX=g++-15
+
 To build from building from a release tarball, run:
 
     ./configure
configure.ac
index 65e4df2..16288af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,9 +12,16 @@ AC_PROG_CXX
 # Require C++23
 CXXFLAGS="$CXXFLAGS $CXXLANG"
 AC_LANG_PUSH([C++])
+AC_MSG_CHECKING(for working C++23 features)
 AC_COMPILE_IFELSE(
-  [AC_LANG_PROGRAM([], [])],
-  [],
+  [AC_LANG_PROGRAM([
+#include <functional>
+#include <print>
+  ], [
+std::move_only_function<void()> f = []{};
+f();
+  ])],
+  [AC_MSG_RESULT(yes)],
   [AC_MSG_ERROR([a C++23 compiler is required])])
 AC_LANG_POP([C++])
 
jai.cc
index f72db50..eaa9e01 100644
--- a/jai.cc
+++ b/jai.cc
@@ -1235,6 +1235,9 @@ The default is CMD.conf if it exists, otherwise default.conf)",
   opts->parse_argv(argc, argv);
 
   restore.reset();
+  if (geteuid() && !getenv("JAI_TRY_NONROOT"))
+    err("{} requires root. Please run it with sudo or make it setuid root",
+        prog.filename().string());
 
   if (cmd.empty()) {
     const char *shell = conf.shell_.empty() ? "/bin/sh" : conf.shell_.c_str();