wasmerio / wasmer

🚀 The leading Wasm Runtime supporting WASIX, WASI and Emscripten
https://wasmer.io
MIT License
18.44k stars 789 forks source link

Compile from source, c-api to arm7hf #2324

Closed FreerGit closed 3 months ago

FreerGit commented 3 years ago

Describe the bug

I have tried both using the linux amd64 release and compiling to source, compiling c program with wasmer-c-api gives error that wasmer/lib/libwasmer.a is in wrong file format. I am assuming there is a difference between amd64 and arm7hf, altough not sure what would case the difference.

Secondly, compiling from source gives error: unrecognized command line option '-m64'

warning: arm-linux-gnueabihf-gcc: error: unrecognized command line option '-m64'

error: failed to run custom build command for `wasmer-vm v1.0.2 (/opt/app/wasmer-1.0.2/lib/vm)`

Caused by:
  process didn't exit successfully: `/opt/app/wasmer-1.0.2/target/release/build/wasmer-vm-537a81e262323833/build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-changed=src/trap/helpers.c
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-unknown-linux-gnu")
  CC_x86_64-unknown-linux-gnu = None
  CC_x86_64_unknown_linux_gnu = None
  HOST_CC = None
  CC = Some("arm-linux-gnueabihf-gcc  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/axis/acapsdk/sysroots/armv7hf")
  CFLAGS_x86_64-unknown-linux-gnu = None
  CFLAGS_x86_64_unknown_linux_gnu = None
  HOST_CFLAGS = None
  CFLAGS = Some(" -O2 -pipe -g -feliminate-unused-debug-types ")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "arm-linux-gnueabihf-gcc" "-mthumb" "-mfpu=neon" "-mfloat-abi=hard" "-mcpu=cortex-a9" "-fstack-protector-strong" "-D_FORTIFY_SOURCE=2" "-Wformat" "-Wformat-security" "-Werror=format-security" "--sysroot=/opt/axis/acapsdk/sysroots/armv7hf" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-O2" "-pipe" "-g" "-feliminate-unused-debug-types" "-Wall" "-Wextra" "-o" "/opt/app/wasmer-1.0.2/target/release/build/wasmer-vm-5f74bca1f4b8ee73/out/src/trap/helpers.o" "-c" "src/trap/helpers.c"
  cargo:warning=arm-linux-gnueabihf-gcc: error: unrecognized command line option '-m64'
  exit code: 1

To be clear, this is running inside a docker container: FROM axisecp/acap-sdk:3.3-armv7hf-ubuntu20.04

All im trying to do is to use a wasm file inside of a c program, hence the usage of wasm-c-api.

Steps to reproduce

start docker image as described above download the source from release pages on wasmer github curl rustup make build-capi

MarkMcCaskey commented 3 years ago

Thanks for the report! I tagged it with enhancement as 32bit ARM is not something we currently support. I left the 'bug' label however because perhaps we should detect this case and produce a clearer error message here.

It should be possible to get this working with compiler LLVM: there aren't too many platform specific places in Wasmer. That said you may run into a few issues with 32bit vs 64bit as we don't actively test on any 32bit platform right now.

If you're interested in adding support for this, we can give you some guidance on what likely needs to be updated.

I am assuming there is a difference between amd64 and arm7hf,

AMD64 is 64bit, it's x86_64 the 64bit extension to Intel's x86 ISA.

arm7hf is 32bit, it's ARM with hardware float support (hence, hf). Wasmer supports x86_64 and aarch64 (the 64bit version of ARM) but not 32bit ARM right now.

adonespitogo commented 1 year ago

+1

truboxl commented 1 year ago

Building for arm32 on Linux still have issues so I am unsure why https://github.com/wasmerio/wasmer/issues/2099#issuecomment-1433863969 claim can build for arm32 on Android

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 months ago

Feel free to reopen the issue if it has been closed by mistake.

desugar-64 commented 2 months ago

It still isn't building for the Android ARMv7 target.