bitcoin-core / btcdeb

Bitcoin Script Debugger
MIT License
533 stars 135 forks source link

Problems compiling btcdeb tools into JavaScript using emscripten. #137

Open FabianSommerfeld opened 1 year ago

FabianSommerfeld commented 1 year ago

SYSTEM DATA


ISSUE

I have issues running the command:

for i in btcdeb btcc tap; do mv $i $i.bc && emcc -O2 $i.bc libbitcoin.a -o $i.js; done

output:

mv: cannot stat 'btcdeb': No such file or directory
mv: cannot stat 'btcc': No such file or directory
mv: cannot stat 'tap': No such file or directory

If I just run

emcc -02 btcdeb.bc libbitcoin.a -o btcdeb.js

output:

cache:INFO: generating system asset: symbol_lists/11dce61098b2a912766c8bc2ee813c477c9b41f9.json... (this will be cached in "/mnt/c/Users/heise/btcdeb/emsdk/upstream/emscripten/cache/symbol_lists/11dce61098b2a912766c8bc2ee813c477c9b41f9.json" for subsequent builds)
cache:INFO:  - ok
wasm-ld: error: unknown file type: btcdeb.bc
emcc: error: '/mnt/c/Users/heise/btcdeb/emsdk/upstream/bin/wasm-ld -o btcdeb.wasm btcdeb.bc libbitcoin.a -L/mnt/c/Users/heise/btcdeb/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmpfxr17qdclibemscripten_js_symbols.so --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export-if-defined=fflush --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__errno_location --export=__get_temp_ret --export=__set_temp_ret --export=__wasm_call_ctors --export-table -z stack-size=65536 --initial-memory=16777216 --max-memory=16777216 --no-entry --stack-first --table-base=1' failed (returned 1)
kallewoof commented 1 year ago

This is probably related to #104. Unfortunately I don't have the resources to look into this on my own right now.