Tier 1 Support for sparc64-linux
andrewrk opened this issue ยท 6 comments
A little humor:
<Thalheim> andrewrk: bootstrapping zig on sparc64 using the repo you posted peaks at consuming 104GB of memory on my machine, about 40% done so far
<floatcomplex> tell me you didn't try to build gcc with make -j256
<Thalheim> that's exactly what I did https://i.imgur.com/JvGpR51.png
Trying to build zig for this target gives:
[ 99%] Built target zig0
make[2]: Entering directory '/home/z/zig-bootstrap/out/build-zig-host'
Scanning dependencies of target zig_build_libstage2
make[2]: Leaving directory '/home/z/zig-bootstrap/out/build-zig-host'
make[2]: Entering directory '/home/z/zig-bootstrap/out/build-zig-host'
./lib/std/fs/file.zig:30:24: error: container 'std.os' has no member called 'mode_t'
pub const Mode = os.mode_t;
^
./lib/std/fs.zig:1284:19: note: referenced here
mode: File.Mode = File.default_mode,
^
./lib/std/io/buffered_atomic_file.zig:29:40: note: referenced here
self.atomic_file = try fs.cwd().atomicFile(dest_path, .{});
^
./src-self-hosted/stage2.zig:370:21: note: referenced here
const baf = try io.BufferedAtomicFile.create(fmt.allocator, file_path);
^
./lib/std/time.zig:146:23: error: container 'std.os' has no member called 'timespec'
var ts: os.timespec = undefined;
^
./lib/std/fs/file.zig:164:18: error: container 'std.os' has no member called 'ino_t'
inode: os.ino_t,
^
./lib/std/fs/file.zig:182:38: note: referenced here
pub fn stat(self: File) StatError!Stat {
^
./lib/std/fs/file.zig:142:25: note: referenced here
return (try self.stat()).size;
^
./lib/std/event/loop.zig:1244:25: error: container 'std.os' has no member called 'mode_t'
mode: os.mode_t,
^
./lib/std/event/loop.zig:1182:13: note: while checking this field
open: Open,
^
./lib/std/event/loop.zig:1165:9: note: while checking this field
msg: Msg,
^
./lib/std/linked_list.zig:200:13: note: while checking this field
data: T,
^
./lib/std/atomic/queue.zig:10:9: note: while checking this field
head: ?*Node,
^
./lib/std/event/loop.zig:1160:9: note: while checking this field
fs_queue: std.atomic.Queue(Request),
^
./lib/std/event/loop.zig:16:5: note: while checking this field
os_data: OsData,
^
./lib/std/event/loop.zig:96:25: note: referenced here
pub const instance: ?*Loop = if (@hasDecl(root, "event_loop")) root.event_loop else default_instance;
^
./lib/std/os.zig:614:41: note: referenced here
EAGAIN => if (std.event.Loop.instance) |loop| {
^
./lib/std/fs.zig:598:42: error: container 'std.os' has no member called 'O_CLOEXEC'
const os_flags = O_LARGEFILE | os.O_CLOEXEC | if (flags.write and flags.read)
^
./lib/std/fs.zig:777:53: error: container 'std.os' has no member called 'O_DIRECTORY'
return self.openDirFlagsZ(sub_path_c, os.O_DIRECTORY | os.O_RDONLY | os.O_CLOEXEC | O_PATH);
^
./lib/std/reset_event.zig:252:26: error: container 'std.os.linux' has no member called 'timespec'
var ts: linux.timespec = undefined;
^
./lib/std/os/linux.zig:138:12: error: use of undeclared identifier 'syscall3'
return syscall3(
^
./lib/std/time.zig:183:19: error: container 'std.os' has no member called 'timespec'
var ts: os.timespec = undefined;
^
./lib/std/os.zig:909:74: error: use of undeclared identifier 'mode_t'
pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: u32, mode: mode_t) OpenError!fd_t {
^
./lib/std/fs.zig:799:15: note: referenced here
os.openatZ(self.fd, sub_path_c, flags, 0);
^
make[2]: *** [CMakeFiles/zig_build_libstage2.dir/build.make:57: CMakeFiles/zig_build_libstage2] Error 1
make[2]: Leaving directory '/home/z/zig-bootstrap/out/build-zig-host'
make[1]: *** [CMakeFiles/Makefile2:119: CMakeFiles/zig_build_libstage2.dir/all] Error 2
make[1]: Leaving directory '/home/z/zig-bootstrap/out/build-zig-host'
Behavior tests:
[nix-shell:~/dev/zig/build]$ ./zig test ../test/stage1/behavior.zig -target sparcv9-linux
TODO buf_read_value_bytes packed struct big endian
/home/andy/dev/zig/src-self-hosted/stage2.zig:37:5: 0xb66c0c in stage2_panic (zigstage2)
@panic(ptr[0..len]);
^
/home/andy/dev/zig/src/util.cpp:20:17: 0xb2641b in zig_panic (/home/andy/dev/zig/src/util.cpp)
stage2_panic("", 0);
^
/home/andy/dev/zig/src/ir.cpp:28432:42: 0xaea1bc in buf_read_value_bytes (/home/andy/dev/zig/src/ir.cpp)
zig_panic("TODO buf_read_value_bytes packed struct big endian");
^
/home/andy/dev/zig/src/ir.cpp:28525:40: 0xaea6f3 in ir_analyze_bit_cast (/home/andy/dev/zig/src/ir.cpp)
if ((err = buf_read_value_bytes(ira, ira->codegen, source_instr->source_node, buf, result->value)))
^
/home/andy/dev/zig/src/ir.cpp:18644:54: 0xac5147 in ir_resolve_result_raw (/home/andy/dev/zig/src/ir.cpp)
bitcasted_value = ir_analyze_bit_cast(ira, &result_loc->source_instruction->base, value, dest_type);
^
/home/andy/dev/zig/src/ir.cpp:18712:50: 0xac565f in ir_resolve_result (/home/andy/dev/zig/src/ir.cpp)
IrInstGen *result_loc = ir_resolve_result_raw(ira, suspend_source_instr, result_loc_pass1, value_type,
^
/home/andy/dev/zig/src/ir.cpp:29661:46: 0xaee29f in ir_analyze_instruction_end_expr (/home/andy/dev/zig/src/ir.cpp)
IrInstGen *result_loc = ir_resolve_result(ira, &instruction->base.base, instruction->result_loc,
^
/home/andy/dev/zig/src/ir.cpp:30176:51: 0xaefb9b in ir_analyze_instruction_base (/home/andy/dev/zig/src/ir.cpp)
return ir_analyze_instruction_end_expr(ira, (IrInstSrcEndExpr *)instruction);
^
/home/andy/dev/zig/src/ir.cpp:30268:65: 0xaf00d3 in ir_analyze (/home/andy/dev/zig/src/ir.cpp)
IrInstGen *new_instruction = ir_analyze_instruction_base(ira, old_instruction);
^
/home/andy/dev/zig/src/ir.cpp:13205:38: 0xab1aee in ir_eval_const_value (/home/andy/dev/zig/src/ir.cpp)
ZigType *result_type = ir_analyze(codegen, ir_executable, analyzed_executable,
^
/home/andy/dev/zig/src/ir.cpp:19455:43: 0xac7ddd in ir_analyze_fn_call (/home/andy/dev/zig/src/ir.cpp)
if ((err = ir_eval_const_value(ira->codegen, exec_scope, body_node, result_ptr,
^
/home/andy/dev/zig/src/ir.cpp:19871:43: 0xac9a88 in ir_analyze_fn_call_src (/home/andy/dev/zig/src/ir.cpp)
IrInstGen *result = ir_analyze_fn_call(ira, &call_instruction->base.base, fn_entry, fn_type, fn_ref,
^
/home/andy/dev/zig/src/ir.cpp:20052:42: 0xaca5a0 in ir_analyze_instruction_call (/home/andy/dev/zig/src/ir.cpp)
return ir_analyze_fn_call_src(ira, call_instruction, fn_table_entry, fn_type,
^
/home/andy/dev/zig/src/ir.cpp:29954:47: 0xaef141 in ir_analyze_instruction_base (/home/andy/dev/zig/src/ir.cpp)
return ir_analyze_instruction_call(ira, (IrInstSrcCall *)instruction);
^
/home/andy/dev/zig/src/ir.cpp:30268:65: 0xaf00d3 in ir_analyze (/home/andy/dev/zig/src/ir.cpp)
IrInstGen *new_instruction = ir_analyze_instruction_base(ira, old_instruction);
^
/home/andy/dev/zig/src/analyze.cpp:4832:44: 0xb3581b in analyze_fn_ir (/home/andy/dev/zig/src/analyze.cpp)
ZigType *block_return_type = ir_analyze(g, fn->ir_executable,
^
/home/andy/dev/zig/src/analyze.cpp:4948:18: 0xb35dcb in analyze_fn_body (/home/andy/dev/zig/src/analyze.cpp)
analyze_fn_ir(g, fn_table_entry, return_type_node);
^
/home/andy/dev/zig/src/analyze.cpp:5060:28: 0xb365cc in semantic_analyze (/home/andy/dev/zig/src/analyze.cpp)
analyze_fn_body(g, fn_entry);
^
/home/andy/dev/zig/src/codegen.cpp:9662:25: 0xa7210e in gen_root_source (/home/andy/dev/zig/src/codegen.cpp)
semantic_analyze(g);
^
/home/andy/dev/zig/src/codegen.cpp:10766:28: 0xa7631c in codegen_build_and_link (/home/andy/dev/zig/src/codegen.cpp)
gen_root_source(g);
^
/home/andy/dev/zig/src/main.cpp:1741:39: 0xa49640 in main0 (/home/andy/dev/zig/src/main.cpp)
codegen_build_and_link(g);
^
/home/andy/dev/zig/src/main.cpp:1819:24: 0xa49aa1 in main (/home/andy/dev/zig/src/main.cpp)
auto result = main0(argc, argv);
^
Aborted (core dumped)
Hello world:
[nix-shell:~/dev/zig/build]$ ./zig build-exe hello.zig -target sparcv9-linux
/home/andy/dev/zig/lib/std/start.zig:119:17: error: unsupported arch
else => @compileError("unsupported arch"),
^
/home/andy/dev/zig/lib/std/event/loop.zig:1244:25: error: container 'std.os' has no member called 'mode_t'
mode: os.mode_t,
^
/home/andy/dev/zig/lib/std/event/loop.zig:1182:13: note: while checking this field
open: Open,
^
/home/andy/dev/zig/lib/std/event/loop.zig:1165:9: note: while checking this field
msg: Msg,
^
/home/andy/dev/zig/lib/std/linked_list.zig:200:13: note: while checking this field
data: T,
^
/home/andy/dev/zig/lib/std/atomic/queue.zig:10:9: note: while checking this field
head: ?*Node,
^
/home/andy/dev/zig/lib/std/event/loop.zig:1160:9: note: while checking this field
fs_queue: std.atomic.Queue(Request),
^
/home/andy/dev/zig/lib/std/event/loop.zig:16:5: note: while checking this field
os_data: OsData,
^
/home/andy/dev/zig/lib/std/event/loop.zig:96:25: note: referenced here
pub const instance: ?*Loop = if (@hasDecl(root, "event_loop")) root.event_loop else default_instance;
^
/home/andy/dev/zig/lib/std/os.zig:614:41: note: referenced here
EAGAIN => if (std.event.Loop.instance) |loop| {
^
/home/andy/dev/zig/lib/std/fs/file.zig:164:18: error: container 'std.os' has no member called 'ino_t'
inode: os.ino_t,
^
/home/andy/dev/zig/lib/std/fs/file.zig:182:38: note: referenced here
pub fn stat(self: File) StatError!Stat {
^
/home/andy/dev/zig/lib/std/fs/file.zig:142:25: note: referenced here
return (try self.stat()).size;
^
/home/andy/dev/zig/lib/std/reset_event.zig:252:26: error: container 'std.os.linux' has no member called 'timespec'
var ts: linux.timespec = undefined;
^
/home/andy/dev/zig/lib/std/os/linux.zig:785:60: error: use of undeclared identifier 'restore_rt'
const restorer_fn = if ((act.flags & SA_SIGINFO) != 0) restore_rt else restore;
^
/home/andy/dev/zig/lib/std/os/linux.zig:390:12: error: use of undeclared identifier 'syscall3'
return syscall3(.write, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), count);
^
/home/andy/dev/zig/lib/std/os/linux.zig:777:12: error: use of undeclared identifier 'syscall4'
return syscall4(.rt_sigprocmask, flags, @ptrToInt(set), @ptrToInt(oldset), NSIG / 8);
^
/home/andy/dev/zig/lib/std/os/linux.zig:773:43: error: use of undeclared identifier 'syscall0'
return @bitCast(pid_t, @truncate(u32, syscall0(.gettid)));
^
/home/andy/dev/zig/lib/std/os/linux.zig:568:12: error: use of undeclared identifier 'syscall2'
return syscall2(.tkill, @bitCast(usize, @as(isize, tid)), @bitCast(usize, @as(isize, sig)));
^
/home/andy/dev/zig/lib/std/os/linux.zig:555:9: error: use of undeclared identifier 'syscall1'
_ = syscall1(.exit_group, @bitCast(usize, @as(isize, status)));
^
/home/andy/dev/zig/lib/std/fs.zig:598:42: error: container 'std.os' has no member called 'O_CLOEXEC'
const os_flags = O_LARGEFILE | os.O_CLOEXEC | if (flags.write and flags.read)
^
/home/andy/dev/zig/lib/std/os/linux.zig:195:19: error: use of undeclared identifier 'SYS'
if (@hasField(SYS, "mmap2")) {
^
Building C hello world:
[nix-shell:~/dev/zig/build]$ ./zig build-exe --c-source hello.c -lc -target sparcv9-linux-gnu
error: unknown target CPU 'generic'
note: valid target CPU values are: v9, ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
The following command failed:
/home/andy/dev/zig/build/zig clang -c -nostdinc -fno-spell-checking -target sparcv9-unknown-linux-gnu -isystem /home/andy/dev/zig/lib/include -isystem /home/andy/dev/zig/lib/libc/include/sparcv9-linux-gnu -isystem /home/andy/dev/zig/lib/libc/include/generic-glibc -isystem /home/andy/dev/zig/lib/libc/include/sparcv9-linux-any -isystem /home/andy/dev/zig/lib/libc/include/any-linux-any -Xclang -target-cpu -Xclang generic -Xclang -target-feature -Xclang -deprecated-v8,-detectroundchange,-fixallfdivsqrt,-hard-quad-float,-hasleoncasa,-hasumacsmac,-insertnopload,-leon,-leoncyclecounter,-leonpwrpsr,-no-fmuls,-no-fsmuld,-popc,-soft-float,-soft-mul-div,-v9,-vis,-vis2,-vis3 -MD -MV -MF zig-cache/tmp/JFSP-RvBOg9S-hello.o.d -g -fno-omit-frame-pointer -fsanitize=undefined -fsanitize-trap=undefined -D_DEBUG -Og -fstack-protector-strong --param ssp-buffer-size=4 -fPIC -o zig-cache/tmp/JFSP-RvBOg9S-hello.o hello.c
If anyone needs SPARC hardware for testing, I can make some available. Andrew will put you in touch with me if necessary.
Pardon me for bumping this old thread, but is there any chance for a SPARC CI runner to happen?
The machine referenced above is gcc102.fsffrance.org
at the GCC Compile Farm: https://cfarm.tetaneutral.net/machines/list/.
Please let me know what (if anything) on the server side is needed to facilitate this.
I'm very interested in helping make this reality: Feel free to ping me for any help.
In the meantime, I'm going to play around and see what I can get working :)
Theres a duplicate field here causing compile errors targetting sparc64 linux
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
โโ install zosu2011 transitive failure
โโ zig build-exe zosu2011 Debug sparc64-linux 1 errors
C:\Users\ep1cm\Downloads\zig\lib\std\os\linux\sparc64.zig:448:5: error: duplicate struct field: 'sigmask'
sigmask: sigset_t,
^~~~~~~
C:\Users\ep1cm\Downloads\zig\lib\std\os\linux\sparc64.zig:445:5: note: other field here
sigmask: u64,
^~~~~~~
C:\Users\ep1cm\Downloads\zig\lib\std\os\linux\sparc64.zig:442:31: note: struct declared here
pub const ucontext_t = extern struct {
~~~~~~~^~~~~~
referenced by:
ucontext_t: C:\Users\ep1cm\Downloads\zig\lib\std\os\linux\sparc64.zig:442:31
ucontext_t: C:\Users\ep1cm\Downloads\zig\lib\std\os\linux.zig:87:33
remaining reference traces hidden; use '-freference-trace' to see all reference traces
should i open a separate issue for this?
no, open the pr directly and reference back to this. include the test program you got to pass and command you ran to test in the pr description