Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting a "Index out of range error while upgrading emsdk version to 3.1.18 ,3.1.19 and even in 3.1.10" previously my test app was building fine with emsdk 1.39.20 #17826

Closed
Pryagrawal opened this issue Sep 9, 2022 · 13 comments

Comments

@Pryagrawal
Copy link

Pryagrawal commented Sep 9, 2022

Please include the following in your bug report:

Version of emscripten/emsdk: 3.1.18 ,3.1.10 ,3.1.20

em++: warning: EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]
Traceback (most recent call last):
  File "/Users/agrawalpriya/emsdk/upstream/emscripten/em++.py", line 14, in <module>
    sys.exit(emcc.run(sys.argv))
  File "/Users/agrawalpriya/emsdk/upstream/emscripten/emcc.py", line 1168, in run
    phase_calculate_system_libraries(state, linker_arguments, linker_inputs, newargs)
  File "/Users/agrawalpriya/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/agrawalpriya/emsdk/upstream/emscripten/emcc.py", line 2726, in phase_calculate_system_libraries
    extra_files_to_link += system_libs.calculate(all_linker_inputs, newargs, forced=state.forced_stdlibs)
  File "/Users/agrawalpriya/emsdk/upstream/emscripten/tools/system_libs.py", line 1885, in calculate
    handle_reverse_deps(input_files)
  File "/Users/agrawalpriya/emsdk/upstream/emscripten/tools/system_libs.py", line 1729, in handle_reverse_deps
    symbolses = building.llvm_nm_multiple([os.path.abspath(t) for t in input_files])
  File "/Users/agrawalpriya/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/agrawalpriya/emsdk/upstream/emscripten/tools/building.py", line 184, in llvm_nm_multiple
    for key, value in parse_llvm_nm_symbols(results.stdout).items():
  File "/Users/agrawalpriya/emsdk/upstream/emscripten/tools/building.py", line 574, in parse_llvm_nm_symbols
    status = line[entry_pos + 11] # Skip address, which is always fixed-length 8 chars.
IndexError: string index out of range
make[2]: *** [TestProfileWebTestApp.js] Error 1
make[1]: *** [CMakeFiles/TestProfileWebTestApp.dir/all] Error 2
make: *** [all] Error 2
emmake: error: 'make -j4' failed (returned 2)
Please make sure that cmake is installed.

@Pryagrawal Pryagrawal changed the title Getting a "Index out of range error while upgrading emsdk version to 3.1.18 ,3.1.19 and even in 3.1.10" previously my test app was building fine with emsdk 1.38.20 Getting a "Index out of range error while upgrading emsdk version to 3.1.18 ,3.1.19 and even in 3.1.10" previously my test app was building fine with emsdk 1.39.20 Sep 9, 2022
@sbc100
Copy link
Collaborator

sbc100 commented Sep 16, 2022

Can you should the completely failing command? With cmake you can use this by running make VERBOSE=1 (also using the ninja build tool will do this automatically when a command fails so you might want to consider switching to that using -G Ninja when running cmake).

@Pryagrawal
Copy link
Author

Can you should the completely failing command? With cmake you can use this by running make VERBOSE=1 (also using the ninja build tool will do this automatically when a command fails so you might want to consider switching to that using -G Ninja when running cmake).

I have try to add verbose by using "set (CMAKE_VERBOSE_MAKEFILE ON) " on cmakelist.txt file ,but not get enough message [100%] Linking CXX executable TestProfileWebTestApp.js
/usr/local/Cellar/cmake/3.22.2/bin/cmake -E cmake_link_script CMakeFiles/TestProfileWebTestApp.dir/link.txt --verbose=1
/Users/agrawalpriya/emsdk/upstream/emscripten/em++ -g -O0 -D_DEBUG=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=['ccall','getValue','setValue','UTF8ToString'] -s EXPORTED_FUNCTIONS=['_main_web'] -lidbfs.js -s FETCH=1 -s FORCE_FILESYSTEM=1 -s DEMANGLE_SUPPORT=1 -s DISABLE_EXCEPTION_CATCHING=0 -s WASM=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 --std=c++11 -s ALLOW_MEMORY_GROWTH=1 @CMakeFiles/TestProfileWebTestApp.dir/objects1.rsp -o TestProfileWebTestApp.js @CMakeFiles/TestProfileWebTestApp.dir/linklibs.rsp
em++: warning: EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]
Traceback (most recent call last):
File "/Users/agrawalpriya/emsdk/upstream/emscripten/em++.py", line 14, in
sys.exit(emcc.run(sys.argv))
File "/Users/agrawalpriya/emsdk/upstream/emscripten/emcc.py", line 1202, in run
phase_calculate_system_libraries(state, linker_arguments, linker_inputs, newargs)
File "/Users/agrawalpriya/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/Users/agrawalpriya/emsdk/upstream/emscripten/emcc.py", line 2845, in phase_calculate_system_libraries
extra_files_to_link += system_libs.calculate(all_linker_inputs, newargs, forced=state.forced_stdlibs)
File "/Users/agrawalpriya/emsdk/upstream/emscripten/tools/system_libs.py", line 1954, in calculate
handle_reverse_deps(input_files)
File "/Users/agrawalpriya/emsdk/upstream/emscripten/tools/system_libs.py", line 1791, in handle_reverse_deps
symbolses = building.llvm_nm_multiple([os.path.abspath(t) for t in input_files])
File "/Users/agrawalpriya/emsdk/python/3.9.2_64bit/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/Users/agrawalpriya/emsdk/upstream/emscripten/tools/building.py", line 185, in llvm_nm_multiple
for key, value in parse_llvm_nm_symbols(results.stdout).items():
File "/Users/agrawalpriya/emsdk/upstream/emscripten/tools/building.py", line 578, in parse_llvm_nm_symbols
status = line[entry_pos + 11] # Skip address, which is always fixed-length 8 chars.
IndexError: string index out of range
make[2]: *** [TestProfileWebTestApp.js] Error 1
make[1]: *** [CMakeFiles/TestProfileWebTestApp.dir/all] Error 2
make: *** [all] Error 2
emmake: error: 'make -j4' failed (returned 2)
Please make sure that cmake is installed.

@sbc100
Copy link
Collaborator

sbc100 commented Sep 17, 2022

Could you modify tools/building.py and print results.stdout? that should be enough for us to be able to figure out what is going on the parse failure.

@Pryagrawal
Copy link
Author

results.stdout

hi
@sbc100 can you suggest which line i should modify in tools/building.py to see the parse error

@sbc100
Copy link
Collaborator

sbc100 commented Sep 19, 2022

Can you add print(results.stdout) between lines 184 and 185

@Pryagrawal
Copy link
Author

error_print.docx
i have added the print statement here ,please check the logs
Screenshot 2022-09-19 at 12 50 56 PM

@sbc100
Copy link
Collaborator

sbc100 commented Sep 19, 2022

Could you attach as a simple text file? The docx seems to be causing google docs to struggle.

@Pryagrawal
Copy link
Author

Could you attach as a simple text file? The docx seems to be causing google docs to struggle.

error.txt.

@sbc100
Copy link
Collaborator

sbc100 commented Sep 19, 2022

It looks like some extra chars might have ended up in that text file somehow. Can you run your build command with the > error.txt appended to the end? That should write the contents directly to the error.txt file.

@Pryagrawal
Copy link
Author

It looks like some extra chars might have ended up in that text file somehow. Can you run your build command with the > error.txt appended to the end? That should write the contents directly to the error.txt file.

sure
error.txt

sbc100 added a commit that referenced this issue Sep 19, 2022
See #12551
and:
#17826

Older versions of llvm didn't used to mangle these __invoke symbols.
@sbc100
Copy link
Collaborator

sbc100 commented Sep 19, 2022

I figured out the problem. It looks line some of your object files were built with an older version of clang for example:
/Users/agrawalpriya/TestACE/imports/potluck/libraries/web/release/libPotluckStd.a:MTTestSuite.cpp.o

This object file contains symbols which looks like they must have come from an older version of llvm/clang. Can you try rebuilding all of these ?

sbc100 added a commit that referenced this issue Sep 19, 2022
See #12551
and:
#17826

Older versions of llvm didn't used to mangle these __invoke symbols.
sbc100 added a commit that referenced this issue Sep 19, 2022
See #12551
and:
#17826

Older versions of llvm didn't used to mangle these __invoke symbols.
sbc100 added a commit that referenced this issue Sep 19, 2022
See 
#12551
and:
#17826

Older versions of llvm didn't used to mangle these __invoke symbols.
@Pryagrawal
Copy link
Author

I figured out the problem. It looks line some of your object files were built with an older version of clang for example: /Users/agrawalpriya/TestACE/imports/potluck/libraries/web/release/libPotluckStd.a:MTTestSuite.cpp.o

This object file contains symbols which looks like they must have come from an older version of llvm/clang. Can you try rebuilding all of these ?

I tried your suggestion ,it is working now thanks @sbc100

@layoroger
Copy link

after running this command:

  • [ emcc main.c -o index.html --emrun]> is the command correct?
  • can you help on what command should we use to build? given the parameters above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants