# Final Project: Contribute to [Ripes](https://github.com/mortbopet/Ripes) ###### tags: `Computer Architecture 2021` **Issue: Ripes - web edition (Qt for WebAssembly) [#188](https://github.com/mortbopet/Ripes/issues/188)** I pick up this issue to my final project because I have another class about developind desktop application in C++ this semester. And [Ripes](https://github.com/mortbopet/Ripes) was develop by Qt/C++, so I think that it will be easier to get started than other topic. ### expectation 1. Analysis [issue #188](https://github.com/mortbopet/Ripes/issues/188) and make necessary preparations, like update Qt version, build latest Ripes with Qt/WebAssembly. Figure out the problems during the update and if the dependencies QtSvg, QtCharts have relative WebAssembly output. 2. Give public comments on Github Issue about current progress and experiment. 3. Compile Ripe(old version) to WebAssembly and reproduce author's progress, and write down the detail of progress. ## desktop version ```shell git clone --recursive https://github.com/mortbopet/Ripes.git cd Ripes/ mkdir build && cd build cmake .. make ``` requirement: - Qt5.15+(need to be update in readme), Qtchart - cmake - install package `mesa-common-dev`, `libgl1-mesa-dev`, `libglu1-mesa-dev` - specify `CMAKE_PREFIX_PATH` to correct installed Qt path result: :::success success ::: ## WebAssembly ### install [Emscripten](https://emscripten.org/docs/getting_started/downloads.html)(toolchain to WebAssembly) ``` # Get the emsdk repo git clone https://github.com/emscripten-core/emsdk.git # Enter that directory cd emsdk # Download and install SDK tools. ./emsdk install 1.39.8 # Make the "1.39.8" SDK "active" for the current user. (writes .emscripten file) ./emsdk activate --embedded 1.39. # Activate PATH and other environment variables in the current terminal source ./emsdk_env.sh ``` Download Qt5.15 WebAssembly package and specify `CMAKE_PREFIX_PATH` to it. result: :::danger error🚫 ```shell [ 8%] Building CXX object external/VSRTL/graphics/CMakeFiles/vsrtl_gfx_lib.dir/vsrtl_gfx_lib_autogen/mocs_compilation.cpp.o In file included from /home/kuouu/Ripes/external/VSRTL/graphics/vsrtl_gfx_lib_autogen/EWIEGA46WW/moc_vsrtl_widget.cpp:10, from /home/kuouu/Ripes/external/VSRTL/graphics/vsrtl_gfx_lib_autogen/mocs_compilation.cpp:15: /home/kuouu/Ripes/external/VSRTL/graphics/vsrtl_widget.h:8:10: fatal error: QtConcurrent/QtConcurrent: No such file or directory 8 | #include <QtConcurrent/QtConcurrent> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [external/VSRTL/graphics/CMakeFiles/vsrtl_gfx_lib.dir/build.make:103: external/VSRTL/graphics/CMakeFiles/vsrtl_gfx_lib.dir/vsrtl_gfx_lib_autogen/mocs_compilation.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:864: external/VSRTL/graphics/CMakeFiles/vsrtl_gfx_lib.dir/all] Error 2 make: *** [Makefile:130: all] Error 2 ``` ::: ### build by prebuilt docker image [docker image for CMake based C++/Qt5 application](https://hub.docker.com/r/reivilo1234/qt-webassembly-cmake) ```shell git clone --recursive https://github.com/mortbopet/Ripes.git # This folder will be mounted in the container as /src cd Ripes/ # Start bash in the container docker run -it --rm -v $(pwd):/src/ -u $(id -u):$(id -g) reivilo1234/qt-webassembly-cmake:qt5.15-em1.39.10 bash cd /src # Then regular cmake workflow mkdir -p build && cd build cmake .. make -j ``` result: :::danger same error as cmake ::: ## Conclusion It seems that Qt for WebAssembly currently not support QtConcurrent and some multithreading feature, which was used frequently in Ripes. And according to the [news](https://www.qt.io/blog/qt-6.2-web-assembly-whats-new) that author reply to me, it is worth to expect that implementation of multithreading in the future. I am looking forward to see the web version of Ripes! - [[#QTBUG-82629] wasm: threads: get QtConcurrent working](https://bugreports.qt.io/browse/QTBUG-82629) - [Qt for WebAssembly: Multithreading](https://www.qt.io/blog/2019/06/26/qt-webassembly-multithreading) ## Discussion on GitHub Issue [#188](https://github.com/mortbopet/Ripes/issues/188) ![](https://i.imgur.com/66BBvD6.png) ![](https://i.imgur.com/wqB90si.png)