{"action":"created","issue":{"url":"https://api.github.com/repos/kripken/emscripten/issues/4139","repository_url":"https://api.github.com/repos/kripken/emscripten","labels_url":"https://api.github.com/repos/kripken/emscripten/issues/4139/labels{/name}","comments_url":"https://api.github.com/repos/kripken/emscripten/issues/4139/comments","events_url":"https://api.github.com/repos/kripken/emscripten/issues/4139/events","html_url":"https://github.com/kripken/emscripten/issues/4139","id":138212649,"number":4139,"title":"-O(2/s/z/...) optimizations lead to 'No such file or directory' error","user":{"login":"Matthiasvanderhallen","id":1771930,"avatar_url":"https://avatars.githubusercontent.com/u/1771930?v=3","gravatar_id":"","url":"https://api.github.com/users/Matthiasvanderhallen","html_url":"https://github.com/Matthiasvanderhallen","followers_url":"https://api.github.com/users/Matthiasvanderhallen/followers","following_url":"https://api.github.com/users/Matthiasvanderhallen/following{/other_user}","gists_url":"https://api.github.com/users/Matthiasvanderhallen/gists{/gist_id}","starred_url":"https://api.github.com/users/Matthiasvanderhallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Matthiasvanderhallen/subscriptions","organizations_url":"https://api.github.com/users/Matthiasvanderhallen/orgs","repos_url":"https://api.github.com/users/Matthiasvanderhallen/repos","events_url":"https://api.github.com/users/Matthiasvanderhallen/events{/privacy}","received_events_url":"https://api.github.com/users/Matthiasvanderhallen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-03-03T15:38:00Z","updated_at":"2016-03-11T09:41:26Z","closed_at":null,"body":"When compiling with these flags on a macbook and emscripten 1.35.2,\r\n```\r\nem++ -O2 hello_world_file.cpp --preload-file hello_world_file.txt@tests/hello_world_file.txt -o hello.html\r\n```\r\n\r\nI get 'No such file or directory' errors:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/local/Cellar/emscripten/1.35.2/libexec/emcc\", line 1602, in <module>\r\n    flush_js_optimizer_queue()\r\n  File \"/usr/local/Cellar/emscripten/1.35.2/libexec/emcc\", line 1505, in flush_js_optimizer_queue\r\n    run_passes(chunks[0], title, just_split=False, just_concat=False)\r\n  File \"/usr/local/Cellar/emscripten/1.35.2/libexec/emcc\", line 1478, in run_passes\r\n    final = shared.Building.js_optimizer(final, passes, debug_level >= 4, js_optimizer_extra_info, just_split=just_split, just_concat=just_concat)\r\n  File \"/usr/local/Cellar/emscripten/1.35.2/libexec/tools/shared.py\", line 1634, in js_optimizer\r\n    ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info, just_split, just_concat)\r\n  File \"/usr/local/Cellar/emscripten/1.35.2/libexec/tools/js_optimizer.py\", line 538, in run\r\n    return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))\r\n  File \"/usr/local/Cellar/emscripten/1.35.2/libexec/tools/tempfiles.py\", line 64, in run_and_clean\r\n    return func()\r\n  File \"/usr/local/Cellar/emscripten/1.35.2/libexec/tools/js_optimizer.py\", line 538, in <lambda>\r\n    return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))\r\n  File \"/usr/local/Cellar/emscripten/1.35.2/libexec/tools/js_optimizer.py\", line 444, in run_on_js\r\n    filenames = pool.map(run_on_chunk, commands, chunksize=1)\r\n  File \"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py\", line 251, in map\r\n    return self.map_async(func, iterable, chunksize).get()\r\n  File \"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py\", line 567, in get\r\n    raise self._value\r\nOSError: [Errno 2] No such file or directory\r\n```\r\nThe files are simply those of the tutorial: https://kripken.github.io/emscripten-site/docs/getting_started/Tutorial.html#using-files\r\n\r\n-O1 or default of -O0 all work fine."},"comment":{"url":"https://api.github.com/repos/kripken/emscripten/issues/comments/195292599","html_url":"https://github.com/kripken/emscripten/issues/4139#issuecomment-195292599","issue_url":"https://api.github.com/repos/kripken/emscripten/issues/4139","id":195292599,"user":{"login":"Matthiasvanderhallen","id":1771930,"avatar_url":"https://avatars.githubusercontent.com/u/1771930?v=3","gravatar_id":"","url":"https://api.github.com/users/Matthiasvanderhallen","html_url":"https://github.com/Matthiasvanderhallen","followers_url":"https://api.github.com/users/Matthiasvanderhallen/followers","following_url":"https://api.github.com/users/Matthiasvanderhallen/following{/other_user}","gists_url":"https://api.github.com/users/Matthiasvanderhallen/gists{/gist_id}","starred_url":"https://api.github.com/users/Matthiasvanderhallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Matthiasvanderhallen/subscriptions","organizations_url":"https://api.github.com/users/Matthiasvanderhallen/orgs","repos_url":"https://api.github.com/users/Matthiasvanderhallen/repos","events_url":"https://api.github.com/users/Matthiasvanderhallen/events{/privacy}","received_events_url":"https://api.github.com/users/Matthiasvanderhallen/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T09:41:26Z","updated_at":"2016-03-11T09:41:26Z","body":"It still errors on 1.35.23 when `EMCC_NATIVE_OPTIMIZER=1` or simply not in environment.\r\n\r\n```\r\n  File \"/usr/local/bin/em++\", line 13, in <module>\r\n    emcc.run()\r\n  File \"/usr/local/Cellar/emscripten/1.35.23/libexec/emcc.py\", line 1650, in run\r\n    JSOptimizer.flush()\r\n  File \"/usr/local/Cellar/emscripten/1.35.23/libexec/emcc.py\", line 1557, in flush\r\n    run_passes(chunks[0], title, just_split=False, just_concat=False)\r\n  File \"/usr/local/Cellar/emscripten/1.35.23/libexec/emcc.py\", line 1530, in run_passes\r\n    final = shared.Building.js_optimizer(final, passes, debug_level >= 4, JSOptimizer.extra_info, just_split=just_split, just_concat=just_concat)\r\n  File \"/usr/local/Cellar/emscripten/1.35.23/libexec/tools/shared.py\", line 1651, in js_optimizer\r\n    ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info, just_split, just_concat)\r\n  File \"/usr/local/Cellar/emscripten/1.35.23/libexec/tools/js_optimizer.py\", line 541, in run\r\n    return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))\r\n  File \"/usr/local/Cellar/emscripten/1.35.23/libexec/tools/tempfiles.py\", line 64, in run_and_clean\r\n    return func()\r\n  File \"/usr/local/Cellar/emscripten/1.35.23/libexec/tools/js_optimizer.py\", line 541, in <lambda>\r\n    return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))\r\n  File \"/usr/local/Cellar/emscripten/1.35.23/libexec/tools/js_optimizer.py\", line 449, in run_on_js\r\n    filenames = [run_on_chunk(command) for command in commands]\r\n  File \"/usr/local/Cellar/emscripten/1.35.23/libexec/tools/js_optimizer.py\", line 277, in run_on_chunk\r\n    proc = subprocess.Popen(command, stdout=subprocess.PIPE)\r\n  File \"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py\", line 710, in __init__\r\n    errread, errwrite)\r\n  File \"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py\", line 1335, in _execute_child\r\n    raise child_exception\r\n```\r\n\r\nContents of `~/.emscripten_cache`:\r\n    * dlmalloc.bc\r\n    * libc.bc\r\n    * struct_info.compiled.json\r\n\r\n[struct_info.compiled.txt](https://github.com/kripken/emscripten/files/168798/struct_info.compiled.txt)\r\n\r\n\r\n"}}