biowasm / biowasm

WebAssembly modules for genomics
https://biowasm.com
MIT License
217 stars 20 forks source link

t-coffee #79

Open robertaboukhalil opened 1 year ago

robertaboukhalil commented 1 year ago

Originally posted by @orangeSi in https://github.com/biowasm/aioli/issues/40#issuecomment-1752002835

          when I use the same way to complie(```emscripten/emsdk:2.0.34```) software ```t_coffee``` (http://tcoffee-packages.s3-website.eu-central-1.amazonaws.com/#Stable/Latest/) to wasm and got ```t_coffee.wasm``` without error, but when run in Chrome get error:
[WebWorker] Executing t_coffee -seq=input.fa -reg    args=null
20b6be06-daba-47f1-bec0-8e1412abe74c:1 RuntimeError: unreachable
    at set_nproc(int) (t_coffee.wasm:0x1689fa)
    at t_coffee_dpa(int, char**) (t_coffee.wasm:0x4735be)
    at batch_main(int, char**) (t_coffee.wasm:0x4538ab)
    at main (t_coffee.wasm:0x44d553)
    at VM13 t_coffee.js:1581:22
    at Object.callMain (VM13 t_coffee.js:5618:15)
    at Object.exec (20b6be06-daba-47f1-bec0-8e1412abe74c:1:5793)
    at i (20b6be06-daba-47f1-bec0-8e1412abe74c:1:1015)

detail of at set_nproc(int) (t_coffee.wasm:0x1689fa) is as below:

  (func $set_nproc(int) (;882;) (param $var0 i32) (result i32)
    (local $var1 i32)
    (local $var2 i32)
    (local $var3 i32)
    (local $var4 i32)
    (local $var5 i32)
    global.get $__stack_pointer
    local.set $var1
    i32.const 16
    local.set $var2
    local.get $var1
    local.get $var2
    i32.sub
    local.set $var3
    local.get $var3
    local.get $var0
    i32.store offset=12
    local.get $var3
    i32.load offset=12
    local.set $var4
    i32.const 0
    local.set $var5
    local.get $var5
    local.get $var4
    i32.store offset=696988
    unreachable
  )

Do you occur the silimar error as above?

t_coffee.wasm and t_coffee.js is in t_coffee.wasm.js.zip

Thanks~ Si

robertaboukhalil commented 1 year ago

@orangeSi I'll take a look, can you share the instructions you used to compile t coffee to WebAssembly?

orangeSi commented 1 year ago

ok, the main process is:

## go into docker container of emscripten/emsdk:2.0.34
cd /fsxlustre1/skw/software/biowasm/
wget https://github.com/biowasm/biowasm/archive/refs/heads/main.zip
unzip main.zip
cd biowasm-main
## add t_cofffee to biowasm.json
python3 bin/compile.py  --tools t_coffee --versions 13.46.0
## ok , then got  t_coffee.js and t_coffee.wasm in ./build/t_coffee/13.46.0

## then run it in Chrome, and I removed some thow(e) in  ```t_coffee.js```   to make ```t_coffee -version``` works, 
#### but ```t_coffee iput.fa``` not work and output above raw error!

and the some detail is:

cat tools/t_coffee/compile.sh 
set -eu
cd /fsxlustre1/skw/software/biowasm/biowasm-main/tools/t_coffee
cd tcoffee-Version_13.46.0.919e8c6b/t_coffee/src/
emmake make  t_coffee \
    GPP=emcc CXX=em++ CC=em++ EM_FLAGS="$EM_FLAGS"

the t_coffee source code is in http://tcoffee-packages.s3-website.eu-central-1.amazonaws.com/#Stable/Latest/

FOR reproduce my same error: The test-biowasm.html + test-biowasm.js + t_coffee.js + t_coffee.wasm which output the raw error can be downlad at github_debug.zip

robertaboukhalil commented 1 year ago

I get the same error. For some reason it really doesn't like set_nproc, which is weird because all it does is set a variable to a number.

But if I comment that out from t_coffee.c, it keeps going further BUT gives a different error:

Screenshot 2023-10-12 at 9 15 03 PM

Sounds like tcoffee creates a child process to run some other program? That's not supported in WebAssembly. So I don't think tcoffee will be compilable, unless you modify the program to not do any forking.

orangeSi commented 1 year ago

@robertaboukhalil thanks a lot! I will try to give up the t_coffee later~