wasi-libc
wasi-libc copied to clipboard
Review of errors and warnings, while porting/patching GNU make port
Hi there. I wanted to practice in using LLVM backend, for WebAssembly, while compiling with Clang (without usage of emscripten, in the current pipeline).
I will have to re-write most of the code and resolve license collisions, in the future - but the general purpose of the project is pretty much obvious: it would allow to run "make" inside wasm runtime, in the browser, to perform batch execution of build scripts.
Here is my repo:
https://github.com/advancedwebdeveloper/make_wasm .
I am currently resolving issues and patching file in https://github.com/advancedwebdeveloper/make_wasm/tree/master/src folder - but I haven't got to investigation of errors in https://github.com/advancedwebdeveloper/make_wasm/tree/master/lib directory.
It makes sense to track the summary of all libc calls, which "make" tool requires. Please advise a proper tool, for this. I would report what I have collected.
Ivan
Oh, and it makes sense to rewrite unit tests of "make" tool (could be launched by executing https://github.com/advancedwebdeveloper/make_wasm/blob/master/tests/run_make_tests shell script ) and run similar tests for wasm part (under the sandbox).
It's odd but not all original tests are successful:
Running tests for GNU make on ... GNU Make 4.2.1
Finding tests...
features/archives ....................................... ok (12 passed) features/comments ....................................... ok (1 passed) features/conditionals ................................... ok (5 passed) features/default_names .................................. ok (3 passed) features/double_colon ................................... ok (14 passed) features/echoing ........................................ ok (4 passed) features/errors ......................................... FAILED (3/7 passed) features/escape ......................................... Error running make (expected 0; got 512): 'make' '-f' 'work/features/escape.mk.3' FAILED (9/10 passed) features/exec ........................................... ok (16 passed) features/export ......................................... ok (12 passed) features/grouped_targets ................................ Error running make (expected 0; got 512): make -f work/features/grouped_targets.mk.1 foo Error running make (expected 512; got 0): 'make' '-f' 'work/features/grouped_targets.mk.5' Error running make (expected 0; got 512): 'make' '-f' 'work/features/grouped_targets.mk.6' FAILED (2/12 passed) features/include ........................................ Error running make (expected 512; got 0): 'make' '-f' 'work/features/include.mk.17' FAILED (17/19 passed) features/jobserver ...................................... FAILED (3/6 passed) features/load ........................................... ok (5 passed) features/loadapi ........................................ ok (3 passed) features/mult_rules ..................................... ok (2 passed) features/mult_targets ................................... ok (2 passed) features/order_only ..................................... ok (10 passed) features/output-sync .................................... FAILED (14/15 passed) features/override ....................................... ok (4 passed) features/parallelism .................................... Error running make (expected 0; got 512): 'make' '-f' 'work/features/parallelism.mk.1' FAILED (12/13 passed) features/patspecific_vars ............................... ok (10 passed) features/patternrules ................................... Test timed out after 5 seconds Error running make (expected 0; got 14): make -f work/features/patternrules.mk.10 -j2
Caught signal 14! Error running make (expected 0; got 512): make -f work/features/patternrules.mk.11 "some file.xx" FAILED (10/12 passed) features/quoting ........................................ ok (1 passed) features/recursion ...................................... FAILED (2/3 passed) features/reinvoke ....................................... ok (5 passed) features/rule_glob ...................................... ok (3 passed) features/se_explicit .................................... Error running make (expected 0; got 139): 'make' '-f' 'work/features/se_explicit.mk.9'
Caught signal 11! FAILED (11/12 passed) features/se_implicit .................................... FAILED (11/13 passed) features/se_statpat ..................................... ok (4 passed) features/shell_assignment ............................... ok (4 passed) features/statipattrules ................................. ok (8 passed) features/suffixrules .................................... Error running make (expected 512; got 0): make -f work/features/suffixrules.mk.3 X= foo.biz FAILED (5/9 passed) features/targetvars ..................................... FAILED (26/27 passed) features/utf8 ........................................... ok (1 passed) features/varnesting ..................................... ok (2 passed) features/vpath .......................................... ok (2 passed) features/vpath2 ......................................... ok (1 passed) features/vpath3 ......................................... ok (1 passed) features/vpathgpath ..................................... ok (1 passed) features/vpathplus ...................................... ok (4 passed) functions/abspath ....................................... ok (1 passed) functions/addprefix ..................................... ok (1 passed) functions/addsuffix ..................................... ok (2 passed) functions/andor ......................................... ok (2 passed) functions/basename ...................................... ok (1 passed) functions/call .......................................... ok (3 passed) functions/dir ........................................... ok (1 passed) functions/error ......................................... ok (5 passed) functions/eval .......................................... ok (9 passed) functions/file .......................................... ok (15 passed) functions/filter-out .................................... ok (5 passed) functions/findstring .................................... ok (1 passed) functions/flavor ........................................ ok (1 passed) functions/foreach ....................................... ok (6 passed) functions/guile ......................................... Error running make (expected 0; got 512): 'make' '-f' 'work/functions/guile.mk.1' FAILED (7/8 passed) functions/if ............................................ ok (1 passed) functions/join .......................................... ok (1 passed) functions/notdir ........................................ ok (1 passed) functions/origin ........................................ ok (1 passed) functions/realpath ...................................... ok (3 passed) functions/shell ......................................... Error running make (expected 0; got 512): 'make' '-f' 'work/functions/shell.mk.3' FAILED (4/8 passed) functions/sort .......................................... ok (2 passed) functions/strip ......................................... ok (2 passed) functions/substitution .................................. ok (3 passed) functions/suffix ........................................ ok (1 passed) functions/value ......................................... ok (1 passed) functions/warning ....................................... ok (5 passed) functions/wildcard ...................................... FAILED (6/10 passed) functions/word .......................................... ok (16 passed) misc/bs-nl .............................................. ok (28 passed) misc/close_stdout ....................................... N/A misc/fopen-fail ......................................... ok (1 passed) misc/general1 ........................................... ok (1 passed) misc/general2 ........................................... ok (1 passed) misc/general3 ........................................... ok (14 passed) misc/general4 ........................................... FAILED (7/9 passed) misc/utf8 ............................................... ok (1 passed) options/dash-B .......................................... ok (8 passed) options/dash-C .......................................... ok (2 passed) options/dash-I .......................................... ok (3 passed) options/dash-W .......................................... ok (10 passed) options/dash-e .......................................... ok (1 passed) options/dash-f .......................................... ok (4 passed) options/dash-k .......................................... ok (3 passed) options/dash-l .......................................... ok (1 passed) options/dash-n .......................................... ok (6 passed) options/dash-q .......................................... ok (11 passed) options/dash-s .......................................... Error running make (expected 0; got 512): make -f work/options/dash-s.mk --no-silent Error running make (expected 0; got 512): make -f work/options/dash-s.mk -s --no-silent Error running make (expected 0; got 512): make -f work/options/dash-s.mk --silent --no-silent Error running make (expected 0; got 512): make -f work/options/dash-s.mk --quiet --no-silent Error running make (expected 0; got 512): make -f work/options/dash-s.mk --no-silent -s Error running make (expected 0; got 512): make -f work/options/dash-s.mk --no-silent --silent Error running make (expected 0; got 512): make -f work/options/dash-s.mk --no-silent --quiet FAILED (4/11 passed) options/dash-t .......................................... ok (2 passed) options/eval ............................................ Error running make (expected 0; got 512): 'make' '-f' 'work/options/eval.mk.3' '-E' '$(info eval)' 'FOO=$(BAR)' FAILED (4/5 passed) options/general ......................................... ok (2 passed) options/print-directory ................................. ok (4 passed) options/symlinks ........................................ ok (10 passed) options/warn-undefined-variables ........................ ok (2 passed) targets/DEFAULT ......................................... ok (1 passed) targets/DELETE_ON_ERROR ................................. ok (2 passed) targets/FORCE ........................................... ok (1 passed) targets/INTERMEDIATE .................................... FAILED (6/8 passed) targets/ONESHELL ........................................ ok (5 passed) targets/PHONY ........................................... ok (1 passed) targets/POSIX ........................................... FAILED (3/4 passed) targets/SECONDARY ....................................... FAILED (11/12 passed) targets/SILENT .......................................... FAILED (2/3 passed) targets/clean ........................................... ok (2 passed) variables/CURDIR ........................................ ok (1 passed) variables/DEFAULT_GOAL .................................. ok (5 passed) variables/EXTRA_PREREQS ................................. Error running make (expected 512; got 0): 'make' '-f' 'work/variables/EXTRA_PREREQS.mk.7' Error running make (expected 512; got 0): make -f work/variables/EXTRA_PREREQS.mk.8 -k Error running make (expected 512; got 0): make -f work/variables/EXTRA_PREREQS.mk.9 -k FAILED (0/13 passed) variables/GNUMAKEFLAGS .................................. ok (3 passed) variables/INCLUDE_DIRS .................................. ok (2 passed) variables/LIBPATTERNS ................................... ok (2 passed) variables/MAKE .......................................... ok (1 passed) variables/MAKECMDGOALS .................................. ok (3 passed) variables/MAKEFILES ..................................... ok (2 passed) variables/MAKEFLAGS ..................................... ok (3 passed) variables/MAKELEVEL ..................................... ok (1 passed) variables/MAKE_RESTARTS ................................. ok (3 passed) variables/MFILE_LIST .................................... FAILED (1/2 passed) variables/SHELL ......................................... ok (8 passed) variables/automatic ..................................... ok (7 passed) variables/define ........................................ ok (16 passed) variables/flavors ....................................... FAILED (10/11 passed) variables/negative ...................................... ok (4 passed) variables/private ....................................... ok (10 passed) variables/special ....................................... ok (6 passed) variables/undefine ...................................... ok (4 passed) vms/library ............................................. N/A
72 Tests in 26 Categories Failed (See .diff* files in work dir for details) :-(
WASI libc doesn't yet support launching child processes, which will be a major blocker for make.
If you're interested in understanding the specific failures, could you post more information about your setup? Are you using wasi-sdk? What are the actual failure messages? What are the compiler command-line arguments in the failing cases?