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

Final link step crashes on 1.38.30 #8354

Closed
mdboom opened this issue Mar 27, 2019 · 8 comments
Closed

Final link step crashes on 1.38.30 #8354

mdboom opened this issue Mar 27, 2019 · 8 comments

Comments

@mdboom
Copy link
Contributor

mdboom commented Mar 27, 2019

I recently upgraded the pyodide build from 1.38.22 to 1.38.30, and I'm getting the following during the final link step. Any ideas as to where to look?

em++ -s EXPORT_NAME="'pyodide'" -o build/pyodide.asm.html src/main.bc src/jsimport.bc src/jsproxy.bc src/js2python.bc src/pyimport.bc src/pyproxy.bc src/python2js.bc src/python2js_buffer.bc src/runpython.bc src/hiwire.bc \                               
  -O3 -s MODULARIZE=1 cpython/installs/python-3.7.0/lib/libpython3.7.a lz4/lz4-1.8.3/lib/liblz4.a -s "BINARYEN_METHOD='native-wasm'" -s TOTAL_MEMORY=1073741824 -s ALLOW_MEMORY_GROWTH=1 -s MAIN_MODULE=1 -s EMULATED_FUNCTION_POINTERS=1 -s EMULATE_FUNCTION_POINTER_CASTS=1 -s LINKABLE=1 -s EXPORT_ALL=1 -s EXPORTED_FUNCTIONS='["___cxa_guard_acquire", "__ZNSt3__28ios_base4ini
tEPv"]' -s WASM=1 -s SWAPPABLE_ASM_MODULE=1 -s USE_FREETYPE=1 -s USE_LIBPNG=1 -std=c++14 -Lcpython/build/sqlite-autoconf-3270200/.libs -lsqlite3 -lstdc++ --memory-init-file 0 -s "BINARYEN_TRAP_MODE='clamp'" -s TEXTDECODER=0 -s LZ4=1 -s FORCE_FILESYSTEM=1                                                                                                                      cache:INFO: generating port: libz.a... (this will be cached in "/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/.emscripten_cache/asmjs/libz.a" for subsequent builds)        
cache:INFO:  - ok                                                                                                                                                                        
cache:INFO: generating port: libpng.bc... (this will be cached in "/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/.emscripten_cache/asmjs/libpng.bc" for subsequent builds)   root:INFO: building port: libpng                                                                                                                                                          create_lib /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/.emscripten_cache/asmjs/ports-builds/libpng/libpng.bc                                                              
cache:INFO:  - ok                                    
cache:INFO: generating port: libfreetype.a... (this will be cached in "/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/.emscripten_cache/asmjs/libfreetype.a" for subsequent bu
ilds)
cache:INFO:  - ok
cache:INFO: generating system library: libc++_noexcept.a... (this will be cached in "/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/.emscripten_cache/asmjs/libc++_noexcept.a"
 for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libc++abi.bc... (this will be cached in "/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/.emscripten_cache/asmjs/libc++abi.bc" for subse
quent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libc-wasm.bc... (this will be cached in "/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/.emscripten_cache/asmjs/libc-wasm.bc" for subse
quent builds)
cache:INFO:  - ok
emcc: warning: cannot represent a NaN literal '0x7cd89e0' with custom bit pattern in NaN-canonicalizing JS engines (e.g. Firefox and Safari) without erasing bits!
  in   %spec.select = select i1 %2, double 0x7FF8000000000000, double 0xFFF8000000000000 in _Py_dg_stdnan()
#0 0x00000000012930da llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc+0x12930d
a)
#1 0x00000000012911be llvm::sys::RunSignalHandlers() (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc+0x12911be)
#2 0x000000000129134d SignalHandler(int) (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc+0x129134d)
#3 0x00007fcbc3b69030 __restore_rt (/lib64/libpthread.so.0+0x13030)
#4 0x000000000081a691 (anonymous namespace)::JSWriter::CH_emscripten_atomic_exchange_u8(llvm::Instruction const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<
char> >, int) (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc+0x81a691)
#5 0x00000000007f581f (anonymous namespace)::JSWriter::getFunctionIndex(llvm::Function const*) (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1
.38.30_64/bin/llc+0x7f581f)
#6 0x000000000083b652 (anonymous namespace)::JSWriter::printFunctionBody(llvm::Function const*) (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e
1.38.30_64/bin/llc+0x83b652)
#7 0x000000000083cc80 (anonymous namespace)::JSWriter::printModuleBody() (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc+0x83
cc80)
#8 0x000000000084054b (anonymous namespace)::JSWriter::runOnModule(llvm::Module&) (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin
/llc+0x84054b)
#9 0x0000000000d82fe6 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc+0xd82
fe6)
#10 0x00000000005e6097 compileModule(char**, llvm::LLVMContext&) (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc+0x5e6097)
#11 0x00000000005a5724 main (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc+0x5a5724)
#12 0x00007fcbc3622413 __libc_start_main (/lib64/libc.so.6+0x24413)
#13 0x00000000005dbcae _start (/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc+0x5dbcae)
Stack dump:
0.      Program arguments: /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc /tmp/emscripten_temp_gv8782dx/pyodide.asm.bc -march
=js -filetype=asm -o /tmp/tmpkye2el_3.4.js -emscripten-stack-size=5242880 -O3 -emscripten-precise-f32 -emscripten-no-aliasing-function-pointers -emscripten-emulated-function-pointers -em
scripten-emulate-function-pointer-casts -emscripten-relocatable -emscripten-global-base=0 -emscripten-no-exit-runtime -emscripten-wasm
1.      Running pass 'JavaScript backend' on module '/tmp/emscripten_temp_gv8782dx/pyodide.asm.bc'.
shared:ERROR: '/home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc /tmp/emscripten_temp_gv8782dx/pyodide.asm.bc -march=js -filetype=asm -o /tmp/tmpkye2el_3.4.js -emscripten-stack-size=5242880 -O3 -emscripten-precise-f32 -emscripten-no-aliasing-function-pointers -emscripten-emulated-function-pointers -emscripten-emulate-function-pointer-casts -emscripten-relocatable -emscripten-global-base=0 -emscripten-no-exit-runtime -emscripten-wasm' failed (-11)
make: *** [Makefile:67: build/pyodide.asm.js] Error 1
@kripken
Copy link
Member

kripken commented Mar 27, 2019

Is it hitting an assertion there? or a segfault? I feel like usually the full error message makes that clear but I don't see enough to tell.

May be worth trying this in a debug build with assertions, and/or in valgrind.

This doesn't sound like a familiar issue, though. Perhaps something isn't set up right, like fastcomp wasnt rebuilt or using an old version by mistake? Perhaps a reinstall would help.

@mdboom
Copy link
Contributor Author

mdboom commented Mar 27, 2019

Thanks. This was from a completely fresh build, fwiw. I'll try a debug build.

@mdboom
Copy link
Contributor Author

mdboom commented Apr 2, 2019

Here's the output from Valgrind, in case this provides clues:

==18847== Invalid read of size 1
==18847==    at 0x81A691: (anonymous namespace)::JSWriter::CH_emscripten_atomic_exchange_u8(llvm::Instruction const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x7F581E: (anonymous namespace)::JSWriter::getFunctionIndex(llvm::Function const*) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x83B651: (anonymous namespace)::JSWriter::printFunctionBody(llvm::Function const*) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x83CC7F: (anonymous namespace)::JSWriter::printModuleBody() (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x84054A: (anonymous namespace)::JSWriter::runOnModule(llvm::Module&) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0xD82FE5: llvm::legacy::PassManagerImpl::run(llvm::Module&) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x5E6096: compileModule(char**, llvm::LLVMContext&) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x5A5723: main (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==  Address 0x17 is not stack'd, malloc'd or (recently) free'd
==18847== 
==18847== 
==18847== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==18847==  Access not within mapped region at address 0x17
==18847==    at 0x81A691: (anonymous namespace)::JSWriter::CH_emscripten_atomic_exchange_u8(llvm::Instruction const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x7F581E: (anonymous namespace)::JSWriter::getFunctionIndex(llvm::Function const*) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x83B651: (anonymous namespace)::JSWriter::printFunctionBody(llvm::Function const*) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x83CC7F: (anonymous namespace)::JSWriter::printModuleBody() (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x84054A: (anonymous namespace)::JSWriter::runOnModule(llvm::Module&) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0xD82FE5: llvm::legacy::PassManagerImpl::run(llvm::Module&) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x5E6096: compileModule(char**, llvm::LLVMContext&) (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)
==18847==    by 0x5A5723: main (in /home/mdboom/Work/builds/compiling/pyodide.tmp/emsdk/emsdk/clang/tag-e1.38.30/build_tag-e1.38.30_64/bin/llc)

@kripken
Copy link
Member

kripken commented Apr 2, 2019

Hmm, that function assumes the input function has 2 operands - maybe that's the problem? Hard to see how that could fail though. Adding errs() << *CI << '\n' may help understand things. I can try that if you send me the bitcode.

@mdboom
Copy link
Contributor Author

mdboom commented Apr 2, 2019

I added that line and recompiled, but it doesn't seem to be producing additional output.

I've also sent you a copy of the bytecode via e-mail.

@mdboom
Copy link
Contributor Author

mdboom commented Apr 2, 2019

It looks like CI is a NULL pointer (which is why I wasn't seeing any output from that before).

@kripken
Copy link
Member

kripken commented Apr 2, 2019

Thanks, this should fix it, please confirm emscripten-core/emscripten-fastcomp#256

@mdboom
Copy link
Contributor Author

mdboom commented Apr 3, 2019

Yep, the linked PR works for me!

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

2 participants