realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

build on arm64 success, but run failed

Open chichiangho opened this issue 3 years ago • 7 comments

How frequently does the bug occur?

All the time

Description

build sucess with electron-builder install-app-deps, but run failed with yarn start.

Stacktrace & log output

A JavaScript error occurred in the main process
Uncaught Exception:
Error: /home/greatwall/m5-shell/desktop/A9/electron_shell/node_modules/realm/build/Release/realm.node: undefined symbol: BIO_get_new_index
    at process.func [as dlopen] (electron/js2c/asar.js:140:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1196:18)
    at Object.func [as .node] (electron/js2c/asar.js:140:31)
    at Module.load (internal/modules/cjs/loader.js:981:32)
    at Module._load (internal/modules/cjs/loader.js:881:14)
    at Function.Module._load (electron/js2c/asar.js:779:28)
    at Module.require (internal/modules/cjs/loader.js:1023:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at bindings (/home/greatwall/m5-shell/desktop/A9/electron_shell/node_modules/bindings/bindings.js:112:48)
    at getRealmConstructor (/home/greatwall/m5-shell/desktop/A9/electron_shell/node_modules/realm/lib/index.js:28:37)

Can you reproduce the bug?

Yes, always

Reproduction Steps

electron-builder install-app-deps

yarn start

Version

10.19.1

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

Linux greatwall-GW-001M1A-FTF 4.4.131-20200710.kylin.desktop-generic #kylin SMP Fri Jul 10 13:46:24 CST 2020 aarch64 aarch64 aarch64 GNU/Linux

Build environment

gcc version:8.3.0 (install by make install with source) COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/aarch64-unknown-linux-gnu/8.3.0/lto-wrapper 目标:aarch64-unknown-linux-gnu 配置为:/home/greatwall/gcc-8.3.0/configure --with-gmp=/opt/gmp-6.2.1 --with-mpfr=/opt/mpfr-4.1.0 --with-mpc=/opt/mpc-1.2.1 线程模型:posix gcc 版本 8.3.0 (GCC)

node version:16.15.1 (also install by make)

Cocoapods version

No response

chichiangho avatar Jun 22 '22 13:06 chichiangho

with [email protected]

chichiangho avatar Jun 22 '22 13:06 chichiangho

Hi @chichiangho, thanks for the report. I tried to reproduce this in a Ubuntu VM but could not hit the issue. I'm not really familiar with electron-builder – could you please share a repo with a minimal reproduction of the issue?

tomduncalf avatar Jun 23 '22 10:06 tomduncalf

@chichiangho I don't know if https://github.com/realm/realm-js/issues/3687#issuecomment-1024149588 can be applied here.

kneth avatar Jun 24 '22 10:06 kneth

Hi @chichiangho, thanks for the report. I tried to reproduce this in a Ubuntu VM but could not hit the issue. I'm not really familiar with electron-builder – could you please share a repo with a minimal reproduction of the issue?

this problem happens on a arm64 device. guess i find out what makes this problem. the realm-core requires openssl, and realm/vendor/realm-core/CMakeLists.txt(line 229) only download one on Linux X86_64.

if(ANDROID OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"))

do you have a plan to support Linux arm64?

chichiangho avatar Jun 25 '22 02:06 chichiangho

@chichiangho I don't know if #3687 (comment) can be applied here.

I think that is a same problem, do you have a plan to support linux arm64? or can i just close openssl. unfortunately, i also need to support linux mips64el

chichiangho avatar Jun 25 '22 02:06 chichiangho

➤ chichiangho commented:

Hi @chichiangho, thanks for the report. I tried to reproduce this in a Ubuntu VM but could not hit the issue. I'm not really familiar with electron-builder – could you please share a repo with a minimal reproduction of the issue?

this problem happens on a arm64 device. guess i find out what makes this problem. the realm-core requires openssl, and realm/vendor/realm-core/CMakeLists.txt(line 229) only download one on Linux X86_64.

if(ANDROID OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"))

do you have a plan to support Linux arm64?

sync-by-unito[bot] avatar Jun 25 '22 02:06 sync-by-unito[bot]

You can set the environment variable REALM_USE_SYSTEM_OPENSSL to use the system OpenSSL. It should work for both MIPS and ARM. Currently we need to use a custom OpenSSL to support encryption and sync.

kneth avatar Jun 27 '22 11:06 kneth

In Docker on my M1 macbook I have cloned and built successfully Realm JavaScript for Ubuntu (Linux 81ceaf4307d6 5.10.104-linuxkit #1 SMP PREEMPT Thu Mar 17 17:05:54 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux). Moreover, I am able to launch an app which connects to Atlas App Services (using HTTPS - OpenSSL).

The trick was to do export REALM_USE_SYSTEM_OPENSSL=1 before building.

I am closing the issue as I believe there is a path forward for people who wants to use ARM64 and Linux.

kneth avatar Sep 16 '22 11:09 kneth