Jump to content
Wikipedia The Free Encyclopedia

Emscripten

From Wikipedia, the free encyclopedia
Program converting LLVM bytecode to WebAssembly
Emscripten
Original author Alon Zakai
Release22October 2011;14 years ago(2011年10月22日)[1]
Stable release
6.0.6[2] Edit this on Wikidata / 5 August 2026;9 days ago(5 August 2026)
Written inC, C++, JavaScript [3]
Type Compiler
License MIT License, University of Illinois/NCSA Open Source License
Websiteemscripten.org Edit this on Wikidata
Repository

Emscripten is an LLVM/Clang-based compiler that compiles LLVM IR to WebAssembly,[4] primarily for execution in web browsers.

Emscripten allows applications and libraries written in C or C++ to be compiled ahead of time and run efficiently in web browsers, typically at speeds comparable to or faster than interpreted or dynamically compiled JavaScript. It even emulates an entire POSIX operating system, enabling programmers to use functions from the C standard library (libc).[5]

With the more recent development of the WebAssembly System Interface (WASI) [6] and WebAssembly runtimes such as Node.js, Wasmtime,[7] and Wasmer,[8] Emscripten can also be used to compile to WebAssembly for execution in non-web embeddings as well.

Usage

[edit ]

Emscripten has been used to port a number of C/C++ code bases to WebAssembly, including Unreal Engine 3, SQLite,[9] MeshLab,[10] Bullet physics,[11] AutoCAD,[12] and a subset of the Qt application framework.[13] Other examples of software ported to WebAssembly via Emscripten include the following:

Game engines

[edit ]

The Unity, Defold, and Godot game engines provide an export option to HTML5, utilizing Emscripten.[14] [15] [16] Unreal Engine had this export option but it has been migrated out of the engine to a community member plug in.[17] The Source Engine, has a community developed port for Emscripten dubbed "HalfLife2JS".[18]

Frameworks & toolkits

[edit ]

openFrameworks exports native C++ applications to HTML5 via Emscripten.[19] emscripten-qt permits compiling applications written using the Qt application framework to WebAssembly.[13]

Software archiving

[edit ]

In December 2014, the Internet Archive launched a DOSBox emulator compiled in Emscripten to provide browser-based access to thousands of archived MS-DOS and PC programs.[20] [21] [22]

Creation

[edit ]

Emscripten was created by Alon Zakai in 2010, motivated by his desire to port his fork of the open-source first-person shooter game Sauerbraten, known as Syntensity,[23] to the web. Sauerbraten (also known as Cube 2) is an open-source FPS game,[24] and Syntensity was Zakai's project that extended the Cube 2 Engine for greater flexibility. Observing the increasing shift of applications to web browsers, Zakai began developing Emscripten as an LLVM-to-JavaScript compiler, aiming to make it possible to run existing C and C++ code, such as game engines, directly in the browser. In early blog posts, Zakai explained that his long-term goal was "to run Syntensity, or a smaller version of it, on the web",[25] and Emscripten was released as open source shortly after its initial development, making it available for the broader community to experiment with and contribute to.[26] [27]

In 2019, Emscripten changed from producing JavaScript or asm.js output by default to producing code in the WebAssembly binary format added by browsers in response to the challenges of using verbose JavaScript as a compilation target.[28] Unlike the prior asm.js backend, the WebAssembly code generator backend was merged into upstream LLVM development and is shared between Emscripten and other tools producing WebAssembly.[29]

See also

[edit ]

References

[edit ]
  1. Zakai, Alon (22 October 2011). "Emscripten: An LLVM-to-JavaScript compiler". Proceedings of the ACM international conference companion on Object oriented programming systems languages and applications companion. OOPSLA. pp. 301–312. doi:10.1145/2048147.2048224. ISBN 978-1-4503-0942-4.
  2. "Release 6.0.6". 5 August 2026. Retrieved 6 August 2026.
  3. "emscripten-core/emscripten: Emscripten: An LLVM-to-JavaScript Compiler". GitHub . C: 40.0%; C++: 34.4%; JavaScript: 17.4%.
  4. WebAssembly · emscripten-core/emscripten Wiki · GitHub
  5. Clark, Lin. "Standardizing WASI: A system interface to run WebAssembly outside the web – Mozilla Hacks - the Web developer blog". Mozilla Hacks – the Web developer blog. Mozilla. Retrieved 31 October 2022.
  6. The Wasmtime Project. "WASI: The WebAssembly System Interface". WASI.dev. The Wasmtime Project. Retrieved 2021年02月10日.
  7. The Wasmtime Project. "Wasmtime: A small and efficient runtime for WebAssembly & WASI". Wasmtime.dev. The Wasmtime Project. Retrieved 2021年02月10日.
  8. Wasmer. "Wasmer: The Universal WebAssembly Runtime". Wasmer.io. Wasmer. Retrieved 2021年02月10日.
  9. "sqlite3 WebAssembly & JavaScript Documentation Index". SQLite. Retrieved 2023年05月08日.
  10. http://www.meshlabjs.net - Homepage of the experimental, client based, javascript, version of MeshLab that runs inside a browser
  11. "Porting Examples and Demos". Emscripten GitHub wiki. Retrieved 2016年03月01日.
  12. "The Future of AutoCAD". Through the Interface. Retrieved 2018年05月09日..
  13. 1 2 "Qt for WebAssembly".
  14. "Unity game engine heading to the browser without plug-ins". Ars Technica. 18 March 2014. Retrieved 2016年03月01日.
  15. "The future of scripting in Unity – Unity Blog". Unity Technologies Blog. Retrieved 2016年03月01日.
  16. "Defold HTML Development". Defold Documentation. Retrieved 2023年12月18日.
  17. "Developing HTML5 with Unreal". Unreal Documentation. 18 December 2023. Retrieved 2018年12月18日.
  18. Half-Life 2: Javascript, EmSource, 2025年04月13日, retrieved 2025年04月14日
  19. "openFrameworks setup for Emscripten". openFrameworks. Retrieved 2016年03月04日.
  20. Ohlheiser, Abby (2015年01月05日). "You can now play nearly 2,400 MS-DOS video games in your browser". The Washington Post . Retrieved 2015年01月08日.
  21. Each New Boot a Miracle by Jason Scott (December 23, 2014)
  22. "Internet Archive Search: "collection:softwarelibrary_msdos"". archive.org. Retrieved 2016年03月01日.
  23. Kripken (2009年04月22日). "Scriptensity: Intro". Scriptensity. Retrieved 2025年07月24日.
  24. "Cube 2: Sauerbraten". sauerbraten.org. Retrieved 2025年07月24日.
  25. Kripken (2010年08月29日). "Scriptensity: Emscripten". Scriptensity. Retrieved 2025年07月24日.
  26. Kripken (2010年08月14日). "Scriptensity: Update on Where Things are Going". Scriptensity. Retrieved 2025年07月24日.
  27. "Make your own games with Syntensity". www.dedoimedo.com. Retrieved 2025年07月24日.
  28. Lardinois, Frederic (17 June 2015). "Google, Microsoft, Mozilla And Others Team Up To Launch WebAssembly, A New Binary Format For The Web". TechCrunch. Archived from the original on 17 January 2018. Retrieved 24 December 2017.
  29. "ChangeLog.md". GitHub - emscripten. 2019年10月18日. Retrieved 2026年08月03日.
[edit ]

AltStyle によって変換されたページ (->オリジナル) /