cib

clang running in browser (wasm)

  • 所有者: tbfleming/cib
  • 平台:
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Clang In Browser (cib)

Try it at https://tbfleming.github.io/cib/

I'm trying to see how far wasm can go. Is it possible to compile clang to wasm and have it generate code within the browser?

Current status:

  • Works in Firefox 57 and Chrome 63

Change log:

  • Build EOS contracts: https://tbfleming.github.io/cib/eos.html
  • Integrate with user HTML
  • Load gists
  • Load header libraries in .zip files
  • The runtime now consumes much less memory with each press of the Run button
  • Standard library globals (e.g. cout)
  • Global constructors
  • Function pointers and virtual functions
  • RTTI

Currently missing:

  • Global destructors
  • Exception handling
  • stdin / cin. Waiting on browsers to restore SharedArrayBuffer.

VM for building clang

  • Create a fresh VM to build with. The build will probably fail if you already have emscripten or clang installed.
  • Consider using a high thread-count VM; e.g. an EC2 c5.9xlarge.
  • I put the repo in a dedicated volume while building; this aids using spot instances. 100 GB.

Ubuntu 16.04:

sudo apt update
sudo apt upgrade
sudo apt install build-essential cmake ninja-build python nodejs-legacy libncurses-dev unzip libboost1.58-tools-dev

Building WASM binaries

./build.py -a

This script:

  • Clones needed repos
  • Builds an llvm toolchain for targeting WASM
  • Builds emscripten
  • Invokes emscripten to:
    • set up environment
    • build emscripten's dependances
  • Uses emscripten to build llvm libraries
  • Builds the apps

主要指标

概览
名称与所有者tbfleming/cib
主编程语言C++
编程语言Python (语言数: 5)
平台
许可证
所有者活动
创建于2017-12-11 17:02:24
推送于2022-10-22 10:00:03
最后一次提交2018-05-04 22:24:09
发布数13
最新版本名称cib-013 (发布于 2018-05-04 22:24:21)
第一版名称cib-001 (发布于 2017-12-27 02:25:53)
用户参与
星数851
关注者数37
派生数61
提交数108
已启用问题?
问题数20
打开的问题数14
拉请求数0
打开的拉请求数3
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?