Open alexmro opened 1 day ago
You will need a command more like
$ clang -fno-strict-aliasing --target=wasm32-wasi --sysroot=/usr/wasm32-wasi -I../../src/c/include -Wl,--no-entry,--export=__heap_base,--export=__data_end,--export=malloc,--export=free,--stack-first,-z,stack-size=$((8*1024*1024)) -mexec-model=reactor --rtlib=compiler-rt -o myapp.wasm luw-echo-request.c -L../../src/c -lunit-wasm
-I../../src/c/include
is the location of the unit-wasm.h
header file
-L../../src/c
is the location of the libunit-wasm.a
static library
The actual command that compiles the luw-echo-request.c is
clang -O2 -Wall -Wextra -Wdeclaration-after-statement -Wvla -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wimplicit-function-declaration -Wimplicit-int -Wint-conversion -std=gnu11 -g -fno-common -fno-strict-aliasing --target=wasm32-wasi --sysroot=/usr/wasm32-wasi -I../../src/c/include -Wl,--no-entry,--export=__heap_base,--export=__data_end,--export=malloc,--export=free,--stack-first,-z,stack-size=$((8*1024*1024)) -mexec-model=reactor --rtlib=compiler-rt -o luw-echo-request.wasm luw-echo-request.c -L../../src/c -lunit-wasm
If you are able to build libunit-wasm and the C examples, i.e.
$ make examples
or
$ make V=1 examples
To see exactly what's being done.
Then you should be good to go with the above command...
Thanks, my final command was
clang -O2 -Wall -Wextra -Wdeclaration-after-statement -Wvla -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wimplicit-function-declaration -Wimplicit-int -Wint-conversion -std=gnu11 -g -fno-common -fno-strict-aliasing --target=wasm32-wasi --sysroot= -I../../src/c/include -Wl,--no-entry,--export=__heap_base,--export=__data_end,--export=malloc,--export=free,--stack-first,-z,stack-size=$((8*1024*1024)) -mexec-model=reactor --rtlib=compiler-rt -o luw-echo-request.wasm luw-echo-request.c -L../../src/c -lunit-wasm
I had to include another directory
When I try to build some of the examples with clang, using
clang -o myapp.wasm luw-echo-request.c -lunit-wasm
, I get this error: