Open talentlessguy opened 3 years ago
I think solang should be compiled to wasi, like so:
cargo build --target wasm32-wasi --release
Then again I don't know if node and/or browsers support wasi.
If I try that, I just get an error about llvm not being found: the llvm libraries needs to built for wasm first. I've tried to do this with clang and failed, I was going to do this with emscripten next.
Also @talentlessguy thank you for looking at porting solang to webassembly, this is really needed :smile:
@seanyoung
1) Yes there's wasi
in Node.js and std/wasi in Deno
2) It still fails but for different reasons:
➜ cargo build --target wasm32-wasi --release
Compiling lsp-types v0.89.2
Compiling contract-metadata v0.3.0
Compiling inkwell v0.1.0-beta.3
Compiling solang v0.1.8 (/home/v1rtl/Coding/forks/solang)
The following warnings were emitted during compilation:
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:12:
warning: In file included from /usr/include/llvm/ADT/Hashing.h:48:
warning: In file included from /usr/include/llvm/Support/ErrorHandling.h:17:
warning: /usr/include/llvm/Support/Compiler.h:21:10: fatal error: 'new' file not found
warning: #include <new>
warning: ^~~~~
warning: 1 error generated.
error: failed to run custom build command for `solang v0.1.8 (/home/v1rtl/Coding/forks/solang)`
Caused by:
process didn't exit successfully: `/home/v1rtl/Coding/forks/solang/target/release/build/solang-7656b77601092452/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=src/parser/solidity.lalrpop
TARGET = Some("wasm32-wasi")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_wasm32-wasi = None
CXX_wasm32_wasi = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-wasi = None
CXXFLAGS_wasm32_wasi = None
TARGET_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "-Wall" "-Wextra" "-Wno-unused-parameter" "-I/usr/include" "-std=c++14" "-fno-exceptions" "-D_GNU_SOURCE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-o" "/home/v1rtl/Coding/forks/solang/target/wasm32-wasi/release/build/solang-711ae689a401e349/out/src/linker/linker.o" "-c" "src/linker/linker.cpp"
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/Hashing.h:48:
cargo:warning=In file included from /usr/include/llvm/Support/ErrorHandling.h:17:
cargo:warning=/usr/include/llvm/Support/Compiler.h:21:10: fatal error: 'new' file not found
cargo:warning=#include <new>
cargo:warning= ^~~~~
cargo:warning=1 error generated.
exit status: 1
--- stderr
error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "-Wall" "-Wextra" "-Wno-unused-parameter" "-I/usr/include" "-std=c++14" "-fno-exceptions" "-D_GNU_SOURCE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-o" "/home/v1rtl/Coding/forks/solang/target/wasm32-wasi/release/build/solang-711ae689a401e349/out/src/linker/linker.o" "-c" "src/linker/linker.cpp" with args "clang" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
error[E0308]: mismatched types
--> /home/v1rtl/.cargo/registry/src/github.com-1ecc6299db9ec823/inkwell-0.1.0-beta.3/src/module.rs:601:95
|
601 | pub fn write_bitcode_to_file(&self, file: &File, should_close: bool, unbuffered: bool) -> bool {
| --------------------- ^^^^ expected `bool`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: build failed
for more context:
I have:
So there are two issues:
--sysroot=wasi-sysroot..
using TARGET_CFLAGS
and TARGET_CXXFLAGS
With that done a whole new world of pain is opened: linking. This requires a wasm build of llvm which can be done with emscripten, I think. I don't have it working yet.
@seanyoung It still errors:
$ env TARGET_CFLAGS=--sysroot=wasi-sysroot.. TARGET_CXXFLAGS=--sysroot=wasi-sysroot cargo build --target wasm32-wasi --release
Compiling inkwell v0.1.0 (https://github.com/TheDan64/inkwell?branch=master#d018ee22)
Compiling solang v0.1.8 (/home/v1rtl/Coding/forks/solang)
The following warnings were emitted during compilation:
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:12:
warning: In file included from /usr/include/llvm/ADT/Hashing.h:48:
warning: In file included from /usr/include/llvm/Support/ErrorHandling.h:17:
warning: /usr/include/llvm/Support/Compiler.h:21:10: fatal error: 'new' file not found
warning: #include <new>
warning: ^~~~~
warning: 1 error generated.
error: failed to run custom build command for `solang v0.1.8 (/home/v1rtl/Coding/forks/solang)`
Caused by:
process didn't exit successfully: `/home/v1rtl/Coding/forks/solang/target/release/build/solang-7656b77601092452/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=src/parser/solidity.lalrpop
TARGET = Some("wasm32-wasi")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_wasm32-wasi = None
CXX_wasm32_wasi = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-wasi = None
CXXFLAGS_wasm32_wasi = None
TARGET_CXXFLAGS = Some("--sysroot=wasi-sysroot")
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "--sysroot=wasi-sysroot" "-Wno-unused-parameter" "-I/usr/include" "-std=c++14" "-fno-exceptions" "-D_GNU_SOURCE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-o" "/home/v1rtl/Coding/forks/solang/target/wasm32-wasi/release/build/solang-711ae689a401e349/out/src/linker/linker.o" "-c" "src/linker/linker.cpp"
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/Hashing.h:48:
cargo:warning=In file included from /usr/include/llvm/Support/ErrorHandling.h:17:
cargo:warning=/usr/include/llvm/Support/Compiler.h:21:10: fatal error: 'new' file not found
cargo:warning=#include <new>
cargo:warning= ^~~~~
cargo:warning=1 error generated.
exit status: 1
--- stderr
error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "--sysroot=wasi-sysroot" "-Wno-unused-parameter" "-I/usr/include" "-std=c++14" "-fno-exceptions" "-D_GNU_SOURCE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-o" "/home/v1rtl/Coding/forks/solang/target/wasm32-wasi/release/build/solang-711ae689a401e349/out/src/linker/linker.o" "-c" "src/linker/linker.cpp" with args "clang" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
error[E0308]: mismatched types
--> /home/v1rtl/.cargo/git/checkouts/inkwell-946411d814d2c9f8/d018ee2/src/module.rs:601:95
|
601 | pub fn write_bitcode_to_file(&self, file: &File, should_close: bool, unbuffered: bool) -> bool {
| --------------------- ^^^^ expected `bool`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: build failed
I have clang and wasi-sdk both installed to /usr/bin
You need to set the correct sysroot for the wasi sdk (share/sysroot in wasi-sdk).
inkwell needs this fix: https://github.com/TheDan64/inkwell/pull/270
@seanyoung oops sorry I found out the location of sysroot
it was in /opt/wasi-sdk
but now I get this:
➜ echo $WASI_SDK_PATH
/opt/wasi-sdk/wasi-sysroot
➜ env TARGET_CFLAGS=--sysroot=$WASI_SDK_PATH TARGET_CXXFLAGS=--sysroot=$WASI_SDK_PATH cargo build --target wasm32-wasi --release
Compiling inkwell v0.1.0 (https://github.com/TheDan64/inkwell?branch=master#d018ee22)
Compiling solang v0.1.8 (/home/v1rtl/Coding/forks/solang)
The following warnings were emitted during compilation:
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:12:
warning: In file included from /usr/include/llvm/ADT/Hashing.h:48:
warning: In file included from /usr/include/llvm/Support/ErrorHandling.h:17:
warning: In file included from /usr/include/llvm/Support/Compiler.h:21:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/new:89:
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/__config:1209:2: error: _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
warning: #error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
warning: ^
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:12:
warning: In file included from /usr/include/llvm/ADT/Hashing.h:48:
warning: In file included from /usr/include/llvm/Support/ErrorHandling.h:18:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/string:506:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/string_view:175:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/__string:57:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/algorithm:643:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/memory:668:
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/typeinfo:225:16: error: reinterpret_cast from 'std::__type_info_implementations::__non_unique_arm_rtti_bit_impl::__type_name_t' (aka 'unsigned int') to 'size_t' (aka 'unsigned long') is not allowed
warning: return reinterpret_cast<size_t>(__v);
warning: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
warning: In file included from /usr/include/llvm/ADT/SmallVector.h:19:
warning: In file included from /usr/include/llvm/Support/MathExtras.h:19:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/climits:41:
warning: In file included from /usr/include/limits.h:124:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/limits.h:57:
warning: In file included from /usr/lib/clang/12.0.1/include/limits.h:21:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/limits.h:6:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/bits/alltypes.h:269:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/__struct_timeval.h:4:
warning: /opt/wasi-sdk/wasi-sysroot/include/__typedef_time_t.h:5:19: error: typedef redefinition with different types ('long long' vs '__time_t' (aka 'long'))
warning: typedef long long time_t;
warning: ^
warning: /usr/include/bits/types/time_t.h:7:18: note: previous definition is here
warning: typedef __time_t time_t;
warning: ^
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
warning: In file included from /usr/include/llvm/ADT/SmallVector.h:19:
warning: In file included from /usr/include/llvm/Support/MathExtras.h:19:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/climits:41:
warning: In file included from /usr/include/limits.h:124:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/limits.h:57:
warning: In file included from /usr/lib/clang/12.0.1/include/limits.h:21:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/limits.h:6:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/bits/alltypes.h:269:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/__struct_timeval.h:5:
warning: /opt/wasi-sdk/wasi-sysroot/include/__typedef_suseconds_t.h:6:19: error: typedef redefinition with different types ('long long' vs '__suseconds_t' (aka 'long'))
warning: typedef long long suseconds_t;
warning: ^
warning: /usr/include/sys/types.h:138:23: note: previous definition is here
warning: typedef __suseconds_t suseconds_t;
warning: ^
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
warning: In file included from /usr/include/llvm/ADT/SmallVector.h:19:
warning: In file included from /usr/include/llvm/Support/MathExtras.h:19:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/climits:41:
warning: In file included from /usr/include/limits.h:124:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/limits.h:57:
warning: In file included from /usr/lib/clang/12.0.1/include/limits.h:21:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/limits.h:6:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/bits/alltypes.h:269:
warning: /opt/wasi-sdk/wasi-sysroot/include/__struct_timeval.h:8:8: error: redefinition of 'timeval'
warning: struct timeval {
warning: ^
warning: /usr/include/bits/types/struct_timeval.h:8:8: note: previous definition is here
warning: struct timeval
warning: ^
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
warning: In file included from /usr/include/llvm/ADT/SmallVector.h:19:
warning: In file included from /usr/include/llvm/Support/MathExtras.h:19:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/climits:41:
warning: In file included from /usr/include/limits.h:124:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/limits.h:57:
warning: In file included from /usr/lib/clang/12.0.1/include/limits.h:21:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/limits.h:6:
warning: In file included from /opt/wasi-sdk/wasi-sysroot/include/bits/alltypes.h:270:
warning: /opt/wasi-sdk/wasi-sysroot/include/__struct_timespec.h:7:8: error: redefinition of 'timespec'
warning: struct timespec {
warning: ^
warning: /usr/include/bits/types/struct_timespec.h:10:8: note: previous definition is here
warning: struct timespec
warning: ^
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
warning: In file included from /usr/include/llvm/ADT/SmallVector.h:19:
warning: In file included from /usr/include/llvm/Support/MathExtras.h:20:
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:321:9: error: no member named 'signbit' in the global namespace; did you mean '__signbit'?
warning: using ::signbit;
warning: ~~^
warning: /usr/include/bits/mathcalls-helper-functions.h:24:24: note: '__signbit' declared here
warning: __MATHDECL_ALIAS (int, __signbit,, (_Mdouble_ __value), signbit)
warning: ^
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
warning: In file included from /usr/include/llvm/ADT/SmallVector.h:19:
warning: In file included from /usr/include/llvm/Support/MathExtras.h:20:
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:322:9: error: no member named 'fpclassify' in the global namespace; did you mean '__fpclassify'?
warning: using ::fpclassify;
warning: ~~^
warning: /usr/include/bits/mathcalls-helper-functions.h:20:24: note: '__fpclassify' declared here
warning: __MATHDECL_ALIAS (int, __fpclassify,, (_Mdouble_ __value), fpclassify)
warning: ^
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
warning: In file included from /usr/include/llvm/ADT/SmallVector.h:19:
warning: In file included from /usr/include/llvm/Support/MathExtras.h:20:
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:323:9: error: no member named 'isfinite' in the global namespace
warning: using ::isfinite;
warning: ~~^
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:324:9: error: no member named 'isinf' in the global namespace
warning: using ::isinf;
warning: ~~^
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:325:9: error: no member named 'isnan' in the global namespace
warning: using ::isnan;
warning: ~~^
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:326:9: error: no member named 'isnormal' in the global namespace
warning: using ::isnormal;
warning: ~~^
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:327:7: error: no member named 'isgreater' in the global namespace; did you mean '::std::greater'?
warning: using ::isgreater;
warning: ^~
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/functional:742:29: note: '::std::greater' declared here
warning: struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
warning: ^
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
warning: In file included from /usr/include/llvm/ADT/SmallVector.h:19:
warning: In file included from /usr/include/llvm/Support/MathExtras.h:20:
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:328:7: error: no member named 'isgreaterequal' in the global namespace; did you mean '::std::greater_equal'?
warning: using ::isgreaterequal;
warning: ^~
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/functional:771:29: note: '::std::greater_equal' declared here
warning: struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
warning: ^
warning: In file included from src/linker/linker.cpp:2:
warning: In file included from /usr/include/lld/Common/Driver.h:12:
warning: In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
warning: In file included from /usr/include/llvm/ADT/SmallVector.h:19:
warning: In file included from /usr/include/llvm/Support/MathExtras.h:20:
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:329:9: error: no member named 'isless' in the global namespace
warning: using ::isless;
warning: ~~^
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:330:9: error: no member named 'islessequal' in the global namespace
warning: using ::islessequal;
warning: ~~^
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:331:9: error: no member named 'islessgreater' in the global namespace
warning: using ::islessgreater;
warning: ~~^
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:332:9: error: no member named 'isunordered' in the global namespace
warning: using ::isunordered;
warning: ~~^
warning: /opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:333:9: error: no member named 'isunordered' in the global namespace
warning: using ::isunordered;
warning: ~~^
warning: 19 errors generated.
error: failed to run custom build command for `solang v0.1.8 (/home/v1rtl/Coding/forks/solang)`
Caused by:
process didn't exit successfully: `/home/v1rtl/Coding/forks/solang/target/release/build/solang-7656b77601092452/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=src/parser/solidity.lalrpop
TARGET = Some("wasm32-wasi")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_wasm32-wasi = None
CXX_wasm32_wasi = None
TARGET_CXX = None
CXX = None
CXXFLAGS_wasm32-wasi = None
CXXFLAGS_wasm32_wasi = None
TARGET_CXXFLAGS = Some("--sysroot=/opt/wasi-sdk/wasi-sysroot")
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "--sysroot=/opt/wasi-sdk/wasi-sysroot" "-Wno-unused-parameter" "-I/usr/include" "-std=c++14" "-fno-exceptions" "-D_GNU_SOURCE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-o" "/home/v1rtl/Coding/forks/solang/target/wasm32-wasi/release/build/solang-711ae689a401e349/out/src/linker/linker.o" "-c" "src/linker/linker.cpp"
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/Hashing.h:48:
cargo:warning=In file included from /usr/include/llvm/Support/ErrorHandling.h:17:
cargo:warning=In file included from /usr/include/llvm/Support/Compiler.h:21:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/new:89:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/__config:1209:2: error: _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
cargo:warning=#error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
cargo:warning= ^
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/Hashing.h:48:
cargo:warning=In file included from /usr/include/llvm/Support/ErrorHandling.h:18:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/string:506:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/string_view:175:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/__string:57:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/algorithm:643:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/memory:668:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/typeinfo:225:16: error: reinterpret_cast from 'std::__type_info_implementations::__non_unique_arm_rtti_bit_impl::__type_name_t' (aka 'unsigned int') to 'size_t' (aka 'unsigned long') is not allowed
cargo:warning= return reinterpret_cast<size_t>(__v);
cargo:warning= ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
cargo:warning=In file included from /usr/include/llvm/ADT/SmallVector.h:19:
cargo:warning=In file included from /usr/include/llvm/Support/MathExtras.h:19:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/climits:41:
cargo:warning=In file included from /usr/include/limits.h:124:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/limits.h:57:
cargo:warning=In file included from /usr/lib/clang/12.0.1/include/limits.h:21:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/limits.h:6:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/bits/alltypes.h:269:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/__struct_timeval.h:4:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/__typedef_time_t.h:5:19: error: typedef redefinition with different types ('long long' vs '__time_t' (aka 'long'))
cargo:warning=typedef long long time_t;
cargo:warning= ^
cargo:warning=/usr/include/bits/types/time_t.h:7:18: note: previous definition is here
cargo:warning=typedef __time_t time_t;
cargo:warning= ^
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
cargo:warning=In file included from /usr/include/llvm/ADT/SmallVector.h:19:
cargo:warning=In file included from /usr/include/llvm/Support/MathExtras.h:19:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/climits:41:
cargo:warning=In file included from /usr/include/limits.h:124:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/limits.h:57:
cargo:warning=In file included from /usr/lib/clang/12.0.1/include/limits.h:21:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/limits.h:6:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/bits/alltypes.h:269:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/__struct_timeval.h:5:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/__typedef_suseconds_t.h:6:19: error: typedef redefinition with different types ('long long' vs '__suseconds_t' (aka 'long'))
cargo:warning=typedef long long suseconds_t;
cargo:warning= ^
cargo:warning=/usr/include/sys/types.h:138:23: note: previous definition is here
cargo:warning=typedef __suseconds_t suseconds_t;
cargo:warning= ^
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
cargo:warning=In file included from /usr/include/llvm/ADT/SmallVector.h:19:
cargo:warning=In file included from /usr/include/llvm/Support/MathExtras.h:19:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/climits:41:
cargo:warning=In file included from /usr/include/limits.h:124:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/limits.h:57:
cargo:warning=In file included from /usr/lib/clang/12.0.1/include/limits.h:21:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/limits.h:6:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/bits/alltypes.h:269:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/__struct_timeval.h:8:8: error: redefinition of 'timeval'
cargo:warning=struct timeval {
cargo:warning= ^
cargo:warning=/usr/include/bits/types/struct_timeval.h:8:8: note: previous definition is here
cargo:warning=struct timeval
cargo:warning= ^
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
cargo:warning=In file included from /usr/include/llvm/ADT/SmallVector.h:19:
cargo:warning=In file included from /usr/include/llvm/Support/MathExtras.h:19:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/climits:41:
cargo:warning=In file included from /usr/include/limits.h:124:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/c++/v1/limits.h:57:
cargo:warning=In file included from /usr/lib/clang/12.0.1/include/limits.h:21:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/limits.h:6:
cargo:warning=In file included from /opt/wasi-sdk/wasi-sysroot/include/bits/alltypes.h:270:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/__struct_timespec.h:7:8: error: redefinition of 'timespec'
cargo:warning=struct timespec {
cargo:warning= ^
cargo:warning=/usr/include/bits/types/struct_timespec.h:10:8: note: previous definition is here
cargo:warning=struct timespec
cargo:warning= ^
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
cargo:warning=In file included from /usr/include/llvm/ADT/SmallVector.h:19:
cargo:warning=In file included from /usr/include/llvm/Support/MathExtras.h:20:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:321:9: error: no member named 'signbit' in the global namespace; did you mean '__signbit'?
cargo:warning=using ::signbit;
cargo:warning= ~~^
cargo:warning=/usr/include/bits/mathcalls-helper-functions.h:24:24: note: '__signbit' declared here
cargo:warning=__MATHDECL_ALIAS (int, __signbit,, (_Mdouble_ __value), signbit)
cargo:warning= ^
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
cargo:warning=In file included from /usr/include/llvm/ADT/SmallVector.h:19:
cargo:warning=In file included from /usr/include/llvm/Support/MathExtras.h:20:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:322:9: error: no member named 'fpclassify' in the global namespace; did you mean '__fpclassify'?
cargo:warning=using ::fpclassify;
cargo:warning= ~~^
cargo:warning=/usr/include/bits/mathcalls-helper-functions.h:20:24: note: '__fpclassify' declared here
cargo:warning=__MATHDECL_ALIAS (int, __fpclassify,, (_Mdouble_ __value), fpclassify)
cargo:warning= ^
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
cargo:warning=In file included from /usr/include/llvm/ADT/SmallVector.h:19:
cargo:warning=In file included from /usr/include/llvm/Support/MathExtras.h:20:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:323:9: error: no member named 'isfinite' in the global namespace
cargo:warning=using ::isfinite;
cargo:warning= ~~^
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:324:9: error: no member named 'isinf' in the global namespace
cargo:warning=using ::isinf;
cargo:warning= ~~^
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:325:9: error: no member named 'isnan' in the global namespace
cargo:warning=using ::isnan;
cargo:warning= ~~^
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:326:9: error: no member named 'isnormal' in the global namespace
cargo:warning=using ::isnormal;
cargo:warning= ~~^
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:327:7: error: no member named 'isgreater' in the global namespace; did you mean '::std::greater'?
cargo:warning=using ::isgreater;
cargo:warning= ^~
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/functional:742:29: note: '::std::greater' declared here
cargo:warning=struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
cargo:warning= ^
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
cargo:warning=In file included from /usr/include/llvm/ADT/SmallVector.h:19:
cargo:warning=In file included from /usr/include/llvm/Support/MathExtras.h:20:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:328:7: error: no member named 'isgreaterequal' in the global namespace; did you mean '::std::greater_equal'?
cargo:warning=using ::isgreaterequal;
cargo:warning= ^~
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/functional:771:29: note: '::std::greater_equal' declared here
cargo:warning=struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
cargo:warning= ^
cargo:warning=In file included from src/linker/linker.cpp:2:
cargo:warning=In file included from /usr/include/lld/Common/Driver.h:12:
cargo:warning=In file included from /usr/include/llvm/ADT/ArrayRef.h:14:
cargo:warning=In file included from /usr/include/llvm/ADT/SmallVector.h:19:
cargo:warning=In file included from /usr/include/llvm/Support/MathExtras.h:20:
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:329:9: error: no member named 'isless' in the global namespace
cargo:warning=using ::isless;
cargo:warning= ~~^
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:330:9: error: no member named 'islessequal' in the global namespace
cargo:warning=using ::islessequal;
cargo:warning= ~~^
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:331:9: error: no member named 'islessgreater' in the global namespace
cargo:warning=using ::islessgreater;
cargo:warning= ~~^
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:332:9: error: no member named 'isunordered' in the global namespace
cargo:warning=using ::isunordered;
cargo:warning= ~~^
cargo:warning=/opt/wasi-sdk/wasi-sysroot/include/c++/v1/cmath:333:9: error: no member named 'isunordered' in the global namespace
cargo:warning=using ::isunordered;
cargo:warning= ~~^
cargo:warning=19 errors generated.
exit status: 1
--- stderr
error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-wasi" "--sysroot=/opt/wasi-sdk/wasi-sysroot" "-Wno-unused-parameter" "-I/usr/include" "-std=c++14" "-fno-exceptions" "-D_GNU_SOURCE" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-o" "/home/v1rtl/Coding/forks/solang/target/wasm32-wasi/release/build/solang-711ae689a401e349/out/src/linker/linker.o" "-c" "src/linker/linker.cpp" with args "clang" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
error[E0308]: mismatched types
--> /home/v1rtl/.cargo/git/checkouts/inkwell-946411d814d2c9f8/d018ee2/src/module.rs:601:95
|
601 | pub fn write_bitcode_to_file(&self, file: &File, should_close: bool, unbuffered: bool) -> bool {
| --------------------- ^^^^ expected `bool`, found `()`
| |
| implicitly returns `()` as its body has no tail or `return` expression
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
error: build failed
this is wasi-sdk v12.0-1
Ok, now the issue is that you are using your systems llvm, so compiled for x86, not an llvm cross-compiled to wasm. That can be done with emscripten (I hope).
@seanyoung do you know how to do that?
I have both emscripten, llvm and wasi-sdk installed. I also have wasm-ld
I haven't gotten it working yet. Any help would be appreciated.
I think we need this resolved. https://github.com/rustwasm/wasm-pack/issues/654
Then again, others have compiled clang to run in a browser - which means wasi is not necessary.
Is this relevant?
Is this relevant?
The problem is linking against llvm libraries, not C in general. Unless I am missing something here
FYI we did some experiments using the emscripten
target. Compiling LLVM for emscripten was no issue - the only limiting factor seems to be memory usage (in the browser you get max. 3gb)
oh that's really cool
I've tried to compile via cargo build --target wasm32-unknown-emscripten --release
but it complains about types. Seems like something's wrong with the mio
package
error[E0583]: file not found for module `selector`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/sys/unix/mod.rs:52:5
|
52 | mod selector;
| ^^^^^^^^^^^^^
|
= help: to create the module `selector`, create file "/home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/sys/unix/selector.rs" or "/home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/sys/unix/selector/mod.rs"
= note: if there is a `mod selector` elsewhere in the crate already, import it with `use crate::...` instead
error[E0583]: file not found for module `waker`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/sys/unix/mod.rs:104:5
|
104 | mod waker;
| ^^^^^^^^^^
|
= help: to create the module `waker`, create file "/home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/sys/unix/waker.rs" or "/home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/sys/unix/waker/mod.rs"
= note: if there is a `mod waker` elsewhere in the crate already, import it with `use crate::...` instead
error[E0432]: unresolved import `crate::sys::IoSourceState`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/io_source.rs:14:5
|
14 | use crate::sys::IoSourceState;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ no `IoSourceState` in `sys`
Compiling tiny-keccak v2.0.2
Compiling same-file v1.0.6
error[E0433]: failed to resolve: could not find `Selector` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/poll.rs:321:18
|
321 | sys::Selector::new().map(|selector| Poll {
| ^^^^^^^^ could not find `Selector` in `sys`
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:24:14
|
24 | sys::event::token(&self.inner)
| ^^^^^ could not find `event` in `sys`
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:38:14
|
38 | sys::event::is_readable(&self.inner)
| ^^^^^ could not find `event` in `sys`
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:43:14
|
43 | sys::event::is_writable(&self.inner)
| ^^^^^ could not find `event` in `sys`
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:68:14
|
68 | sys::event::is_error(&self.inner)
| ^^^^^ could not find `event` in `sys`
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:99:14
|
99 | sys::event::is_read_closed(&self.inner)
| ^^^^^ could not find `event` in `sys`
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:129:14
|
129 | sys::event::is_write_closed(&self.inner)
| ^^^^^ could not find `event` in `sys`
Compiling rustc-hex v2.1.0
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:151:14
|
151 | sys::event::is_priority(&self.inner)
| ^^^^^ could not find `event` in `sys`
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:173:14
|
173 | sys::event::is_aio(&self.inner)
| ^^^^^ could not find `event` in `sys`
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:183:14
|
183 | sys::event::is_lio(&self.inner)
| ^^^^^ could not find `event` in `sys`
error[E0433]: failed to resolve: could not find `event` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:221:26
|
221 | sys::event::debug_details(f, self.0)
| ^^^^^ could not find `event` in `sys`
Compiling cxxbridge-flags v1.0.128
error[E0412]: cannot find type `Selector` in module `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/poll.rs:272:20
|
272 | selector: sys::Selector,
| ^^^^^^^^ not found in `sys`
error[E0412]: cannot find type `Selector` in module `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/poll.rs:728:44
|
728 | pub(crate) fn selector(&self) -> &sys::Selector {
| ^^^^^^^^ not found in `sys`
error[E0425]: cannot find value `stream` in this scope
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/sys/unix/tcp.rs:134:58
|
134 | unsafe { to_socket_addr(addr.as_ptr()) }.map(|addr| (stream, addr))
| ^^^^^^ not found in this scope
error[E0412]: cannot find type `Waker` in module `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/waker.rs:79:17
|
79 | inner: sys::Waker,
| ^^^^^ not found in `sys`
|
help: consider importing one of these structs
|
1 + use crate::Waker;
|
1 + use std::task::Waker;
|
help: if you import `Waker`, refer to it directly
|
79 - inner: sys::Waker,
79 + inner: Waker,
|
error[E0433]: failed to resolve: could not find `Waker` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/waker.rs:87:14
|
87 | sys::Waker::new(registry.selector(), token).map(|inner| Waker { inner })
| ^^^^^ could not find `Waker` in `sys`
|
help: consider importing one of these structs
|
1 + use crate::Waker;
|
1 + use std::task::Waker;
|
help: if you import `Waker`, refer to it directly
|
87 - sys::Waker::new(registry.selector(), token).map(|inner| Waker { inner })
87 + Waker::new(registry.selector(), token).map(|inner| Waker { inner })
|
error[E0412]: cannot find type `Event` in module `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:18:17
|
18 | inner: sys::Event,
| ^^^^^ not found in `sys`
|
help: consider importing this struct through its public re-export
|
1 + use crate::event::Event;
|
help: if you import `Event`, refer to it directly
|
18 - inner: sys::Event,
18 + inner: Event,
|
error[E0412]: cannot find type `Event` in module `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:187:55
|
187 | pub(crate) fn from_sys_event_ref(sys_event: &sys::Event) -> &Event {
| ^^^^^ not found in `sys`
|
help: consider importing this struct through its public re-export
|
1 + use crate::event::Event;
|
help: if you import `Event`, refer to it directly
|
187 - pub(crate) fn from_sys_event_ref(sys_event: &sys::Event) -> &Event {
187 + pub(crate) fn from_sys_event_ref(sys_event: &Event) -> &Event {
|
error[E0412]: cannot find type `Event` in module `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:191:41
|
191 | &*(sys_event as *const sys::Event as *const Event)
| ^^^^^ not found in `sys`
|
help: consider importing this struct through its public re-export
|
1 + use crate::event::Event;
|
help: if you import `Event`, refer to it directly
|
191 - &*(sys_event as *const sys::Event as *const Event)
191 + &*(sys_event as *const Event as *const Event)
|
error[E0412]: cannot find type `Event` in module `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/event.rs:217:46
|
217 | struct EventDetails<'a>(&'a sys::Event);
| ^^^^^ not found in `sys`
|
help: consider importing this struct through its public re-export
|
1 + use crate::event::Event;
|
help: if you import `Event`, refer to it directly
|
217 - struct EventDetails<'a>(&'a sys::Event);
217 + struct EventDetails<'a>(&'a Event);
|
error[E0412]: cannot find type `Events` in module `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/events.rs:43:17
|
43 | inner: sys::Events,
| ^^^^^^ not found in `sys`
|
help: consider importing this struct through its public re-export
|
1 + use crate::Events;
|
help: if you import `Events`, refer to it directly
|
43 - inner: sys::Events,
43 + inner: Events,
|
error[E0433]: failed to resolve: could not find `Events` in `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/events.rs:94:25
|
94 | inner: sys::Events::with_capacity(capacity),
| ^^^^^^ could not find `Events` in `sys`
|
help: consider importing this struct through its public re-export
|
1 + use crate::Events;
|
help: if you import `Events`, refer to it directly
|
94 - inner: sys::Events::with_capacity(capacity),
94 + inner: Events::with_capacity(capacity),
|
error[E0412]: cannot find type `Events` in module `sys`
--> /home/v1rtl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-1.0.2/src/event/events.rs:189:47
|
189 | pub(crate) fn sys(&mut self) -> &mut sys::Events {
| ^^^^^^ not found in `sys`
|
help: consider importing this struct through its public re-export
|
1 + use crate::Events;
|
help: if you import `Events`, refer to it directly
|
189 - pub(crate) fn sys(&mut self) -> &mut sys::Events {
189 + pub(crate) fn sys(&mut self) -> &mut Events {
|
Compiling tinyvec_macros v0.1.1
Compiling walkdir v2.5.0
Compiling tinyvec v1.8.0
Compiling dirs-sys-next v0.1.2
Compiling codespan-reporting v0.11.1
Compiling rustversion v1.0.17
Compiling percent-encoding v2.3.1
Some errors have detailed explanations: E0412, E0425, E0432, E0433, E0583.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `mio` (lib) due to 26 previous errors
warning: build failed, waiting for other jobs to finish..
AFAIC mio
is a fairly low level crate so to me it's not surprising it causes some issues in emscripten
. I guess you can check cargo tree
to find out what dependencies rely on them and how to work around that (e.g. use alternatives that work fine in emscripten
, gate it behind a feature flag, etc.)
I am wondering if the problem is that wasm doesn't have thread support, and there for mio
won't work.
Hello, I'm writing a Deno library for Solidity compiler bindings and I decided to try to wrap Solang.
I am following this guide for compiling Rust to WebAssembly: https://depth-first.com/articles/2020/06/29/compiling-rust-to-webassembly-a-simple-example/
my linux kernel version is 5.10.63, distro is Manjaro Linux
I installed
lld
,lib32-llvm
,libc++
,rustc
1.53,rustup
1.24.3and added this to
Cargo.toml
:and tried to run
cargo build --target wasm32-unknown-unknown --release
and I get this:
What should I install from C/C++ libraries to make it compile?
thanks in advance