< Retour au sommaire
Compilation OCaml vers WASM - retour d'expérience
Frédéric Rescoules le
Lieu: Salle 1073
Résumé
Traditionally built as a native Unix CLI executable, the OCaml BINSEC platform relies heavily on specific architecture constraints and native C/C++ dependencies. While distributed via opam packages or Docker images (with an OCaml Universal Installer release planned), these distribution methods still introduce significant friction in educational, tutorial, or non-developer settings. Conversely, modern web browsers offer a universal runtime environment across all client devices. In this presentation, we recount our experience porting BINSEC into an interactive online tutorial by compiling it directly to WebAssembly using wasm_of_ocaml.
After a quick introduction to wasm_of_ocaml, we present the specific challenges encountered with the BINSEC platform—ranging from architecture mismatches (32-bit JS/WASM runtime vs. 64-bit assumptions) to pervasive reliance on files and global state—alongside the cross-compilation of its C/C++ dependencies, such as solvers and disassemblers. We then demonstrate BINSEC embedded directly into interactive, Docusaurus-powered documentation. Finally, we discuss key lessons learned and the engineering trade-offs required to deliver heavyweight static analysis tools fully client-side.