Skip to content

Commit

Permalink
zig: update to zig/0.8.1
Browse files Browse the repository at this point in the history
Update *.zig and Makefile to version 0.8.1 of the compiler.

Build system:
* avoid symbolic links to executables.  They increase complexity, are
  not useful, their timestamps or existence confuse make.
* Acknowledge that Makefile is unable to build each step separately.

Step files:
* Add commented instructions printing `ast` at the start of the EVAL
  loop.

The state in this commit now crashes with:
/lib/std/hash_map.zig:863:33: 0x20ea58 in std.hash_map.HashMap([]const
u8,*types.MalType,std.hash_map.StringContext,80).get (step6_file)
Build with release-safe until this segmentation fault is fixed

A similar crash happens with stepA during tests for step3,
investigation may be less difficult with `make REGRESS=1 test^zig^stepA^`

The original author has been contacted and intends to investigate.
  • Loading branch information
asarhaddon committed Aug 7, 2024
1 parent 857fcaf commit 3aba3a0
Show file tree
Hide file tree
Showing 22 changed files with 411 additions and 418 deletions.
13 changes: 5 additions & 8 deletions impls/zig/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ WORKDIR /mal
# Specific implementation requirements
##########################################################

RUN apt-get -y install gcc gdc ldc gpg wget

RUN wget https://ziglang.org/download/0.5.0/zig-linux-x86_64-0.5.0.tar.xz && \
echo `pwd` && \
tar -xf zig-linux-x86_64-0.5.0.tar.xz && \
cp -r zig-linux-x86_64-0.5.0 /usr/local/bin && \
ln -sf /usr/local/bin/zig-linux-x86_64-0.5.0/zig /usr/local/bin/zig && \
chmod +x /usr/local/bin/zig
RUN apt-get -y install ca-certificates gcc libc-dev libpcre3-dev xz-utils


RUN curl https://ziglang.org/download/0.8.1/zig-linux-x86_64-0.8.1.tar.xz | tar -xJC/mal
RUN ln -fst/usr/local/bin /mal/zig-linux-x86_64-0.8.1/zig

ENV HOME /mal
10 changes: 4 additions & 6 deletions impls/zig/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# This Makefile cannot build steps separately.

STEPS = step0_repl step1_read_print step2_eval step3_env step4_if_fn_do step5_tco step6_file step7_quote step8_macros step9_try stepA_mal

all: $(STEPS)

dist: mal


%: %.zig
zig build -Drelease-fast=true
ln -sf zig-cache/bin/$* .
# safe until the segfault is fixed.
zig build -Drelease-safe=true

.PHONY: clean

clean:
rm -f $(STEPS)
rm -fr zig-cache/ zig-out/
Loading

0 comments on commit 3aba3a0

Please sign in to comment.