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

cannot compile vegan package for wasm #379

Closed
isbool opened this issue Mar 8, 2024 · 1 comment
Closed

cannot compile vegan package for wasm #379

isbool opened this issue Mar 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@isbool
Copy link

isbool commented Mar 8, 2024

Hey, when im trying to compile the vegan package for webr we get the following log: (see also this issue here)

> build("vegan")
v Updated metadata database: 6.19 MB in 4 files.
v Updating metadata database ... done
trying URL 'https://packagemanager.posit.co/cran/latest/src/contrib/vegan_2.6-4.tar.gz'
Content type 'binary/octet-stream' length 1490861 bytes (1.4 MB)
==================================================
downloaded 1.4 MB


> Will install 1 package.
> Will download 2 packages with unknown size.
+ permute   0.9-7 [dl]

i Getting 1 pkg with unknown size
v Got permute 0.9-7 (x86_64-pc-linux-gnu-ubuntu-22.04) (219.60 kB)
v Downloaded 1 package (219.60 kB) in 2s
v Installed permute 0.9-7  (18ms)
v 7 deps: added 1, dld 1 (219.60 kB) [2.7s]
* installing *source* package 'vegan' ...
** package 'vegan' successfully unpacked and MD5 sums checked
** using non-staged installation
** libs
using C compiler: 'emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.47 (431685f05c67f0424c11473cc16798b9587bb536)'
using Fortran compiler: 'flang-new version 17.0.6 (https://github.com/r-wasm/llvm-project 49f8a443424a6111bc055f349c9bfad0aa619c22)'
emcc -DNDEBUG   -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.3/build/include -I/opt/webr/R/build/R-4.3.3/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c data2hill.c -o data2hill.o
/opt/flang/host/bin/flang-new  -fPIC  -O2 -c decorana.f -o decorana.o
emcc -DNDEBUG   -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.3/build/include -I/opt/webr/R/build/R-4.3.3/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c getF.c -o getF.o
emcc -DNDEBUG   -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.3/build/include -I/opt/webr/R/build/R-4.3.3/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c goffactor.c -o goffactor.o
emcc -DNDEBUG   -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.3/build/include -I/opt/webr/R/build/R-4.3.3/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c init.c -o init.o
/opt/flang/host/bin/flang-new  -fPIC  -O2 -c monoMDS.f -o monoMDS.o
emcc -DNDEBUG   -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.3/build/include -I/opt/webr/R/build/R-4.3.3/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c nestedness.c -o nestedness.o
/opt/flang/host/bin/flang-new  -fPIC  -O2 -c ordering.f -o ordering.o
emcc -DNDEBUG   -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.3/build/include -I/opt/webr/R/build/R-4.3.3/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c pnpoly.c -o pnpoly.o
emcc -DNDEBUG   -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.3/build/include -I/opt/webr/R/build/R-4.3.3/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c stepacross.c -o stepacross.o
emcc -DNDEBUG   -I/opt/webr/wasm/include -I/opt/webr/R/build/R-4.3.3/build/include -I/opt/webr/R/build/R-4.3.3/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fpic  -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -std=gnu11 -c vegdist.c -o vegdist.o
emcc -s SIDE_MODULE=1 -s WASM_BIGINT -s ASSERTIONS=1 -L/opt/webr/wasm/lib -L/opt/webr/wasm/R-4.3.3/lib/R/lib -s USE_BZIP2=1 -s USE_ZLIB=1 -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -Oz -o vegan.so data2hill.o decorana.o getF.o goffactor.o init.o monoMDS.o nestedness.o ordering.o pnpoly.o stepacross.o vegdist.o -L/lib/R/lib -lRlapack -L/lib/R/lib -lRblas /opt/flang/wasm/lib/libFortranRuntime.a
wasm-ld: error: function signature mismatch: malloc
>>> defined as (i64) -> i32 in monoMDS.o
>>> defined as (i32) -> i32 in /opt/flang/wasm/lib/libFortranRuntime.a(ISO_Fortran_binding.o)
emcc: error: '/opt/emsdk/upstream/bin/wasm-ld -o vegan.so --whole-archive -L/opt/webr/wasm/lib -L/opt/webr/wasm/R-4.3.3/lib/R/lib data2hill.o decorana.o getF.o goffactor.o init.o monoMDS.o nestedness.o ordering.o pnpoly.o stepacross.o vegdist.o -L/lib/R/lib /opt/webr/wasm/R-4.3.3/lib/R/lib/libRlapack.so -L/lib/R/lib /opt/webr/wasm/R-4.3.3/lib/R/lib/libRblas.so /opt/flang/wasm/lib/libFortranRuntime.a -L/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr -mllvm -wasm-enable-eh -mllvm -exception-model=wasm --import-memory --strip-debug --export-dynamic --export-if-defined=main --export-if-defined=__get_exception_message --export-if-defined=free --export-if-defined=__cpp_exception --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=__thrown_object_from_unwind_exception --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=__wasm_apply_data_relocs --export-if-defined=fflush --export=__wasm_call_ctors --experimental-pic -shared' failed (returned 1)
make: *** [/opt/R/4.3.2/lib/R/share/make/shlib.mk:10: vegan.so] Error 1
ERROR: compilation failed for package 'vegan'
* removing '/tmp/RtmpyRTq6H/file19f246e3/vegan'
Error in wasm_build(pkg, tarball_path, out_dir) :
  Building wasm binary for package 'vegan' failed.

the issue seems to be a mismatch between 32bit integers and 64 bit integers

@georgestagg georgestagg added the bug Something isn't working label Mar 8, 2024
@isbool isbool changed the title cannot compile vegan package for weed cannot compile vegan package for wasm Mar 8, 2024
@georgestagg
Copy link
Member

This should now work, see vegandevs/vegan#623 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants