{"id":346,"date":"2023-11-16T11:26:37","date_gmt":"2023-11-16T03:26:37","guid":{"rendered":"https:\/\/blog.quantoyo.com\/?p=346"},"modified":"2023-11-16T11:26:37","modified_gmt":"2023-11-16T03:26:37","slug":"webassembly-wasm%e5%ae%89%e8%a3%9d","status":"publish","type":"post","link":"https:\/\/blog.quantoyo.com\/?p=346","title":{"rendered":"WebAssembly (wasm)\u5b89\u88dd"},"content":{"rendered":"\n<p>\u7c21\u55ae\u8a18\u9304\u4e00\u4e0b Mac OS \u4e0b\u5982\u4f55\u7531C\/C++ \u7522\u751f\u51fa wasm \u4e26\u4f7f\u7528<\/p>\n\n\n\n<!--more-->\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u78ba\u8a8d\u96fb\u8166\u4e0a\u5b89\u88dd\u4e86python<\/li>\n<\/ul>\n\n\n\n<p>\u70ba\u4e86\u5b89\u88dd Emscripten SDK\uff0c\u9700\u8981\u5b89\u88dd 2.7.12 \u7248\u672c\u4ee5\u4e0a\u7684python\uff0c\u53ef\u4ee5\u5728\u7d42\u7aef\u6a5f\u8f38\u5165\u4ee5\u4e0b\u6307\u4ee4\u78ba\u8a8d\u7248\u672c<\/p>\n\n\n\n<pre class=\"wp-block-code has-light-gray-background-color has-background has-small-font-size\"><code>python -V\n\n\u5982\u679c\u6b63\u78ba\u5b89\u88ddpython \u5c07\u6703\u6709\u985e\u4f3c\u4ee5\u4e0b\u7684\u56de\u8986\nPython 3.9.6<\/code><\/pre>\n\n\n\n<p>\u53e6\u5916 python \u53ef\u4ee5\u5145\u7576\u7c21\u6613\u7248web server\uff0c\u6e2c\u8a66\u6642\u6703\u9700\u8981<\/p>\n\n\n\n<pre class=\"wp-block-code has-light-gray-background-color has-background has-small-font-size\"><code>\u5728\u60f3\u8981\u7528\u4f86\u4f5c\u70ba\u7db2\u9801\u6839\u76ee\u9304\u7684\u5730\u65b9\uff0c\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4\u5373\u53ef\n\nPython 3.X \u7248\u4ee5\u4e0a\npython -m http.server 8080\n\nPython 2.X \u7248\npython -m SimpleHTTPServer 8080\n<\/code><\/pre>\n\n\n\n<p>MacOS \/Linux \u4e0a\u9700\u8981\u5c07wasm \u578b\u614b\u52a0\u5165\u5230\u5a92\u9ad4\u5217\u8868\u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-code has-light-gray-background-color has-background has-small-font-size\"><code>sudo vi \/etc\/mime.types\n\n\u8cbc\u4e0a\napplication\/wasm wasm\n\n\u5b58\u6a94<\/code><\/pre>\n\n\n\n<p>\u63a5\u4e0b\u4f86\u5b89\u88ddEmscripten<\/p>\n\n\n\n<pre class=\"wp-block-code has-light-gray-background-color has-background has-small-font-size\"><code>\u5f9egit \u53d6\u5f97\u6700\u65b0\u7248\u7684emsdk \u4e26\u5b89\u88dd\uff0c\u5728source \u5f8c\u5c31\u53ef\u4ee5\u4f7f\u7528 emsdk \u6307\u4ee4\n\ngit clone https:\/\/github.com\/emscripten-core\/emsdk.git\ncd emsdk\ngit pull\n.\/emsdk install latest\n.\/emsdk activate latest\nsource .\/emsdk_env.sh\n\n\u81f3\u6b64\u5b89\u88dd\u5b8c\u7562<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u4f7f\u7528emsdk \u6307\u4ee4\u78ba\u8a8d\u662f\u5426\u5b89\u88dd\u5b8c\u6210<\/p>\n\n\n\n<pre class=\"wp-block-code has-light-gray-background-color has-background has-small-font-size\"><code>emsdk list\n\n\u6b63\u5e38\u6703\u986f\u793a\u4e0b\u5217\u8cc7\u8a0a<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"622\" src=\"https:\/\/blog.quantoyo.com\/wp-content\/uploads\/2023\/11\/image.png\" alt=\"\" class=\"wp-image-347\" srcset=\"https:\/\/blog.quantoyo.com\/wp-content\/uploads\/2023\/11\/image.png 934w, https:\/\/blog.quantoyo.com\/wp-content\/uploads\/2023\/11\/image-300x200.png 300w, https:\/\/blog.quantoyo.com\/wp-content\/uploads\/2023\/11\/image-150x100.png 150w, https:\/\/blog.quantoyo.com\/wp-content\/uploads\/2023\/11\/image-768x511.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u53c3\u8003\u8cc7\u6599<\/p>\n\n\n\n<p><a href=\"https:\/\/emscripten.org\/docs\/getting_started\/downloads.html\">https:\/\/emscripten.org\/docs\/getting_started\/downloads.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7c21\u55ae\u8a18\u9304\u4e00\u4e0b Mac OS \u4e0b\u5982\u4f55\u7531C\/C++ \u7522\u751f\u51fa wasm \u4e26\u4f7f\u7528<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[30,43,44],"class_list":["post-346","post","type-post","status-publish","format-standard","hentry","category-technology","tag-macos","tag-wasm","tag-webassembly"],"_links":{"self":[{"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=\/wp\/v2\/posts\/346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=346"}],"version-history":[{"count":1,"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=\/wp\/v2\/posts\/346\/revisions"}],"predecessor-version":[{"id":348,"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=\/wp\/v2\/posts\/346\/revisions\/348"}],"wp:attachment":[{"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.quantoyo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}