christianmurphy / compile-to-web Goto Github PK
View Code? Open in Web Editor NEWDiscover what languages can be compiled to Web Assembly
License: MIT License
Discover what languages can be compiled to Web Assembly
License: MIT License
Python support may be possible using the Pyston debugger.
./pyston_dbg -S -n -v -v t.py
I get the following output when trying to compile with julia 0.5.0:
$ julia --compile=all --output-bc=hello.bc hello.jl
ERROR: could not open file boot.jl
Compilers:
Trying to run Nim code in wasm
When I run nim c -d:useRealtimeGC -d:release -d:emscripten --out=index.html hello.nim
I gives me error
Hint: system [Processing]
Hint: hello [Processing]
CC: hello
CC: system
Error: execution of an external compiler program 'emcc -c -w -s WASM=1 -s 'BINARYEN_METHOD="native-wasm"' -Iemscripten -O3 -I/usr/lib/nim -o /vagrant/nimcache/hello.o/vagrant/nimcache/hello.c' failed with exit code: 32512
/bin/sh: 1: emcc: not found
emcc -v
INFO:root:generating system asset: is_vanilla.txt... (this will be cached in "/home/achala/.emscripten_cache/is_vanilla.txt" for subsequent builds)
INFO:root: - ok
INFO:root:(Emscripten: Running sanity checks)
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.16
clang version 6.0.1 (emscripten 1.38.16 : 1.38.16)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/achala/emsdk/clang/e1.38.16_64bit
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Candidate multilib: .;@m64
Selected multilib: .;@m64
INFO:root:(Emscripten: Running sanity checks)
nim -v
Nim Compiler Version 0.19.0 [Linux: amd64]
Compiled at 2018-09-26
Copyright (c) 2006-2018 by Andreas Rumpf
git hash: f6c5c636bb1a1f4e1301ae0ba5a8afecef439132
active boot switches: -d:release
How to solve this issue?TIA
Please add Scala to your list.
Nim compiles down to C code. So it in theory can compile to webasm.
Note: The GC can be a issue.
The first working version of C# support used a custom forked version of the mono compiler.
The mono project has now included a WASM compatible compiler in their mainline release.
The custom forked version can be replaced by the official version for simplified setup and better support.
ref: http://www.mono-project.com/news/2017/11/13/mono-interpreter/
Create a Docker script for each language build.
So compilation can be tested in a cross platform and easy to reproduce way.
Kotlin Native recently added support for WASM. Probably a good idea to add this, maybe I'll take a shot at it if I get a chance.
Initial support for WASM is incoming https://go-review.googlesource.com/c/go/+/102835
There have been some successful attempts to compile rust with latest version.
https://users.rust-lang.org/t/compiling-to-the-web-with-rust-and-emscripten/7627
http://www.hellorust.com/emscripten/
trying to run with arch as the host machine:
already having run with vagrant up
:
~/projects/compile-to-web/C++ master
❯ vagrant ssh
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-98-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
Last login: Tue Nov 21 04:24:00 2017 from 10.0.2.2
ubuntu@ubuntu-xenial:~$ install
Reading package lists... Done
W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package nodejs
--2017-11-21 04:24:10-- https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
Resolving s3.amazonaws.com (s3.amazonaws.com)... 52.216.80.163
Connecting to s3.amazonaws.com (s3.amazonaws.com)|52.216.80.163|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 36333 (35K) [application/x-tar]
Saving to: ‘emsdk-portable.tar.gz.6’
emsdk-portable.tar.gz.6 100%[======================================>] 35.48K 56.3KB/s in 0.6s
2017-11-21 04:24:11 (56.3 KB/s) - ‘emsdk-portable.tar.gz.6’ saved [36333/36333]
emsdk-portable/
emsdk-portable/emsdk
emsdk-portable/emcmdprompt.bat
emsdk-portable/emsdk.bat
emsdk-portable/emsdk_manifest.json
emsdk-portable/emsdk_env.bat
emsdk-portable/README.md
emsdk-portable/binaryen-tags.txt
emsdk-portable/emscripten-tags.txt
emsdk-portable/emsdk_env.sh
Downloading: /home/ubuntu/emsdk-portable/zips/emsdk_unix_update.tar.gz from https://s3.amazonaws.com/mozilla-games/emscripten/packages/emsdk_unix_update.tar.gz, 36333 Bytes
Unpacking '/home/ubuntu/emsdk-portable/zips/emsdk_unix_update.tar.gz' to '/home/ubuntu/emsdk-portable'
emsdk-portable/emsdk
emsdk-portable/emcmdprompt.bat
emsdk-portable/emsdk.bat
emsdk-portable/emsdk_manifest.json
emsdk-portable/emsdk_env.bat
emsdk-portable/README.md
emsdk-portable/binaryen-tags.txt
emsdk-portable/emscripten-tags.txt
emsdk-portable/emsdk_env.sh
Fetching all tags from Emscripten Github repository...
Done. 109 tagged releases available, latest is 1.37.22.
Fetching all tags from Binaryen Github repository...
Done. 36 tagged Binaryen releases available, latest is 1.37.22.
Fetching all precompiled Nightly versions..
Downloading: /home/ubuntu/emsdk-portable/llvm-nightlies-32bit.txt from https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/nightly/linux_32bit/index.txt
Downloading: /home/ubuntu/emsdk-portable/llvm-nightlies-64bit.txt from https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/nightly/linux_64bit/index.txt, 24146 Bytes
Downloading: /home/ubuntu/emsdk-portable/emscripten-nightlies.txt from https://s3.amazonaws.com/mozilla-games/emscripten/packages/emscripten/nightly/linux/index.txt, 25081 Bytes
Fetching all precompiled tagged releases..
Downloading: /home/ubuntu/emsdk-portable/llvm-tags-32bit.txt from https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/tag/linux_32bit/index.txt
Downloading: /home/ubuntu/emsdk-portable/llvm-tags-64bit.txt from https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/tag/linux_64bit/index.txt, 789 Bytes
Installing SDK 'sdk-incoming-64bit'..
Installing tool 'clang-incoming-64bit'..
Repository 'https://github.com/kripken/emscripten-fastcomp.git' already cloned to directory '/home/ubuntu/emsdk-portable/clang/fastcomp/src', skipping.
Fetching latest changes to the branch 'incoming' for '/home/ubuntu/emsdk-portable/clang/fastcomp/src'...
Already up-to-date.
Successfully updated and checked out branch 'incoming' on repository '/home/ubuntu/emsdk-portable/clang/fastcomp/src'
Current repository version: "Fri, 10 Nov 2017 22:56:20 +0200 4c26a4f8d498ef5b06ef8594d0e5d8d0cf0e8c60"
Repository 'https://github.com/kripken/emscripten-fastcomp-clang.git' already cloned to directory '/home/ubuntu/emsdk-portable/clang/fastcomp/src/tools/clang', skipping.
Fetching latest changes to the branch 'incoming' for '/home/ubuntu/emsdk-portable/clang/fastcomp/src/tools/clang'...
Already up-to-date.
Successfully updated and checked out branch 'incoming' on repository '/home/ubuntu/emsdk-portable/clang/fastcomp/src/tools/clang'
Current repository version: "Sat, 7 Oct 2017 22:07:42 -0700 3659f873b523e5fc89ffa16baab8901fbd084251"
Running CMake: ['cmake', '-G', 'Unix Makefiles', '-DCMAKE_BUILD_TYPE=RelWithDebInfo', '-DPYTHON_EXECUTABLE=/usr/bin/python', '-DLLVM_TARGETS_TO_BUILD=X86;JSBackend', '-DLLVM_INCLUDE_EXAMPLES=OFF', '-DCLANG_INCLUDE_EXAMPLES=OFF', '-DLLVM_INCLUDE_TESTS=OFF', '-DCLANG_INCLUDE_TESTS=OFF', '-DLLVM_ENABLE_ASSERTIONS=ON', '/home/ubuntu/emsdk-portable/clang/fastcomp/src']
[Errno 2] No such file or directory
Could not run CMake, perhaps it has not been installed?
Installing this package requires CMake. Get it via your system package manager (e.g. sudo apt-get install cmake), or from http://www.cmake.org/
Installation failed!
Writing .emscripten configuration file to user home directory /home/ubuntu/
The SDK/tool 'clang-incoming-64bit' cannot be activated since it is not installed! Skipping this tool...
The SDK/tool 'node-4.1.1-64bit' cannot be activated since it is not installed! Skipping this tool...
The SDK/tool 'emscripten-incoming-64bit' cannot be activated since it is not installed! Skipping this tool...
The SDK/tool 'sdk-incoming-64bit' cannot be activated since it is not installed! Skipping this tool...
The Emscripten configuration file /home/ubuntu/.emscripten has been rewritten with the following contents:
import os
SPIDERMONKEY_ENGINE = ''
NODE_JS = 'node'
V8_ENGINE = ''
TEMP_DIR = '/tmp'
COMPILER_ENGINE = NODE_JS
JS_ENGINES = [NODE_JS]
To conveniently access the selected set of tools from the command line, consider adding the following directories to PATH, or call 'source emsdk-portable/emsdk_env.sh' to do this for you.
/home/ubuntu/emsdk-portable
ubuntu@ubuntu-xenial:~$ build
The program 'emcc' is currently not installed. You can install it by typing:
sudo apt install emscripten
Alternative #6
emscripten-core/emscripten#2427
to quote @MaxDesiatov
"LLVM 7.0 was released yesterday with a lot of progress for WebAssembly target support. While the backend is still marked as experimental, not as much patching of upstream LLVM repositories should be needed. I've pulled 7.0 updates into Apple swift's fork repositories and rebased the changes in the main swift repository by @patcheng, while also fixing a few compilation issues.
Now the whole fresh toolchain with patches from above comments compiles for me, although I haven't checked yet if the actual WebAssembly support has improved. Going to look into that soon. I'm doing the work in these forks and branches:"
https://github.com/maxdesiatov/swift/tree/swift-to-wasm
https://github.com/maxdesiatov/swift-compiler-rt/tree/wasm
https://github.com/maxdesiatov/swift-llvm/tree/wasm
https://github.com/maxdesiatov/swift-clang/tree/wasm
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.