Compare commits
9 Commits
ecfb162062
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
25cb90296f
|
|||
|
650f457c5b
|
|||
|
2f8f737bb8
|
|||
|
6381727851
|
|||
|
6307a01b6f
|
|||
|
fc57777a5b
|
|||
|
b62e56c130
|
|||
|
e742cec923
|
|||
|
b8f4e987b7
|
26
.gitea/workflows/wasm-docker.yaml
Normal file
26
.gitea/workflows/wasm-docker.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
name: Build WASM Base Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [disabled]
|
||||
# branches: [main]
|
||||
# paths:
|
||||
# - ".gitea/workflows/wasm-docker.yaml"
|
||||
# - "wasm-base.dockerfile"
|
||||
|
||||
jobs:
|
||||
wasm-docker:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Login to container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.vps.chriphost.de
|
||||
username: ${{ secrets.CONTAINER_REGISTRY_USER }}
|
||||
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
|
||||
- name: Build WASM Base Docker Image
|
||||
run: docker build --file wasm-base.dockerfile --tag gitea.vps.chriphost.de/christoph/wasm-base:latest .
|
||||
- name: Push WASM Base Docker Image
|
||||
run: docker push gitea.vps.chriphost.de/christoph/wasm-base:latest
|
||||
12
Makefile
12
Makefile
@ -1,8 +1,14 @@
|
||||
docker:
|
||||
docker build -t wasm-base -f wasm-base.dockerfile . --build-arg CACHE_DATE="$(shell date)"
|
||||
docker build -t gitea.vps.chriphost.de/christoph/wasm-base:latest -f wasm-base.dockerfile . --build-arg CACHE_DATE="$(shell date)"
|
||||
|
||||
run:
|
||||
docker run --rm -it wasm-base:latest /usr/bin/fish
|
||||
docker run --rm -it gitea.vps.chriphost.de/christoph/wasm-base:latest /usr/bin/fish
|
||||
|
||||
run-external:
|
||||
docker run --rm -it -v "./examples:/home/ubuntu/examples" wasm-base:latest /usr/bin/fish
|
||||
docker run --rm -it -v "./examples:/home/ubuntu/examples" gitea.vps.chriphost.de/christoph/wasm-base:latest /usr/bin/fish
|
||||
|
||||
bochs:
|
||||
bochs -f ./examples/arch/bochs/bochsrc-docker.txt -q
|
||||
|
||||
bochs-host:
|
||||
nix shell nixpkgs#bochs --command sh -c "bochs -f ./examples/arch/bochs/bochsrc-host.txt -q"
|
||||
|
||||
@ -1,86 +0,0 @@
|
||||
# This makefile embeds an application compiled to WASM into a native C program.
|
||||
# The WASM module will be loaded by the WASM runtime.
|
||||
|
||||
# Paths
|
||||
WAMR_ROOT := /opt/wamr
|
||||
WAMRC := /opt/wamr-wamrc/wamrc
|
||||
IWASM := /opt/wamr-iwasm/iwasm
|
||||
WAMRC_LIB := /opt/wamr-libvmlib
|
||||
IWASM_LIB := /opt/wamr-libiwasm
|
||||
|
||||
WASI_ROOT := /opt/wasi-sdk
|
||||
WASI_CC := $(WASI_ROOT)/bin/clang
|
||||
WASI_CFLAGS := --target=wasm32-wasi \
|
||||
--sysroot=$(WASI_ROOT)/share/wasi-sysroot \
|
||||
-O0 -g -Wall
|
||||
|
||||
# Embedding
|
||||
EMBED_CC := gcc
|
||||
EMBED_INCL := -I$(WAMR_ROOT)/core/iwasm/include \
|
||||
-I$(WAMR_ROOT)/core/iwasm/common \
|
||||
-I$(WAMR_ROOT)/core/shared/platform/linux \
|
||||
-I$(WAMR_ROOT)/core/shared/utils \
|
||||
-I$(WAMR_ROOT)/core/shared/utils/uncommon
|
||||
EMBED_SOURCES := $(WAMR_ROOT)/core/shared/utils/uncommon/bh_read_file.c # Not used when reading from buffer
|
||||
EMBED_CFLAGS := -O0 -g -Wall $(EMBED_INCL)
|
||||
AOT_LDFLAGS := -Wl,-rpath,$(WAMRC_LIB)
|
||||
AOT_LDLIBS := -L$(WAMRC_LIB) -lvmlib -lm
|
||||
INTER_LDFLAGS := -Wl,-rpath,$(IWASM_LIB)
|
||||
INTER_LDLIBS := -L$(IWASM_LIB) -liwasm -lm
|
||||
XXD := busybox xxd
|
||||
|
||||
# Files
|
||||
SRCS := $(wildcard *.c)
|
||||
WASMS := $(SRCS:.c=.wasm)
|
||||
CWASMS := $(SRCS:.c=_wasm.c)
|
||||
AOTS := $(SRCS:.c=.aot)
|
||||
OBJS := $(SRCS:.c=.o)
|
||||
DEPS := $(SRCS:.c=.d)
|
||||
HOSTS := $(SRCS:.c=_host.elf)
|
||||
|
||||
|
||||
.PHONY: all build-wasms build-aots build-cwasms build-hosts clean
|
||||
|
||||
all: build-wasms build-aots build-cwasms build-hosts
|
||||
|
||||
# Compile to wasm bytecode using wasi-sdk
|
||||
build-wasms: $(WASMS)
|
||||
|
||||
%.wasm: %.c
|
||||
$(WASI_CC) $(WASI_CFLAGS) $< -o $@
|
||||
|
||||
# Compile ahead-of-time module using wamrc
|
||||
build-aots: $(AOTS)
|
||||
|
||||
%.aot: %.wasm
|
||||
$(WAMRC) -o $@ $<
|
||||
|
||||
# Convert the .aot files to C-style arrays (to embed them into the resulting host binary)
|
||||
build-cwasms: $(CWASMS)
|
||||
|
||||
%_wasm.c: %.aot
|
||||
$(XXD) -i $< > $@
|
||||
|
||||
# Compile the host that will load and run the compiled wasm module
|
||||
# The compiled wasm module is embedded as C-style array
|
||||
build-hosts: $(HOSTS)
|
||||
|
||||
# The C-style array is called %_aot, e.g. test_aot
|
||||
# We have to modify the host to refer to that with the correct name
|
||||
%_host.elf: %_wasm.c
|
||||
cp embed/host.c embed/$*_host.c
|
||||
sed -i \
|
||||
-e "s@__WASM_ARRAY_FILE__@../$*_wasm.c@g" \
|
||||
-e "s@__WASM_ARRAY__@$*_aot@g" \
|
||||
-e "s@__WASM_ARRAY_LEN__@$*_aot_len@g" \
|
||||
embed/$*_host.c
|
||||
$(EMBED_CC) $(EMBED_CFLAGS) embed/$*_host.c -o $@ $(INTER_LDFLAGS) $(INTER_LDLIBS)
|
||||
|
||||
clean:
|
||||
rm -f *.wasm
|
||||
rm -f *.aot
|
||||
rm -f *_wasm.c
|
||||
rm -f *.d
|
||||
rm -f *.o
|
||||
rm -f embed/*_host.c
|
||||
rm -f *_host.elf
|
||||
@ -4,8 +4,7 @@ WASI_CC := ${WASI_ROOT}/bin/clang
|
||||
WASI_CFLAGS := --target=wasm32 \
|
||||
--sysroot=${WASI_ROOT}/share/wasi-sysroot \
|
||||
-z stack-size=4096 \
|
||||
-nostdlib \
|
||||
-O0 -g -Wall \
|
||||
-O0 -nostdlib \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--initial-memory=65536 \
|
||||
-Wl,--export-all \
|
||||
@ -16,20 +15,18 @@ WASI_CFLAGS := --target=wasm32 \
|
||||
WAMR := /opt/wamr
|
||||
IWASM_LIB := /opt/wamr-libiwasm
|
||||
CC := gcc
|
||||
CFLAGS := -I. -include arch/${ARCH}/lib.c -O0 -g -m32 -fomit-frame-pointer
|
||||
LDFLAGS := -Wl,-T linker.ld $^ -Wl,--build-id=none -static -nostdlib -m32 \
|
||||
-Wl,-rpath,${IWASM_LIB} -L${IWASM_LIB} -liwasm
|
||||
# NOTE: When compiling I get "error: bp cannot be used in ‘asm’ here"
|
||||
# I could remove "ebp" from the clobber list (ARCH_ASM_CLOBBER_ALL) or
|
||||
# use the -fomit-frame-pointer flag to tell gcc it shouldn't rely on ebp for enter/leave...
|
||||
CFLAGS := -I. -O0 -m32 -ffunction-sections -std=c11 -fomit-frame-pointer
|
||||
LDFLAGS = -Wl,-T linker.ld $^ -Wl,--build-id=none -static -nostdlib -m32 \
|
||||
-Wl,-rpath,${IWASM_LIB} -L${IWASM_LIB} -liwasm -lgcc
|
||||
INCL := -I${WAMR}/core/iwasm/include \
|
||||
-I${WAMR}/core/iwasm/common \
|
||||
-I${WAMR}/core/shared/platform/include \
|
||||
-I${WAMR}/core/shared/platform/linux \
|
||||
-I${WAMR}/core/shared/mem-alloc \
|
||||
-I${WAMR}/core/shared/utils \
|
||||
-I${WAMR}/core/shared/utils/uncommon
|
||||
-I${WAMR}/core/shared/utils \
|
||||
-I${WAMR}/core/shared/platform/baremetal
|
||||
WAMRC := /opt/wamr-wamrc/wamrc
|
||||
WAMRCFLAGS := --target=i386 --format=object
|
||||
XXD := busybox xxd
|
||||
WASM2C := wasm2c
|
||||
|
||||
|
||||
################################################################
|
||||
@ -45,7 +42,7 @@ ${BUILD_DIR}/%/module.wasm: %.c
|
||||
# ${WAMRC} ${WAMRCFLAGS} -o ${BUILD_DIR}/$*/system.o ${BUILD_DIR}/$*/module.wasm
|
||||
#
|
||||
# ${BUILD_DIR}/startup.o: arch/bochs/startup.s
|
||||
# ${CC} $< ${CFLAGS} -c -ffunction-sections -o $@
|
||||
# ${CC} $< ${CFLAGS} -c -o $@
|
||||
#
|
||||
# ${BUILD_DIR}/%/system.elf: ${BUILD_DIR}/%/system.o ${BUILD_DIR}/startup.o
|
||||
# ${CC} ${LDFLAGS} -o $@
|
||||
@ -66,10 +63,10 @@ ${BUILD_DIR}/%/system.o: ${BUILD_DIR}/%/module_wasm.c
|
||||
-e "s/__WASM_ARRAY__/build_bochs_$*_module_aot/g" \
|
||||
-e "s/__WASM_ARRAY_LEN__/build_bochs_$*_module_aot_len/g" \
|
||||
${BUILD_DIR}/$*/module_host.c
|
||||
${CC} ${CFLAGS} ${INCL} -c -ffunction-sections ${BUILD_DIR}/$*/module_host.c -o $@
|
||||
${CC} ${CFLAGS} ${INCL} -c ${BUILD_DIR}/$*/module_host.c -o $@
|
||||
|
||||
${BUILD_DIR}/startup.o: arch/bochs/startup.s
|
||||
${CC} $< ${CFLAGS} -c -ffunction-sections -o $@
|
||||
${CC} $< ${CFLAGS} -c -o $@
|
||||
|
||||
${BUILD_DIR}/%/system.elf: ${BUILD_DIR}/%/system.o ${BUILD_DIR}/startup.o
|
||||
${CC} ${LDFLAGS} -o $@
|
||||
@ -88,11 +85,12 @@ BOCHS_RUNNER_ARGS = \
|
||||
-V arch/bochs/vgabios.bin \
|
||||
-b arch/bochs/BIOS-bochs-latest \
|
||||
|
||||
${BUILD_DIR}/%/trace.pb: ${BUILD_DIR}/%/system.iso
|
||||
# ${BUILD_DIR}/%/trace.pb: ${BUILD_DIR}/%/system.iso
|
||||
${BUILD_DIR}/%/trace.pb:
|
||||
${BOCHS_RUNNER} ${BOCHS_RUNNER_ARGS} -1 \
|
||||
-f ${FAIL_TRACE} \
|
||||
-e $(shell dirname $<)/system.elf \
|
||||
-i $(shell dirname $<)/system.iso \
|
||||
-e $(shell dirname $<)/$*/system.elf \
|
||||
-i $(shell dirname $<)/$*/system.iso \
|
||||
-- \
|
||||
-Wf,--state-file=$(shell dirname $<)/state \
|
||||
-Wf,--trace-file=$(shell dirname $<)/trace.pb \
|
||||
|
||||
9
examples/arch/bochs/bochsrc-docker.txt
Normal file
9
examples/arch/bochs/bochsrc-docker.txt
Normal file
@ -0,0 +1,9 @@
|
||||
megs: 32
|
||||
display_library: nogui
|
||||
romimage: file=/home/ubuntu/examples/arch/bochs/BIOS-bochs-latest
|
||||
vgaromimage: file=/home/ubuntu/examples/arch/bochs/vgabios.bin
|
||||
ata0-master: type=cdrom, path=/home/ubuntu/examples/build-bochs/sum/system.iso, status=inserted
|
||||
boot: cdrom
|
||||
log: bochslog.txt
|
||||
clock: sync=realtime, time0=local
|
||||
cpu: count=1, ips=1000000
|
||||
10
examples/arch/bochs/bochsrc-host.txt
Normal file
10
examples/arch/bochs/bochsrc-host.txt
Normal file
@ -0,0 +1,10 @@
|
||||
megs: 32
|
||||
display_library: nogui
|
||||
romimage: file="/home/christoph/Notes/TU/MastersThesis/3 Wasm/examples/arch/bochs/BIOS-bochs-latest"
|
||||
vgaromimage: file="/home/christoph/Notes/TU/MastersThesis/3 Wasm/examples/arch/bochs/vgabios.bin"
|
||||
ata0-master: type=cdrom, path="/home/christoph/Notes/TU/MastersThesis/3 Wasm/examples/build-bochs/sum/system.iso", status=inserted
|
||||
boot: cdrom
|
||||
log: bochslog.txt
|
||||
clock: sync=realtime, time0=local
|
||||
cpu: count=1, ips=1000000
|
||||
sound: driver=dummy
|
||||
@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define ARCH_ASM_CLOBBER_ALL "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp"
|
||||
|
||||
88
examples/arch/linux.mk
Normal file
88
examples/arch/linux.mk
Normal file
@ -0,0 +1,88 @@
|
||||
# C -> WASM
|
||||
WASI_ROOT := /opt/wasi-sdk
|
||||
WASI_CC := ${WASI_ROOT}/bin/clang
|
||||
WASI_CFLAGS := --target=wasm64 \
|
||||
--sysroot=${WASI_ROOT}/share/wasi-sysroot \
|
||||
-z stack-size=4096 \
|
||||
-O0 -g -nostdlib \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--initial-memory=65536 \
|
||||
-Wl,--export-all \
|
||||
-Wl,--export=__heap_base \
|
||||
-Wl,--export=__data_end
|
||||
|
||||
# WASM -> Baremetal
|
||||
WAMR := /opt/wamr
|
||||
IWASM_LIB := /opt/wamr-libiwasm-64
|
||||
CC := gcc
|
||||
# NOTE: When compiling I get "error: bp cannot be used in ‘asm’ here"
|
||||
# I could remove "ebp" from the clobber list (ARCH_ASM_CLOBBER_ALL) or
|
||||
# use the -fomit-frame-pointer flag to tell gcc it shouldn't rely on ebp for enter/leave...
|
||||
CFLAGS := -I. -O0 -g -ffunction-sections -std=c11 -fomit-frame-pointer
|
||||
LDFLAGS = $^ -Wl,--build-id=none -static -nostdlib \
|
||||
-Wl,-rpath,${IWASM_LIB} -L${IWASM_LIB} -liwasm -lgcc
|
||||
INCL := -I${WAMR}/core/iwasm/include \
|
||||
-I${WAMR}/core/shared/utils \
|
||||
-I${WAMR}/core/shared/platform/baremetal
|
||||
WAMRC := /opt/wamr-wamrc/wamrc
|
||||
WAMRCFLAGS := --target=i386 --format=object
|
||||
XXD := busybox xxd
|
||||
|
||||
|
||||
################################################################
|
||||
# C -> WASM
|
||||
${BUILD_DIR}/%/module.wasm: %.c
|
||||
mkdir -p $(shell dirname $@)
|
||||
${WASI_CC} ${WASI_CFLAGS} $< -o $@
|
||||
|
||||
|
||||
################################################################
|
||||
# WASM -> Native Object File
|
||||
# ${BUILD_DIR}/%/system.o: ${BUILD_DIR}/%/module.wasm
|
||||
# ${WAMRC} ${WAMRCFLAGS} -o ${BUILD_DIR}/$*/system.o ${BUILD_DIR}/$*/module.wasm
|
||||
#
|
||||
# ${BUILD_DIR}/startup.o: arch/bochs/startup.s
|
||||
# ${CC} $< ${CFLAGS} -c -o $@
|
||||
#
|
||||
# ${BUILD_DIR}/%/system.elf: ${BUILD_DIR}/%/system.o ${BUILD_DIR}/startup.o
|
||||
# ${CC} ${LDFLAGS} -o $@
|
||||
|
||||
|
||||
################################################################
|
||||
# WASM -> AOT -> Loaded by Runtime
|
||||
${BUILD_DIR}/%/module.aot: ${BUILD_DIR}/%/module.wasm
|
||||
${WAMRC} -o $@ $<
|
||||
|
||||
${BUILD_DIR}/%/module_wasm.c: ${BUILD_DIR}/%/module.aot
|
||||
${XXD} -i $< > $@
|
||||
|
||||
${BUILD_DIR}/%/system.o: ${BUILD_DIR}/%/module_wasm.c
|
||||
cp embed/host.c ${BUILD_DIR}/$*/module_host.c
|
||||
sed -i \
|
||||
-e "s/__WASM_ARRAY_FILE__/module_wasm.c/g" \
|
||||
-e "s/__WASM_ARRAY__/build_linux_$*_module_aot/g" \
|
||||
-e "s/__WASM_ARRAY_LEN__/build_linux_$*_module_aot_len/g" \
|
||||
${BUILD_DIR}/$*/module_host.c
|
||||
${CC} ${CFLAGS} ${INCL} -c ${BUILD_DIR}/$*/module_host.c -o $@
|
||||
|
||||
${BUILD_DIR}/startup.o: arch/bochs/startup.s
|
||||
${CC} $< ${CFLAGS} -c -o $@
|
||||
|
||||
${BUILD_DIR}/%/system.elf: ${BUILD_DIR}/%/system.o ${BUILD_DIR}/startup.o
|
||||
${CC} ${LDFLAGS} -o $@
|
||||
|
||||
|
||||
define arch-make-targets
|
||||
|
||||
build-$1: ${BUILD_DIR}/$1/system.elf
|
||||
|
||||
gdb-$1:
|
||||
gdb --tui ${BUILD_DIR}/$1/system.elf
|
||||
|
||||
valgrind-$1:
|
||||
valgrind ${BUILD_DIR}/$1/system.elf
|
||||
|
||||
objdump-$1:
|
||||
objdump --disassemble --start-address=0x401000 --stop-address=0x401200 --disassembler-options intel --disassembler-color=on --source ${BUILD_DIR}/$1/system.elf
|
||||
|
||||
endef
|
||||
@ -1,18 +1,14 @@
|
||||
// https://github.com/bytecodealliance/wasm-micro-runtime/blob/WAMR-2.4.4/doc/embed_wamr.md
|
||||
|
||||
// #include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lib.c"
|
||||
|
||||
// #include "bh_read_file.h"
|
||||
#include "bh_platform.h"
|
||||
#include "wasm_export.h"
|
||||
|
||||
#include "__WASM_ARRAY_FILE__"
|
||||
|
||||
#define STACK_SIZE (8 * 1024)
|
||||
#define HEAP_SIZE (8 * 1024)
|
||||
#define STACK_SIZE (4 * 1024)
|
||||
#define HEAP_SIZE (4 * 1024)
|
||||
|
||||
// TODO: Set this up so the lsp actually finds the includes...
|
||||
|
||||
@ -22,14 +18,16 @@ MAIN() {
|
||||
wasm_module_inst_t module_inst;
|
||||
wasm_function_inst_t func;
|
||||
wasm_exec_env_t exec_env;
|
||||
uint32 stack_size = 8 * 1024;
|
||||
uint32 heap_size = 8 * 1024;
|
||||
|
||||
/* initialize the wasm runtime */
|
||||
static char global_heap_buf[HEAP_SIZE];
|
||||
RuntimeInitArgs init_args;
|
||||
memset(&init_args, 0, sizeof(init_args));
|
||||
memset(&init_args, 0, sizeof(RuntimeInitArgs));
|
||||
|
||||
init_args.mem_alloc_type = Alloc_With_System_Allocator;
|
||||
init_args.mem_alloc_type = Alloc_With_Pool;
|
||||
init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
|
||||
init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
|
||||
init_args.max_thread_num = 1;
|
||||
if (!wasm_runtime_full_init(&init_args)) {
|
||||
return;
|
||||
}
|
||||
@ -39,14 +37,14 @@ MAIN() {
|
||||
sizeof(error_buf));
|
||||
|
||||
/* create an instance of the WASM module (WASM linear memory is ready) */
|
||||
module_inst = wasm_runtime_instantiate(module, stack_size, heap_size,
|
||||
module_inst = wasm_runtime_instantiate(module, STACK_SIZE, HEAP_SIZE,
|
||||
error_buf, sizeof(error_buf));
|
||||
|
||||
/* lookup a WASM function by its name, the function signature can NULL here */
|
||||
func = wasm_runtime_lookup_function(module_inst, "wasm_module");
|
||||
|
||||
/* create an execution environment to execute arbitrary WASM functions */
|
||||
exec_env = wasm_runtime_create_exec_env(module_inst, stack_size);
|
||||
exec_env = wasm_runtime_create_exec_env(module_inst, STACK_SIZE);
|
||||
|
||||
/* arguments are always transferred in 32-bit element */
|
||||
uint32 args[1];
|
||||
|
||||
@ -6,6 +6,10 @@
|
||||
#define __QUOTE(x) #x
|
||||
#define QUOTE(x) __QUOTE(x)
|
||||
|
||||
#ifndef ARCH_ASM_CLOBBER_ALL
|
||||
#define ARCH_ASM_CLOBBER_ALL "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp"
|
||||
#endif
|
||||
|
||||
#ifndef MARKER
|
||||
#define MARKER(str) \
|
||||
__asm__ volatile(QUOTE(str) ":" \
|
||||
|
||||
@ -31,21 +31,21 @@ RUN git clone https://gitea.vps.chriphost.de/christoph/wamr \
|
||||
WORKDIR /wamr
|
||||
|
||||
# Build WAMR iwasm (vmcore standalone interpreter)
|
||||
# RUN cd product-mini/platforms/linux \
|
||||
# && mkdir build_iwasm && cd build_iwasm \
|
||||
# && cmake \
|
||||
# -DWAMR_BUILD_PLATFORM=linux \
|
||||
# -DWAMR_BUILD_TARGET=X86_64 \
|
||||
# -DWAMR_BUILD_AOT=0 \
|
||||
# -DWAMR_BUILD_WAMR_COMPILER=0 \
|
||||
# -DWAMR_BUILD_INTERP=1 \
|
||||
# -DWAMR_BUILD_FAST_INTERP=0 \
|
||||
# -DWAMR_BUILD_JIT=0 \
|
||||
# -DWAMR_BUILD_FAST_JIT=0 \
|
||||
# -DWAMR_BUILD_LIBC_BUILTIN=1 \
|
||||
# -DWAMR_BUILD_LIBC_WASI=1 \
|
||||
# .. \
|
||||
# && make -j$(nproc)
|
||||
RUN cd product-mini/platforms/linux \
|
||||
&& mkdir build_iwasm && cd build_iwasm \
|
||||
&& cmake \
|
||||
-DWAMR_BUILD_PLATFORM=linux \
|
||||
-DWAMR_BUILD_TARGET=X86_64 \
|
||||
-DWAMR_BUILD_AOT=0 \
|
||||
-DWAMR_BUILD_WAMR_COMPILER=0 \
|
||||
-DWAMR_BUILD_INTERP=1 \
|
||||
-DWAMR_BUILD_FAST_INTERP=0 \
|
||||
-DWAMR_BUILD_JIT=0 \
|
||||
-DWAMR_BUILD_FAST_JIT=0 \
|
||||
-DWAMR_BUILD_LIBC_BUILTIN=1 \
|
||||
-DWAMR_BUILD_LIBC_WASI=1 \
|
||||
.. \
|
||||
&& make -j$(nproc)
|
||||
|
||||
# Build WAMR wamrc (standalone compiler)
|
||||
RUN cd wamr-compiler \
|
||||
@ -110,6 +110,24 @@ RUN mkdir build_libiwasm && cd build_libiwasm \
|
||||
-DWAMR_BUILD_LIBC_BUILTIN=1 \
|
||||
-DWAMR_BUILD_LIBC_WASI=0 \
|
||||
-DWAMR_BUILD_SIMD=0 \
|
||||
-DCMAKE_COLOR_DIAGNOSTICS=ON \
|
||||
.. \
|
||||
&& make -j$(nproc)
|
||||
|
||||
RUN mkdir build_libiwasm_64 && cd build_libiwasm_64 \
|
||||
&& cmake \
|
||||
-DWAMR_BUILD_PLATFORM=baremetal \
|
||||
-DWAMR_BUILD_TARGET=X86_64 \
|
||||
-DWAMR_BUILD_AOT=0 \
|
||||
-DWAMR_BUILD_WAMR_COMPILER=0 \
|
||||
-DWAMR_BUILD_INTERP=1 \
|
||||
-DWAMR_BUILD_FAST_INTERP=0 \
|
||||
-DWAMR_BUILD_JIT=0 \
|
||||
-DWAMR_BUILD_FAST_JIT=0 \
|
||||
-DWAMR_BUILD_LIBC_BUILTIN=1 \
|
||||
-DWAMR_BUILD_LIBC_WASI=0 \
|
||||
-DWAMR_BUILD_SIMD=0 \
|
||||
-DCMAKE_COLOR_DIAGNOSTICS=ON \
|
||||
.. \
|
||||
&& make -j$(nproc)
|
||||
|
||||
@ -128,18 +146,23 @@ RUN apt-get update \
|
||||
neovim \
|
||||
ranger \
|
||||
wabt \
|
||||
gdb \
|
||||
valgrind \
|
||||
fish \
|
||||
grub-common \
|
||||
xorriso \
|
||||
grub-pc-bin \
|
||||
bochs \
|
||||
&& apt-get clean
|
||||
|
||||
COPY --from=wamr-builder /wamr /opt/wamr
|
||||
COPY --from=wamr-builder /wamrlib /opt/wamrlib
|
||||
COPY --from=wamr-builder /wamrlib /opt/wamr
|
||||
COPY --from=wamr-builder /wamr/wamr-compiler/build_wamrc /opt/wamr/wamr-compiler/build_wamrc
|
||||
COPY --from=wamr-builder /wamr/product-mini/platforms/linux/build_iwasm /opt/wamr/product-mini/platforms/linux/build_iwasm
|
||||
RUN ln -sf /opt/wamr/product-mini/platforms/linux/build_iwasm /opt/wamr-iwasm \
|
||||
&& ln -sf /opt/wamr/wamr-compiler/build_wamrc /opt/wamr-wamrc \
|
||||
&& ln -sf /opt/wamrlib/wamr-compiler/build_libvmlib /opt/wamr-libvmlib \
|
||||
&& ln -sf /opt/wamrlib/build_libiwasm /opt/wamr-libiwasm
|
||||
&& ln -sf /opt/wamr/wamr-compiler/build_libvmlib /opt/wamr-libvmlib \
|
||||
&& ln -sf /opt/wamr/build_libiwasm /opt/wamr-libiwasm \
|
||||
&& ln -sf /opt/wamr/build_libiwasm_64 /opt/wamr-libiwasm-64
|
||||
|
||||
COPY ./examples /home/ubuntu/examples
|
||||
WORKDIR /home/ubuntu/examples
|
||||
|
||||
Reference in New Issue
Block a user