From d53d1e56b02acb3e44dcad6d9f86f5ea28c10873 Mon Sep 17 00:00:00 2001 From: Alyssa Evans Date: Thu, 3 Jul 2025 17:35:22 +0000 Subject: [PATCH 1/2] fix: lock rustc to support wasm32-wasi target --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6e4c1b9..9ea80d6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -28,10 +28,10 @@ ENV WASMER_DIR="/home/user/.wasmer" ENV WASMER_CACHE_DIR="/home/user/.wasmer/cache" ENV PATH="/home/user/.wasmer/bin:/home/user/.wasienv/bin/:${PATH}:/home/user/.wasmer/globals/wapm_packages/.bin" -RUN curl -sSf https://sh.rustup.rs | bash -s -- -y +RUN curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain=1.81.0 ENV PATH="/home/user/.cargo/bin:${PATH}" RUN rustup target add wasm32-wasi -RUN cargo install cargo-wasi +RUN cargo install --locked cargo-wasi ENTRYPOINT ["/usr/bin/dumb-init", "--"] CMD echo "No command specified" From ee0eecc78bdf58730faea8bf4bd499eb8425a255 Mon Sep 17 00:00:00 2001 From: Alyssa Evans Date: Thu, 3 Jul 2025 12:16:24 -0700 Subject: [PATCH 2/2] fix: C++11 compatibility issue --- CMakeLists.txt | 5 +++++ README.md | 11 +++++++++++ src/wasm2brs.cc | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aff2843..c13ff63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.13.4) project(WASM2BRS VERSION 1.0.0) +# Require C++11 standard for the project +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + add_subdirectory(third_party/wabt) add_subdirectory(third_party/binaryen) diff --git a/README.md b/README.md index db8575a..d50f0d3 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,17 @@ git submodule update --init --recursive To run `make` without the Docker image (not recommended) be sure to install the same dependencies as listed in the `Dockerfile`. +## Build Requirements +- C++11 compatible compiler +- CMake 3.13.4 or higher +- If building manually, set the C++11 standard explicitly: + ```bash + mkdir -p build/wasm2brs + cd build/wasm2brs + cmake ../.. -DCMAKE_CXX_FLAGS="-std=c++11" + make -j + ``` + # Running the samples ```bash ./run.sh make doom diff --git a/src/wasm2brs.cc b/src/wasm2brs.cc index 7c268f7..9a3e680 100644 --- a/src/wasm2brs.cc +++ b/src/wasm2brs.cc @@ -124,7 +124,7 @@ int ProgramMain(int argc, char** argv) { result = ParseWatModule(lexer.get(), &module, &errors, &options); } else { location_type = Location::Type::Binary; - module = std::make_unique(); + module = MakeUnique(); const bool kStopOnFirstError = true; const bool kFailOnCustomSectionError = true; ReadBinaryOptions options(s_features, s_log_stream.get(),