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

How to set proper architecture for C tests #984

Closed
AdamSLevy opened this issue Nov 20, 2019 · 2 comments · Fixed by #987
Closed

How to set proper architecture for C tests #984

AdamSLevy opened this issue Nov 20, 2019 · 2 comments · Fixed by #987
Assignees
Labels
📦 lib-c-api About wasmer-c-api ❓ question I've a question!

Comments

@AdamSLevy
Copy link

Summary

I am attempting to run the runtime-c-api tests but I'm running into this compilation issue. I'm on an up to date Arch Linux system. I've run rustup default nightly.

$ cargo test -- --nocapture
...
[ 23%] Built target test-module-imports
Scanning dependencies of target test-import-function
[ 26%] Building C object CMakeFiles/test-import-function.dir/test-import-function.c.o

stderr:
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c: In function ‘print_str’:
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:23:47: error: implicit declaration of function ‘wasmer_trampoline_get_context’ [-Werror=implicit-function-declaration]
   23 |     struct print_str_context *local_context = wasmer_trampoline_get_context();
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:23:47: error: initialization of ‘struct print_str_context *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c: In function ‘main’:
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:51:5: error: unknown type name ‘wasmer_trampoline_buffer_builder_t’
   51 |     wasmer_trampoline_buffer_builder_t *tbb = wasmer_trampoline_buffer_builder_new();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:51:47: error: implicit declaration of function ‘wasmer_trampoline_buffer_builder_new’ [-Werror=implicit-function-declaration]
   51 |     wasmer_trampoline_buffer_builder_t *tbb = wasmer_trampoline_buffer_builder_new();
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:51:47: error: initialization of ‘int *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:52:35: error: implicit declaration of function ‘wasmer_trampoline_buffer_builder_add_context_trampoline’ [-Werror=implicit-function-declaration]
   52 |     unsigned long print_str_idx = wasmer_trampoline_buffer_builder_add_context_trampoline(
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:54:10: error: ‘wasmer_trampoline_callable_t’ undeclared (first use in this function)
   54 |         (wasmer_trampoline_callable_t *) print_str,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:54:10: note: each undeclared identifier is reported only once for each function it appears in
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:54:40: error: expected expression before ‘)’ token
   54 |         (wasmer_trampoline_callable_t *) print_str,
      |                                        ^
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:57:5: error: unknown type name ‘wasmer_trampoline_buffer_t’
   57 |     wasmer_trampoline_buffer_t *tb = wasmer_trampoline_buffer_builder_build(tbb);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:57:38: error: implicit declaration of function ‘wasmer_trampoline_buffer_builder_build’ [-Werror=implicit-function-declaration]
   57 |     wasmer_trampoline_buffer_t *tb = wasmer_trampoline_buffer_builder_build(tbb);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:57:38: error: initialization of ‘int *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:58:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
   58 |     const wasmer_trampoline_callable_t *print_str_callable = wasmer_trampoline_buffer_get_trampoline(tb, print_str_idx);
      |                                        ^
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:58:41: error: ‘print_str_callable’ undeclared (first use in this function); did you mean ‘print_str_called’?
   58 |     const wasmer_trampoline_callable_t *print_str_callable = wasmer_trampoline_buffer_get_trampoline(tb, print_str_idx);
      |                                         ^~~~~~~~~~~~~~~~~~
      |                                         print_str_called
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:58:62: error: implicit declaration of function ‘wasmer_trampoline_buffer_get_trampoline’ [-Werror=implicit-function-declaration]
   58 |     const wasmer_trampoline_callable_t *print_str_callable = wasmer_trampoline_buffer_get_trampoline(tb, print_str_idx);
      |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/aslevy/repos/wasmer/lib/runtime-c-api/tests/test-import-function.c:121:5: error: implicit declaration of function ‘wasmer_trampoline_buffer_destroy’ [-Werror=implicit-function-declaration]
  121 |     wasmer_trampoline_buffer_destroy(tb);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/test-import-function.dir/build.make:63: CMakeFiles/test-import-function.dir/test-import-function.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:220: CMakeFiles/test-import-function.dir/all] Error 2
make: *** [Makefile:95: all] Error 2

thread 'test_c_api' panicked at 'Command failed with exit status: ExitStatus(ExitStatus(512))', lib/runtime-c-api/tests/runtime_c_api_tests.rs:41:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.


failures:
    test_c_api

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test runtime_c_api_tests'

It appears that a number of things aren't defined due to some macro guards that depend on __x86_64__ being defined prior to including the wasmer.h file. I'm on an x86_64 machine, why is this not working for me? Is this something I need to specify myself somehow?

@AdamSLevy AdamSLevy added the ❓ question I've a question! label Nov 20, 2019
@AdamSLevy
Copy link
Author

AdamSLevy commented Nov 20, 2019

Actually, upon further testing it appears that the issue is that neither __clang__ nor __gcc__ is defined.

@Hywan
Copy link
Contributor

Hywan commented Nov 20, 2019

Duplicate of wasmerio/wasmer-php#93.

@Hywan Hywan self-assigned this Nov 20, 2019
@Hywan Hywan added the 📦 lib-c-api About wasmer-c-api label Nov 20, 2019
@bors bors bot closed this as completed in 6831a6d Nov 20, 2019
@bors bors bot closed this as completed in #987 Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 lib-c-api About wasmer-c-api ❓ question I've a question!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants