tonyg/js-nacl

Doesn't build with the latest emscripten

nlacasse opened this issue · 2 comments

I would like to build js-nacl with the latest emscripten to make use of the asm.js output.

Using the HEAD of master branch of emscripten first gave this error:

Assertion failed: Cannot grow asm.js heap

I turned off ALLOW_MEMORY_GROWTH in the Makefile, and then got this error:

python `which emcc` \
    -s LINKABLE=1 \
    -s EXPORTED_FUNCTIONS="$(cat subnacl/naclexports.sh)" \
    -s ALLOW_MEMORY_GROWTH=0 \
    --js-library nacl_randombytes_emscripten.js \
    --post-js subnacl/naclapi.js \
    -O1 --closure 1 -o nacl_raw.js \
    -I subnacl/include \
    keys.c \
    $(find subnacl -name '*.c')

undefined:374
        throw 'Invalid token, cannot triage: ' + dump(item);
                                               ^
Invalid token, cannot triage: // {
//   "tokens": [
//     {
//       "text": "attributes"
//     },
//     {
//       "text": "#0"
//     },
//     {
//       "text": "="
//     },
//     {
//       "text": "{ nounwind\"less-precise-fpmad\"=\"false\"\"no-frame-pointer-elim\"=\"true\"\"no-frame-pointer-elim-non-leaf\"=\"true\"\"no-infs-fp-math\"=\"false\"\"no-nans-fp-math\"=\"false\"\"unsafe-fp-math\"=\"false\"\"use-soft-float\"=\"false\" }",
//       "tokens": [
//         {
//           "text": "nounwind"
//         },
//         {
//           "text": "\"less-precise-fpmad\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         },
//         {
//           "text": "\"no-frame-pointer-elim\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"true\""
//         },
//         {
//           "text": "\"no-frame-pointer-elim-non-leaf\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"true\""
//         },
//         {
//           "text": "\"no-infs-fp-math\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         },
//         {
//           "text": "\"no-nans-fp-math\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         },
//         {
//           "text": "\"unsafe-fp-math\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         },
//         {
//           "text": "\"use-soft-float\""
//         },
//         {
//           "text": "="
//         },
//         {
//           "text": "\"false\""
//         }
//       ],
//       "type": "{"
//     }
//   ],
//   "indent": 0,
//   "lineNum": 641,
//   "__uid__": 17
// }
Traceback (most recent call last):
  File "/home/nlacasse/opal/emscripten/emscripten.py", line 853, in <module>
    _main(environ=os.environ)
  File "/home/nlacasse/opal/emscripten/emscripten.py", line 841, in _main
    temp_files.run_and_clean(lambda: main(
  File "/home/nlacasse/opal/emscripten/tools/tempfiles.py", line 38, in run_and_clean
    return func()
  File "/home/nlacasse/opal/emscripten/emscripten.py", line 849, in <lambda>
    DEBUG_CACHE=DEBUG_CACHE,
  File "/home/nlacasse/opal/emscripten/emscripten.py", line 735, in main
    jcache=jcache, temp_files=temp_files, DEBUG=DEBUG, DEBUG_CACHE=DEBUG_CACHE)
  File "/home/nlacasse/opal/emscripten/emscripten.py", line 184, in emscript
    assert '//FORWARDED_DATA:' in out, 'Did not receive forwarded data in pre output - process failed?'
AssertionError: Did not receive forwarded data in pre output - process failed?
Traceback (most recent call last):
  File "/home/nlacasse/bin/emcc", line 1505, in <module>
    final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args)
  File "/home/nlacasse/opal/emscripten/tools/shared.py", line 1096, in emscripten
    assert os.path.exists(filename + '.o.js') and len(open(filename + '.o.js', 'r').read()) > 0, 'Emscripten failed to generate .js: ' + str(compiler_output)
AssertionError: Emscripten failed to generate .js: 
make: *** [nacl_raw.js] Error 1

Should be fixed with current master. (Omitted -s ALLOW_MEMORY_GROWTH entirely.) Let me know!

Works great! Thanks!