From: Tulio A M Mendes Date: Sat, 14 Mar 2026 03:26:36 +0000 (-0300) Subject: fix: newlib crt0.o build error and gcc-full c++tools install failure X-Git-Url: https://projects.tadryanom.me/docs/static/git-logo.png?a=commitdiff_plain;h=5d3b4f28d24a317bdba7d425e7dfbb44805abe1b;p=AdrOS.git fix: newlib crt0.o build error and gcc-full c++tools install failure Two fixes to toolchain/build.sh: 1. Newlib: added have_crt0="no" to the adros entry in configure.host. Newlib's build system expected crt0.o from libc/sys/adros/, but our crt0 is provided by libgloss/adros. Setting have_crt0=no tells newlib to skip the crt0.o copy. Also replaced the old Makefile.am/configure.in (recursive autotools, wrong for newlib 4.4.0) with a minimal Makefile.inc (non-recursive build system). 2. GCC full rebuild: use explicit targets (all-gcc all-target-libgcc, install-gcc install-target-libgcc) instead of bare 'make install'. The bare install fails on c++tools/g++-mapper-server which is not needed for cross-compilation and doesn't build for freestanding targets. Verified: - i686-adros-gcc 13.2.0 and i686-adros-g++ 13.2.0 both work - C and C++ cross-compilation succeeds - newlib libc.a and libm.a installed - 100/100 smoke tests pass (10 sec) --- diff --git a/toolchain/build.sh b/toolchain/build.sh index 5e807cf..627524e 100755 --- a/toolchain/build.sh +++ b/toolchain/build.sh @@ -279,10 +279,12 @@ patch_newlib() { patch_config_sub "$d/config.sub" # newlib/configure.host — add after i[34567]86-*-rdos* block + # have_crt0="no" because crt0.o is provided by libgloss/adros, not libc/sys if ! grep -q 'adros' "$d/newlib/configure.host"; then sed -i '/i\[34567\]86-\*-rdos\*)/,/;;/{/;;/a\ i[34567]86-*-adros*)\ \tsys_dir=adros\ +\thave_crt0="no"\ \tnewlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED -DHAVE_OPENDIR -DHAVE_SYSTEM -DMALLOC_PROVIDED"\ \t;; }' "$d/newlib/configure.host" @@ -304,30 +306,12 @@ patch_newlib() { step "Patched newlib/libc/include/sys/config.h" fi - # Create newlib/libc/sys/adros/ stub directory + # Create newlib/libc/sys/adros/ stub directory (non-recursive Makefile.inc) + # This is empty because all syscalls are in libgloss/adros. if [[ ! -d "$d/newlib/libc/sys/adros" ]]; then mkdir -p "$d/newlib/libc/sys/adros" - cat > "$d/newlib/libc/sys/adros/Makefile.am" <<'EOF' -## AdrOS system directory — empty (syscalls are in libgloss/adros) -AUTOMAKE_OPTIONS = cygnus -INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) -AM_CCASFLAGS = $(INCLUDES) - -noinst_LIBRARIES = lib.a -lib_a_SOURCES = -lib_a_CCASFLAGS = $(AM_CCASFLAGS) - -ACLOCAL_AMFLAGS = -I ../../.. -EOF - cat > "$d/newlib/libc/sys/adros/configure.in" <<'EOF' -AC_PREREQ(2.59) -AC_INIT([newlib],[NEWLIB_VERSION]) -AC_CONFIG_SRCDIR([Makefile.am]) -AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE([cygnus]) -AM_MAINTAINER_MODE -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT + cat > "$d/newlib/libc/sys/adros/Makefile.inc" <<'EOF' +## AdrOS system directory — empty (syscalls provided by libgloss/adros) EOF step "Created newlib/libc/sys/adros/" fi @@ -548,8 +532,10 @@ if [[ ! -f "$BUILD_DIR/gcc-full/.built" ]]; then --disable-libquadmath \ 2>&1 | tee "$LOG_DIR/gcc-full-configure.log" - make -j"$JOBS" 2>&1 | tee "$LOG_DIR/gcc-full-build.log" - make install 2>&1 | tee "$LOG_DIR/gcc-full-install.log" + make -j"$JOBS" all-gcc all-target-libgcc \ + 2>&1 | tee "$LOG_DIR/gcc-full-build.log" + make install-gcc install-target-libgcc \ + 2>&1 | tee "$LOG_DIR/gcc-full-install.log" touch "$BUILD_DIR/gcc-full/.built" step "Full GCC installed: ${PREFIX}/bin/${TARGET}-g++" else