-
Notifications
You must be signed in to change notification settings - Fork 720
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
android armv7 is supported or not #1889
Comments
Try this: https://wasmedge.org/book/en/contribute/build_from_src/android.html Thanks. |
|
Can you build it in Ubuntu with boost installed? I have not tried arch Linux and there might be dependency issues. |
Ok I will try, so is it currently supported to compile to armv7-a android? |
Hi @morn-0 Short answer: Nope. We don't guarantee that WasmEdge can be fully supported on armv7-a android. We provide a CI workflow to build and test on the armv8 android only. It has been a long time since we tried to support the armv7-a android platform. Due to the lack of user numbers, we don't focus on this platform currently. However, according to your log, looks like the boost is not installed or found on your system. |
Hi @morn-0 https://github.com/WasmEdge/WasmEdge/blob/master/utils/ohos/build_for_ohos.sh You may check this for more detailed. |
diff --git a/include/common/types.h b/include/common/types.h
index b5aeefb8..08772bce 100644
--- a/include/common/types.h
+++ b/include/common/types.h
@@ -62,7 +62,8 @@ class FunctionInstance;
}
struct FuncRef {
#if __INTPTR_WIDTH__ == 32
- const uint32_t Padding = -1;
+// const uint32_t Padding = -1;
+ uint32_t Padding = -1;
#endif
const Runtime::Instance::FunctionInstance *Ptr = nullptr;
FuncRef() = default;
@@ -72,7 +73,8 @@ struct FuncRef {
/// ExternRef definition.
struct ExternRef {
#if __INTPTR_WIDTH__ == 32
- const uint32_t Padding = -1;
+// const uint32_t Padding = -1;
+ uint32_t Padding = -1;
#endif
void *Ptr = nullptr;
ExternRef() = default;
diff --git a/include/host/wasi/environ.h b/include/host/wasi/environ.h
index 37d97fd4..1c6bc60a 100644
--- a/include/host/wasi/environ.h
+++ b/include/host/wasi/environ.h
@@ -1017,7 +1017,7 @@ public:
WasiExpect<void> sockGetOpt(__wasi_fd_t Fd,
__wasi_sock_opt_level_t SockOptLevel,
__wasi_sock_opt_so_t SockOptName, void *FlagPtr,
- uint32_t *FlagSizePtr) const noexcept {
+ socklen_t *FlagSizePtr) const noexcept {
auto Node = getNodeOrNull(Fd);
if (unlikely(!Node)) {
return WasiUnexpect(__WASI_ERRNO_BADF);
diff --git a/include/host/wasi/inode.h b/include/host/wasi/inode.h
index 151b1cc7..a0cd7ae2 100644
--- a/include/host/wasi/inode.h
+++ b/include/host/wasi/inode.h
@@ -595,7 +595,7 @@ public:
WasiExpect<void> sockGetOpt(__wasi_sock_opt_level_t SockOptLevel,
__wasi_sock_opt_so_t SockOptName, void *FlagPtr,
- uint32_t *FlagSizePtr) const noexcept;
+ socklen_t *FlagSizePtr) const noexcept;
WasiExpect<void> sockSetOpt(__wasi_sock_opt_level_t SockOptLevel,
__wasi_sock_opt_so_t SockOptName, void *FlagPtr,
diff --git a/include/host/wasi/vinode.h b/include/host/wasi/vinode.h
index d47bf368..8bda57e4 100644
--- a/include/host/wasi/vinode.h
+++ b/include/host/wasi/vinode.h
@@ -654,7 +654,7 @@ public:
WasiExpect<void> sockGetOpt(__wasi_sock_opt_level_t SockOptLevel,
__wasi_sock_opt_so_t SockOptName, void *FlagPtr,
- uint32_t *FlagSizePtr) const noexcept {
+ socklen_t *FlagSizePtr) const noexcept {
return Node.sockGetOpt(SockOptLevel, SockOptName, FlagPtr, FlagSizePtr);
}
diff --git a/include/host/wasi/wasifunc.h b/include/host/wasi/wasifunc.h
index 2b8953e8..ad1f0969 100644
--- a/include/host/wasi/wasifunc.h
+++ b/include/host/wasi/wasifunc.h
@@ -454,7 +454,7 @@ public:
Expect<uint32_t> body(const Runtime::CallingFrame &Frame, int32_t Fd,
uint32_t SockOptLevel, uint32_t SockOptName,
- uint32_t FlagPtr, uint32_t FlagSizePtr);
+ uint32_t FlagPtr, socklen_t FlagSizePtr);
};
class WasiSockSetOpt : public Wasi<WasiSockSetOpt> {
diff --git a/lib/host/wasi/CMakeLists.txt b/lib/host/wasi/CMakeLists.txt
index 2f49c618..77ea798a 100644
--- a/lib/host/wasi/CMakeLists.txt
+++ b/lib/host/wasi/CMakeLists.txt
@@ -29,12 +29,12 @@ target_link_libraries(wasmedgeHostModuleWasi
wasmedgeSystem
)
-if(NOT APPLE AND NOT WIN32 AND NOT ANDROID)
- target_link_libraries(wasmedgeHostModuleWasi
- PUBLIC
- rt
- )
-endif()
+#if(NOT APPLE AND NOT WIN32 AND NOT ANDROID)
+# target_link_libraries(wasmedgeHostModuleWasi
+# PUBLIC
+# rt
+# )
+#endif()
if(WIN32)
target_link_libraries(wasmedgeHostModuleWasi
diff --git a/lib/host/wasi/inode-linux.cpp b/lib/host/wasi/inode-linux.cpp
index a3ed7004..fc31c691 100644
--- a/lib/host/wasi/inode-linux.cpp
+++ b/lib/host/wasi/inode-linux.cpp
@@ -1146,7 +1146,7 @@ WasiExpect<void> INode::sockShutdown(__wasi_sdflags_t SdFlags) const noexcept {
WasiExpect<void> INode::sockGetOpt(__wasi_sock_opt_level_t SockOptLevel,
__wasi_sock_opt_so_t SockOptName,
void *FlagPtr,
- uint32_t *FlagSizePtr) const noexcept {
+ socklen_t *FlagSizePtr) const noexcept {
auto SysSockOptLevel = toSockOptLevel(SockOptLevel);
auto SysSockOptName = toSockOptSoName(SockOptName);
if (SockOptName == __WASI_SOCK_OPT_SO_ERROR) {
diff --git a/lib/host/wasi/linux.h b/lib/host/wasi/linux.h
index 05820b88..4c1f7dc4 100644
--- a/lib/host/wasi/linux.h
+++ b/lib/host/wasi/linux.h
@@ -319,7 +319,11 @@ inline constexpr int toAdvice(__wasi_advice_t Advice) noexcept {
}
}
+#if !defined __ANDROID__ || defined __aarch64__ || defined __x86_64__
inline constexpr __wasi_filetype_t fromFileType(mode_t Mode) noexcept {
+#else
+inline constexpr __wasi_filetype_t fromFileType(unsigned int Mode) noexcept {
+#endif
switch (Mode & S_IFMT) {
case S_IFBLK:
return __WASI_FILETYPE_BLOCK_DEVICE;
diff --git a/lib/host/wasi/wasifunc.cpp b/lib/host/wasi/wasifunc.cpp
index d7c3b99c..60f201fa 100644
--- a/lib/host/wasi/wasifunc.cpp
+++ b/lib/host/wasi/wasifunc.cpp
@@ -2089,7 +2089,7 @@ Expect<uint32_t> WasiSockShutdown::body(const Runtime::CallingFrame &,
Expect<uint32_t> WasiSockGetOpt::body(const Runtime::CallingFrame &Frame,
int32_t Fd, uint32_t SockOptLevel,
uint32_t SockOptName, uint32_t FlagPtr,
- uint32_t FlagSizePtr) {
+ socklen_t FlagSizePtr) {
auto *MemInst = Frame.getMemoryByIndex(0);
if (MemInst == nullptr) {
return __WASI_ERRNO_FAULT;
@@ -2109,7 +2109,7 @@ Expect<uint32_t> WasiSockGetOpt::body(const Runtime::CallingFrame &Frame,
WasiSockOptName = *Res;
}
- uint32_t *InnerFlagSizePtr = MemInst->getPointer<uint32_t *>(FlagSizePtr);
+ socklen_t *InnerFlagSizePtr = MemInst->getPointer<socklen_t *>(FlagSizePtr);
if (InnerFlagSizePtr == nullptr) {
return __WASI_ERRNO_FAULT;
}
diff --git a/lib/system/allocator.cpp b/lib/system/allocator.cpp
index d20b5e19..4b91b98e 100644
--- a/lib/system/allocator.cpp
+++ b/lib/system/allocator.cpp
@@ -52,8 +52,11 @@ namespace WasmEdge {
namespace {
static inline constexpr const uint64_t kPageSize = UINT64_C(65536);
+#if defined(HAVE_MMAP) && defined(__x86_64__) || defined(__aarch64__) || \
+ WASMEDGE_OS_WINDOWS
static inline constexpr const uint64_t k4G = UINT64_C(0x100000000);
static inline constexpr const uint64_t k12G = UINT64_C(0x300000000);
+#endif
} // namespace
diff --git a/utils/android/standalone/build_for_android.sh b/utils/android/standalone/build_for_android.sh
index 6f50107d..fa9ee8ee 100755
--- a/utils/android/standalone/build_for_android.sh
+++ b/utils/android/standalone/build_for_android.sh
@@ -11,7 +11,7 @@ WASMEDGE_ROOT_PATH=$(dirname $(dirname $(dirname $(dirname $0))))
cd ${WASMEDGE_ROOT_PATH}
-if ! cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_AOT_RUNTIME=OFF -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=23 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_ANDROID_STL_TYPE=c++_static; then
+if ! cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_AOT_RUNTIME=OFF -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=23 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME -DCMAKE_ANDROID_STL_TYPE=c++_static; then
echo === CMakeOutput.log ===
cat build/CMakeFiles/CMakeOutput.log
echo === CMakeError.log === This patch allowed me to compile armv7 correctly. |
We can have this in a PR, however, there is something that needs to be modified such as changing the |
Hi @morn-0 |
Failed to build in WameEdge-0.13.4 source code. NDK Version is 26b
|
Hi @hangedfish |
Fail to build inode-linux.cpp
|
Hi, Line 613
Line 1374
|
Hi @hetvishastri |
Description
Current State
I would like to know if it is currently possible to compile and run on android armv7
Expected
Environment
The following information is optional. Please provide them only if you have built from source.
Steps to Reproduce
The text was updated successfully, but these errors were encountered: