beef331 / wasm3

Yet another wasm runtime to toy with
MIT License
23 stars 3 forks source link

size of array element of type 'IM3Operation' isn't a multiple of its alignment (32 bytes) #8

Closed konsumer closed 1 year ago

konsumer commented 1 year ago

If I just import the latest version of wasm3, I get an error:

import wasm3
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_bind.c1 error generated.
:8:
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_env.h:In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.c:11:
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_core.c:13:
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
13:
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_function.c:9:
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_env.c:11:
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)In file included from
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_info.c:8:
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
    IM3Operation            operations [4];
                                       ^
Error: execution of an external compiler program 'clang -c  -w -ferror-limit=3 -I/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/   -I/usr/local/Cellar/nim/1.6.12/nim/lib -I/Users/konsumer/Desktop/otherdev/null0-nim-light/src -o /Users/konsumer/.cache/nim/null0_d/m3_api_tracer.c.o /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_api_tracer.c' failed with exit code: 1

1 error generated.
1 error generated.
1 error generated.
1 error generated.
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_code.c:10:
In file included from /Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
1 error generated.
       Tip: 33 messages have been suppressed, use --verbose to show them.
     Error: Build failed for package: null0
        ... Execution failed with exit code 256
        ... Command: /usr/local/Cellar/nim/1.6.12/nim/bin/nim c --colors:on --noNimblePath -d:NimblePkgVersion=0.0.0 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/zippy-0.10.10 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/docopt-0.7.0 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/regex-0.20.2 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/unicodedb-0.12.0 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/pixie-5.0.6 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/vmath-2.0.0 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/chroma-0.2.7 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/zippy-0.10.10 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/flatty-0.3.4 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/nimsimd-1.2.5 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/bumpy-1.1.1 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/vmath-2.0.0 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/crunchy-0.1.8 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/nimsimd-1.2.5 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10 --path:/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/micros-0.1.12 --hints:off -o:/Users/konsumer/Desktop/otherdev/null0-nim-light/null0 /Users/konsumer/Desktop/otherdev/null0-nim-light/src/null0.nim
1 error generated.
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.c:135:45: error: size of array element of type 'const IM3Operation' (aka 'const void *(*const)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
static const IM3Operation c_preserveSetSlot [] = { NULL, op_PreserveSetSlot_i32,       op_PreserveSetSlot_i64,
                                            ^
/Users/konsumer/Desktop/otherdev/null0-nim-light/nimbledeps/pkgs/wasm3-0.1.10/wasm3/wasm3c/source/m3_compile.c:137:39: error: size of array element of type 'const IM3Operation' (aka 'const void *(*const)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
static const IM3Operation c_setSetOps [] =       { NULL, op_SetSlot_i32,               op_SetSlot_i64,
                                      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
4 errors generated

I'm on:

Mac OSX Ventura 13.3.1 (x86-64)
nim: 1.6.12 [MacOSX: amd64]
nimble: 0.13.1
"https://github.com/beef331/wasm3 >= 0.1.10"
konsumer commented 1 year ago

Additionally your tests fail:

❯ git clone --recursive https://github.com/beef331/wasm3.git
Cloning into 'wasm3'...
remote: Enumerating objects: 292, done.
remote: Counting objects: 100% (34/34), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 292 (delta 13), reused 20 (delta 10), pack-reused 258
Receiving objects: 100% (292/292), 53.69 KiB | 3.83 MiB/s, done.
Resolving deltas: 100% (137/137), done.
Submodule 'src/wasm3/wasm3c' (https://github.com/wasm3/wasm3.git) registered for path 'src/wasm3/wasm3c'
Cloning into '/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c'...
remote: Enumerating objects: 10369, done.
remote: Total 10369 (delta 0), reused 0 (delta 0), pack-reused 10369
Receiving objects: 100% (10369/10369), 5.66 MiB | 27.48 MiB/s, done.
Resolving deltas: 100% (6839/6839), done.
Submodule path 'src/wasm3/wasm3c': checked out '9a2894387d8cc77c81cbc6e56dcec71451d11f98'
❯ cd wasm3
❯ nimble test
  Verifying dependencies for wasm3@0.1.10
      Info: Dependency on https://github.com/beef331/micros/@any version already satisfied
  Verifying dependencies for micros@0.1.12
  Compiling /Users/konsumer/Downloads/wasm3/tests/test1 (from package wasm3) using c backend
/Users/konsumer/Downloads/wasm3/src/wasm3.nim(220, 14) Warning: Insert rendered proc here [User]
/Users/konsumer/Downloads/wasm3/tests/test1.nim(5, 7) template/generic instantiation of `suite` from here
/Users/konsumer/Downloads/wasm3/tests/test1.nim(6, 8) template/generic instantiation of `test` from here
/usr/local/Cellar/nim/1.6.12/nim/lib/pure/unittest.nim(552, 5) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/Users/konsumer/Downloads/wasm3/tests/test1.nim(5, 7) template/generic instantiation of `suite` from here
/Users/konsumer/Downloads/wasm3/tests/test1.nim(32, 8) template/generic instantiation of `test` from here
/usr/local/Cellar/nim/1.6.12/nim/lib/pure/unittest.nim(552, 5) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/Users/konsumer/Downloads/wasm3/tests/test1.nim(87, 7) template/generic instantiation of `suite` from here
/Users/konsumer/Downloads/wasm3/tests/test1.nim(88, 8) template/generic instantiation of `test` from here
/usr/local/Cellar/nim/1.6.12/nim/lib/pure/unittest.nim(552, 5) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/Users/konsumer/Downloads/wasm3/tests/test1.nim(87, 7) template/generic instantiation of `suite` from here
/Users/konsumer/Downloads/wasm3/tests/test1.nim(95, 8) template/generic instantiation of `test` from here
/usr/local/Cellar/nim/1.6.12/nim/lib/pure/unittest.nim(552, 5) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/Users/konsumer/Downloads/wasm3/tests/test1.nim(87, 7) template/generic instantiation of `suite` from here
/Users/konsumer/Downloads/wasm3/tests/test1.nim(129, 8) template/generic instantiation of `test` from here
/usr/local/Cellar/nim/1.6.12/nim/lib/pure/unittest.nim(552, 5) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/Users/konsumer/Downloads/wasm3/tests/test1.nim(87, 7) template/generic instantiation of `suite` from here
/Users/konsumer/Downloads/wasm3/tests/test1.nim(168, 8) template/generic instantiation of `test` from here
/usr/local/Cellar/nim/1.6.12/nim/lib/pure/unittest.nim(552, 5) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/Users/konsumer/Downloads/wasm3/tests/test1.nim(87, 7) template/generic instantiation of `suite` from here
/Users/konsumer/Downloads/wasm3/tests/test1.nim(180, 8) template/generic instantiation of `test` from here
/usr/local/Cellar/nim/1.6.12/nim/lib/pure/unittest.nim(552, 5) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_api_wasi.cIn file included from :/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_api_libc.c12::
12In file included from :
/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_env.hIn file included from :/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_env.h13::
13:
/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.h/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.h::140140::4040::  error: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)

    IM3Operation            operations [4];    IM3Operation            operations [4];

                                       ^                                       ^

In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_api_meta_wasi.c:10:
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_code.c:10:
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
1 error generated.
1 error generated.
Error: execution of an external compiler program 'clang -c  -w -ferror-limit=3 -I/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/ -Dd_m3HasWASI   -I/usr/local/Cellar/nim/1.6.12/nim/lib -I/Users/konsumer/Downloads/wasm3/tests -o /Users/konsumer/.cache/nim/test1_d/m3_api_libc.c.o /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_api_libc.c' failed with exit code: 1

1 error generated.
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_api_uvwasi.c:12:
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
1 error generated.
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.c:11:
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_api_tracer.c:10:
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_bind.c:8:
In file included from /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_env.h:13:
/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.h:140:40: error: size of array element of type 'IM3Operation' (aka 'const void *(*)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
    IM3Operation            operations [4];
                                       ^
1 error generated.
1 error generated.
       Tip: 4 messages have been suppressed, use --verbose to show them.
     Error: Execution failed with exit code 256
        ... Command: /usr/local/Cellar/nim/1.6.12/nim/bin/nim c --noNimblePath -d:NimblePkgVersion=0.1.10 --path:/Users/konsumer/.nimble/pkgs/micros-0.1.12 --hints:off -r --path:. /Users/konsumer/Downloads/wasm3/tests/test1
1 error generated.
     ~/Dow/wasm3     master  /Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.c:135:45: error: size of array element of type 'const IM3Operation' (aka 'const void *(*const)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
static const IM3Operation c_preserveSetSlot [] = { NULL, op_PreserveSetSlot_i32,       op_PreserveSetSlot_i64,
                                            ^
/Users/konsumer/Downloads/wasm3/src/wasm3/wasm3c/source/m3_compile.c:137:39: error: size of array element of type 'const IM3Operation' (aka 'const void *(*const)(void *const *, unsigned int *, struct M3MemoryHeader *, long long, double)') (8 bytes) isn't a multiple of its alignment (32 bytes)
static const IM3Operation c_setSetOps [] =       { NULL, op_SetSlot_i32,               op_SetSlot_i64,
                                      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
4 errors generated.
beef331 commented 1 year ago

I do not have a mac machine so cannot help debug this much. It compiles on my linux machine with --cc:clang and --cc:gcc.

konsumer commented 1 year ago

It does seem to work ok for me, in (linux) docker, locally:

docker run --platform=linux/amd64 -it --rm ubuntu

# get deps setup
apt update && apt -y install curl git build-essential python-is-python3
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
curl -fsSL https://techoverflow.net/scripts/install-emscripten.sh | bash
source ~/.emsdk/emsdk_env.sh
export PATH=/root/.nimble/bin:$PATH

git clone --recursive https://github.com/beef331/wasm3.git
cd wasm3
nimble install -y
nim c wasmsources/maths.nim
nim c wasmsources/hooks.nim
nim c wasmsources/log.nim
nim c wasmsources/hostinterop.nim
nimble test
konsumer commented 1 year ago

I made PR #9 to add the tests, but it's not building, so it probably needs some tuning.

Update: Using latest emscripten, it seems to build for linux, mac, windows

CI for all 3 platforms is nice, because you can say "works in CI" which tells us that it's probably some local config issue on my Mac (which I will look into.) I will close because this doesn't seem to be a general mac build problem.

Must be something with my mac-default clang, because --cc:gcc works.