From d8dd2727bed190db7fd6609531661490cee908ac Mon Sep 17 00:00:00 2001 From: Konstantin Shabanov Date: Tue, 28 Jul 2026 18:22:44 +0700 Subject: [PATCH 1/6] nix: native: Downgrade gcc to 14 Use the same version as in trixie for consistency. Also, fixes libgmp compilation: checking compiler gcc -O2 -pedantic -fomit-frame-pointer -I/mnt/redox/recipes/libs/libgmp/target/x86_64-unknown-linux-gnu/x86_64-unknown-redox/sysroot/include... no, long long reliability test 1 configure: error: could not find a working compiler, see config.log for details redoxer env: exit status: 1 cook host:libgmp - failed --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 4b671b27e..d77442d7f 100644 --- a/flake.nix +++ b/flake.nix @@ -101,7 +101,7 @@ }; #TODO: This isn't tested yet, use at your own risk - native = pkgs.mkShell rec { + native = (pkgs.mkShell.override { stdenv = pkgs.gcc14Stdenv; }) rec { nativeBuildInputs = let autoreconf269 = pkgs.writeShellScriptBin "autoreconf2.69" "${pkgs.autoconf269}/bin/autoreconf"; From a2f375d0ef4c98c51ed600fd25d7ef9294b0efec Mon Sep 17 00:00:00 2001 From: Konstantin Shabanov Date: Thu, 30 Jul 2026 21:19:39 +0700 Subject: [PATCH 2/6] nix: native: Fix gcc(-freestanding)-install Provide ACLOCAL_PATH explicitly to avoid the error: + autoreconf2.69 -fvi -I/mnt/redox/recipes/dev/gcc13/source/config -I/usr/share/aclocal + for f in $(find . -name configure.ac -o -name configure.in -type f | sort) ++ dirname ./zlib/contrib/minizip/configure.ac + echo '* autotools regen in '\''./zlib/contrib/minizip'\''...' * autotools regen in './zlib/contrib/minizip'... ++ dirname ./zlib/contrib/minizip/configure.ac + cd ./zlib/contrib/minizip + autoreconf2.69 -fvi -I/mnt/redox/recipes/dev/gcc13/source/config -I/usr/share/aclocal Makefile.am:1: error: Libtool library used but 'LIBTOOL' is undefined Makefile.am:1: The usual way to define 'LIBTOOL' is to add 'LT_INIT' Makefile.am:1: to 'configure.ac' and run 'aclocal' and 'autoconf' again. Makefile.am:1: Makefile.am:1: If 'LT_INIT' is in 'configure.ac', make sure Makefile.am:1: its definition is in aclocal's search path. Makefile.am:1: Makefile.am:1: If you install Automake in its own prefix, Makefile.am:1: you'll need to arrange for the Libtool m4 files Makefile.am:1: to be found by aclocal. For info on this, see: Makefile.am:1: https://gnu.org/s/automake/manual/automake.html#Libtool-library-used-but-LIBTOOL-is-undefined autoreconf: automake failed with exit status: 1 cook host:gcc13 - failed Failed to run [cd "recipes/dev/gcc13/source" && "bash" "-ex"]: exited with status exit status: 1 make: *** [mk/prefix.mk:250: prefix/x86_64-unknown-redox/gcc-freestanding-install] Error 1 missing LT_INIT --- mk/prefix.mk | 4 +++- recipes/dev/gcc13/recipe.toml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mk/prefix.mk b/mk/prefix.mk index c282d1dcc..efe1edf5d 100644 --- a/mk/prefix.mk +++ b/mk/prefix.mk @@ -249,6 +249,7 @@ else mkdir -p "$@.partial" $(PREFIX)/relibc-freestanding-install/$(GNU_TARGET)/include export $(PREFIX_CONFIG) PATH="$(ROOT)/$(PREFIX)/libtool-install/bin:$(ROOT)/$(PREFIX)/binutils-install/bin:$$PATH" \ COOKBOOK_LIBTOOL_DIR=$(ROOT)/$(PREFIX)/libtool-install COOKBOOK_CROSS_TARGET=$(TARGET) COOKBOOK_CROSS_GNU_TARGET=$(GNU_TARGET) \ + ACLOCAL_PATH=$(ROOT)/$(PREFIX)/libtool-install/share/aclocal:$$ACLOCAL_PATH \ COOKBOOK_HOST_SYSROOT=/usr COOKBOOK_CROSS_SYSROOT=$(ROOT)/$(PREFIX)/relibc-freestanding-install/$(GNU_TARGET) && \ $(REPO_BIN) cook host:gcc13 cp -r "$(GCC_TARGET)/stage/usr/". "$@.partial" @@ -304,7 +305,8 @@ else rm -f "$@.partial"/$(GNU_TARGET)/lib/libstdc++.la rm -f "$@.partial"/$(GNU_TARGET)/lib/libsupc++.la # hosted libstdcxx - export PATH="$(ROOT)/$@.partial/bin:$$PATH" && \ + export PATH="$(ROOT)/$@.partial/bin:$$PATH" \ + ACLOCAL_PATH="$(ROOT)/$(PREFIX)/libtool-install/share/aclocal:$$ACLOCAL_PATH" && \ export $(PREFIX_CONFIG) "COOKBOOK_HOST_SYSROOT=$(ROOT)/$@.partial" COOKBOOK_CROSS_TARGET=$(HOST_TARGET) && \ rm -rf "$(LIBSTDCXX_TARGET)/stage" && $(REPO_BIN) cook libstdcxx-v3 cp -r "$(LIBSTDCXX_TARGET)/stage/usr/". "$@.partial/$(GNU_TARGET)" diff --git a/recipes/dev/gcc13/recipe.toml b/recipes/dev/gcc13/recipe.toml index 7cfa74503..5b408a9f1 100644 --- a/recipes/dev/gcc13/recipe.toml +++ b/recipes/dev/gcc13/recipe.toml @@ -7,6 +7,7 @@ DYNAMIC_INIT COOKBOOK_AUTORECONF=autoreconf2.69 autotools_recursive_regenerate -I"$(realpath ./config)" LIBTOOL_BUILD_AUX="${COOKBOOK_LIBTOOL_DIR:-$COOKBOOK_HOST_SYSROOT}"/share/libtool/build-aux cp -fpv "$LIBTOOL_BUILD_AUX"/{config.sub,config.guess,install-sh} libiberty/ +cp -fpv "$LIBTOOL_BUILD_AUX"/{config.sub,config.guess,install-sh} zlib/contrib/minizip/ """ [build] From ba9d0402cbb73bd2ab3ac9500cd4d63c88cce8d5 Mon Sep 17 00:00:00 2001 From: Konstantin Shabanov Date: Thu, 30 Jul 2026 21:22:44 +0700 Subject: [PATCH 3/6] nix: native: Disable format-security hardening Fixes the error: error: format not a string literal and no format arguments [-Werror=format-security] 318 | fprintf (f, prefix); --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index d77442d7f..eab61e551 100644 --- a/flake.nix +++ b/flake.nix @@ -162,6 +162,8 @@ xtrans # libX11 ]; + hardeningDisable = [ "format" ]; + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs; PERL_PATH = "${pkgs.perl}/bin/perl"; SKIP_CHECK_TOOLS = "1"; From b5f09fe485cd39589c2b5b300f93237492a234eb Mon Sep 17 00:00:00 2001 From: Konstantin Shabanov Date: Thu, 30 Jul 2026 15:39:16 +0700 Subject: [PATCH 4/6] nix: native: Add relibc deps Fixes relibc building: warning: relibc@0.2.5: /mnt/redox/prefix/x86_64-unknown-redox/gcc-freestanding-install/bin/ \ ../libexec/gcc/x86_64-unknown-redox/13.2.0/cc1: error while loading \ shared libraries: libmpc.so.3: cannot open shared object file: No \ such file or directory error: failed to run custom build command for `relibc v0.2.5 \ (/mnt/redox/recipes/core/relibc/source)` --- flake.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flake.nix b/flake.nix index eab61e551..2a113b8fc 100644 --- a/flake.nix +++ b/flake.nix @@ -154,6 +154,9 @@ buildInputs = with pkgs; [ (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml) + gmp # relibc + mpfr # relibc + libmpc # relibc fuse # fuser libpng # netsurf fontconfig # orbutils From fba3a493fd7049876fe66763ca8db0425ba2b103 Mon Sep 17 00:00:00 2001 From: Konstantin Shabanov Date: Thu, 30 Jul 2026 16:34:32 +0700 Subject: [PATCH 5/6] recipes: rust: Fix line endings --- recipes/dev/rust/recipe.toml | 164 +++++++++++++++++------------------ 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/recipes/dev/rust/recipe.toml b/recipes/dev/rust/recipe.toml index f2d1fd942..cd29fa8a0 100644 --- a/recipes/dev/rust/recipe.toml +++ b/recipes/dev/rust/recipe.toml @@ -1,82 +1,82 @@ -[source] -git = "https://gitlab.redox-os.org/redox-os/rust.git" -branch = "redox-2026-05-24" -shallow_clone = true - -[build] -template = "custom" -dependencies = [ - "llvm21", - "zlib", - "curl", - "openssl3", -] -dev-dependencies = [ - "llvm21.dev", - "llvm21.runtime", - "lld21", -] - -script = """ -if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then - -cat ${COOKBOOK_RECIPE}/config-cross.toml > config.toml -sed -i "s|COOKBOOK_TOOLCHAIN|${COOKBOOK_TOOLCHAIN}|g" config.toml -sed -i "s|COOKBOOK_TARGET|${COOKBOOK_CROSS_TARGET}|g" config.toml -sed -i "s|COOKBOOK_GNU_TARGET|${COOKBOOK_CROSS_GNU_TARGET}|g" config.toml -sed -i "s|TARGET|${TARGET}|g" config.toml - -else - -DYNAMIC_INIT -# Linker flags for stage2 compiler (host -> target) -ARCH="${TARGET%%-*}" -export CARGO_TARGET_${ARCH^^}_UNKNOWN_REDOX_RUSTFLAGS="${RUSTFLAGS}" # Rust -# Hack for Rust errorneusly running `llvm-config --version` on cross compiled llvm-config -cat "${COOKBOOK_ROOT}/bin/${TARGET}-llvm-config" > "${COOKBOOK_SYSROOT}/bin/llvm-config" -# Hack for Rust stage1 being dynamically linked with LLVM in prefix toolchain -export LD_LIBRARY_PATH="${COOKBOOK_HOST_SYSROOT}/lib:${LD_LIBRARY_PATH}" -# Linker flags for stage1 compiler (host -> host) -export RUSTFLAGS_BOOTSTRAP="\ --Clink-args=-L${COOKBOOK_HOST_SYSROOT}/lib \ --Clink-args=-Wl,-rpath-link,${COOKBOOK_HOST_SYSROOT}/lib" -export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="${RUSTFLAGS_BOOTSTRAP}" -export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="${RUSTFLAGS_BOOTSTRAP}" - -cat ${COOKBOOK_RECIPE}/config.toml > config.toml -sed -i "s|COOKBOOK_SYSROOT|${COOKBOOK_SYSROOT}|g" config.toml -sed -i "s|COOKBOOK_TOOLCHAIN|${COOKBOOK_HOST_SYSROOT}|g" config.toml -sed -i "s|COOKBOOK_TARGET|${TARGET}|g" config.toml -sed -i "s|COOKBOOK_GNU_TARGET|${GNU_TARGET}|g" config.toml - -fi - -# Don't poison the stage1 compiler (host -> host) -unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS CARGO_ENCODED_RUSTFLAGS STRIP - -python3 "${COOKBOOK_SOURCE}/x.py" install \ - --config config.toml \ - --jobs ${COOKBOOK_MAKE_JOBS} - -mkdir -p "${COOKBOOK_STAGE}"/usr -rsync -av --delete "${COOKBOOK_BUILD}"/install/* "${COOKBOOK_STAGE}"/usr/ -rm -rf "${COOKBOOK_STAGE}"/usr/lib/rustlib/*.log - -# workaround for rust.lld, needed by e.g. compiling bootloader -# https://github.com/rust-lang/rust/issues/143076#issuecomment-3011710678 -LLD_DIR="${COOKBOOK_STAGE}/usr/lib/rustlib/$TARGET/bin" -mkdir -p $LLD_DIR/gcc-ld -cp ${COOKBOOK_SYSROOT}/usr/bin/lld $LLD_DIR/rust-lld -ln -s rust-lld $LLD_DIR/wasm-component-ld -ln -s ../rust-lld $LLD_DIR/gcc-ld/ld.lld -ln -s ../rust-lld $LLD_DIR/gcc-ld/ld64.lld -ln -s ../rust-lld $LLD_DIR/gcc-ld/lld-link -ln -s ../rust-lld $LLD_DIR/gcc-ld/wasm-ld -ln -s ../../../libLLVM.so.21.1 $LLD_DIR/../lib/libLLVM.so.21.1 -""" - -[[optional-packages]] -name = "doc" -files = [ - "usr/share/doc/**", -] +[source] +git = "https://gitlab.redox-os.org/redox-os/rust.git" +branch = "redox-2026-05-24" +shallow_clone = true + +[build] +template = "custom" +dependencies = [ + "llvm21", + "zlib", + "curl", + "openssl3", +] +dev-dependencies = [ + "llvm21.dev", + "llvm21.runtime", + "lld21", +] + +script = """ +if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then + +cat ${COOKBOOK_RECIPE}/config-cross.toml > config.toml +sed -i "s|COOKBOOK_TOOLCHAIN|${COOKBOOK_TOOLCHAIN}|g" config.toml +sed -i "s|COOKBOOK_TARGET|${COOKBOOK_CROSS_TARGET}|g" config.toml +sed -i "s|COOKBOOK_GNU_TARGET|${COOKBOOK_CROSS_GNU_TARGET}|g" config.toml +sed -i "s|TARGET|${TARGET}|g" config.toml + +else + +DYNAMIC_INIT +# Linker flags for stage2 compiler (host -> target) +ARCH="${TARGET%%-*}" +export CARGO_TARGET_${ARCH^^}_UNKNOWN_REDOX_RUSTFLAGS="${RUSTFLAGS}" # Rust +# Hack for Rust errorneusly running `llvm-config --version` on cross compiled llvm-config +cat "${COOKBOOK_ROOT}/bin/${TARGET}-llvm-config" > "${COOKBOOK_SYSROOT}/bin/llvm-config" +# Hack for Rust stage1 being dynamically linked with LLVM in prefix toolchain +export LD_LIBRARY_PATH="${COOKBOOK_HOST_SYSROOT}/lib:${LD_LIBRARY_PATH}" +# Linker flags for stage1 compiler (host -> host) +export RUSTFLAGS_BOOTSTRAP="\ +-Clink-args=-L${COOKBOOK_HOST_SYSROOT}/lib \ +-Clink-args=-Wl,-rpath-link,${COOKBOOK_HOST_SYSROOT}/lib" +export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="${RUSTFLAGS_BOOTSTRAP}" +export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="${RUSTFLAGS_BOOTSTRAP}" + +cat ${COOKBOOK_RECIPE}/config.toml > config.toml +sed -i "s|COOKBOOK_SYSROOT|${COOKBOOK_SYSROOT}|g" config.toml +sed -i "s|COOKBOOK_TOOLCHAIN|${COOKBOOK_HOST_SYSROOT}|g" config.toml +sed -i "s|COOKBOOK_TARGET|${TARGET}|g" config.toml +sed -i "s|COOKBOOK_GNU_TARGET|${GNU_TARGET}|g" config.toml + +fi + +# Don't poison the stage1 compiler (host -> host) +unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS CARGO_ENCODED_RUSTFLAGS STRIP + +python3 "${COOKBOOK_SOURCE}/x.py" install \ + --config config.toml \ + --jobs ${COOKBOOK_MAKE_JOBS} + +mkdir -p "${COOKBOOK_STAGE}"/usr +rsync -av --delete "${COOKBOOK_BUILD}"/install/* "${COOKBOOK_STAGE}"/usr/ +rm -rf "${COOKBOOK_STAGE}"/usr/lib/rustlib/*.log + +# workaround for rust.lld, needed by e.g. compiling bootloader +# https://github.com/rust-lang/rust/issues/143076#issuecomment-3011710678 +LLD_DIR="${COOKBOOK_STAGE}/usr/lib/rustlib/$TARGET/bin" +mkdir -p $LLD_DIR/gcc-ld +cp ${COOKBOOK_SYSROOT}/usr/bin/lld $LLD_DIR/rust-lld +ln -s rust-lld $LLD_DIR/wasm-component-ld +ln -s ../rust-lld $LLD_DIR/gcc-ld/ld.lld +ln -s ../rust-lld $LLD_DIR/gcc-ld/ld64.lld +ln -s ../rust-lld $LLD_DIR/gcc-ld/lld-link +ln -s ../rust-lld $LLD_DIR/gcc-ld/wasm-ld +ln -s ../../../libLLVM.so.21.1 $LLD_DIR/../lib/libLLVM.so.21.1 +""" + +[[optional-packages]] +name = "doc" +files = [ + "usr/share/doc/**", +] From 9b1932db7f1ace533eb178dcd5f96e0eeec17954 Mon Sep 17 00:00:00 2001 From: Konstantin Shabanov Date: Thu, 30 Jul 2026 16:49:31 +0700 Subject: [PATCH 6/6] recipes: rust: Set SSL_CERT_FILE explicitly Otherwise, rust recipe fails to download using curl: + python3 /mnt/redox/recipes/dev/rust/source/x.py install --config config.toml --jobs 32 downloading https://static.rust-lang.org/dist/2026-04-14/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz running: curl --progress-bar --retry-all-errors --location \ --speed-time 30 --speed-limit 10 --connect-timeout 30 \ --output /tmp/nix-shell.LcAteo/tmpuv1ls9sy --continue-at - \ --retry 3 --show-error --remote-time --fail \ https://static.rust-lang.org/dist/2026-04-14/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz curl: (60) SSL certificate OpenSSL verify result: unable to get local issuer certificate (20) More details here: https://curl.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the webpage mentioned above. Warning: Problem (retrying all errors). Retrying in 1 second. 3 retries left. curl: (60) SSL certificate OpenSSL verify result: unable to get local issuer certificate (20) More details here: https://curl.se/docs/sslcerts.html --- recipes/dev/rust/recipe.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/dev/rust/recipe.toml b/recipes/dev/rust/recipe.toml index cd29fa8a0..a295feab6 100644 --- a/recipes/dev/rust/recipe.toml +++ b/recipes/dev/rust/recipe.toml @@ -54,6 +54,7 @@ fi # Don't poison the stage1 compiler (host -> host) unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS CARGO_ENCODED_RUSTFLAGS STRIP +SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" \ python3 "${COOKBOOK_SOURCE}/x.py" install \ --config config.toml \ --jobs ${COOKBOOK_MAKE_JOBS}