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

The realm native module cannot be rebuilt #470

Closed
jacky-ttt opened this issue Apr 7, 2018 · 8 comments
Closed

The realm native module cannot be rebuilt #470

jacky-ttt opened this issue Apr 7, 2018 · 8 comments

Comments

@jacky-ttt
Copy link

jacky-ttt commented Apr 7, 2018

I am using Realm in an Electron application, which is built with electron-forge. The packaging process gets stuck at "Preparing to Package Application for arch: x64" if electron-forge start is run before electron-forge package.

I am developing on

  • macOS 10.13.4
  • node js 8.10.0
  • npm 5.6.0
  • python 2.7.14

Here is the example code to reproduce the never-end problem, realm-in-electron.

The steps to successfully package the electron app:

  1. clone the repository
  2. npm install
  3. electron-forge package --platform=darwin --arch=x64

Below is the log that the electron app is successfully packaged:

DEBUG=electron-packager electron-forge package
✔ Checking your system
⠋ Preparing to Package Application for arch: x64  electron-packager Electron Packager 11.1.0 +0ms
  electron-packager Node v8.10.0 +0ms
  electron-packager Host Operating system: darwin (x64) +0ms
  electron-packager Packager Options: {"asar":false,"overwrite":true,"packageManager":"npm","afterCopy":[null],"afterExtract":[null],"afterPrune":[null],"dir":"/Users/jackytsang/GithubRepos/realm_in_electron","arch":"x64","platform":"darwin","out":"/Users/jackytsang/GithubRepos/realm_in_electron/out","electronVersion":"1.8.4","quiet":true} +1ms
  electron-packager Target Platforms: darwin +0ms
  electron-packager Target Architectures: x64 +0ms
  electron-packager Inferring application name from productName in /Users/jackytsang/GithubRepos/realm_in_electron/package.json +0ms
  electron-packager Inferring appVersion from version in /Users/jackytsang/GithubRepos/realm_in_electron/package.json +0ms
  electron-packager Application name: realm_in_electron +10ms
  electron-packager Target Electron version: 1.8.4 +0ms
  electron-packager Ignored path regular expressions: [ '/node_modules/electron($|/)',
  '/node_modules/electron-prebuilt(-compile)?($|/)',
  '/node_modules/electron-packager($|/)',
  '/\\.git($|/)',
  '/node_modules/\\.bin($|/)',
  '\\.o(bj)?$' ] +0ms
⠹ Preparing to Package Application for arch: x64  electron-packager Downloading Electron with options {"platform":"darwin","arch":"x64","version":"1.8.4"} +0ms
⠧ Preparing to Package Application for arch: x64  electron-packager Creating /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64-template +7s
  electron-packager Extracting /Users/jackytsang/.electron/electron-v1.8.4-darwin-x64.zip to /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64-template +1ms
⠼ Preparing to Package Application for arch: x64  electron-packager Initializing app in /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm_in_electron-darwin-x64 from /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64-template template +0ms
⠴ Preparing to Package Application for arch: x64  electron-packager Ignored paths based on the out param: [ '/Users/jackytsang/GithubRepos/realm_in_electron/out' ] +9s
✔ Preparing to Package Application for arch: x64
✔ Compiling Application
  electron-packager Pruning modules via: npm prune --production +0ms
✔ Preparing native dependencies: 1 / 1
⠋ Packaging Application  electron-packager Renaming Electron to realm_in_electron in /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm_in_electron-darwin-x64/Electron.app/Contents/MacOS +3m
  electron-packager Renaming Electron Helper to realm_in_electron Helper in /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm_in_electron-darwin-x64/Electron.app/Contents/Frameworks/Electron Helper.app/Contents/MacOS +2ms
  electron-packager Renaming Electron Helper EH to realm_in_electron Helper EH in /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm_in_electron-darwin-x64/Electron.app/Contents/Frameworks/Electron Helper EH.app/Contents/MacOS +0ms
  electron-packager Renaming Electron Helper NP to realm_in_electron Helper NP in /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm_in_electron-darwin-x64/Electron.app/Contents/Frameworks/Electron Helper NP.app/Contents/MacOS +0ms
  electron-packager Renaming Electron Helper.app to realm_in_electron Helper.app in /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm_in_electron-darwin-x64/Electron.app/Contents/Frameworks +1ms
  electron-packager Renaming Electron Helper EH.app to realm_in_electron Helper EH.app in /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm_in_electron-darwin-x64/Electron.app/Contents/Frameworks +0ms
  electron-packager Renaming Electron Helper NP.app to realm_in_electron Helper NP.app in /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm_in_electron-darwin-x64/Electron.app/Contents/Frameworks +0ms
  electron-packager Moving /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm_in_electron-darwin-x64 to /Users/jackytsang/GithubRepos/realm_in_electron/out/realm_in_electron-darwin-x64 +1ms
✔ Packaging Application

The steps to reproduce the "never-end" problem:

  1. clone the repository
  2. npm install
  3. electron-forge start
  4. electron-forge package --platform=darwin --arch=x64

Here is the log by runing DEBUG=electron-packager electron-forge package --platform=darwin --arch=x64

Jackys-MacBook-Pro:realm-in-electron jackytsang$ DEBUG=electron-packager electn-forge package --platform=darwin --arch=x64
✔ Checking your system
⠋ Preparing to Package Application for arch: x64  electron-packager Electron Packager 11.1.0 +0ms
  electron-packager Node v8.10.0 +0ms
  electron-packager Host Operating system: darwin (x64) +0ms
  electron-packager Packager Options: {"asar":false,"overwrite":true,"packageManager":"npm","afterCopy":[null],"afterExtract":[null],"afterPrune":[null],"dir":"/Users/jackytsang/GithubRepos/realm-in-electron","arch":"x64","platform":"darwin","out":"/Users/jackytsang/GithubRepos/realm-in-electron/out","electronVersion":"1.8.4","quiet":true} +0ms
  electron-packager Target Platforms: darwin +1ms
  electron-packager Target Architectures: x64 +0ms
  electron-packager Inferring application name from productName in /Users/jackytsang/GithubRepos/realm-in-electron/package.json +0ms
  electron-packager Inferring appVersion from version in /Users/jackytsang/GithubRepos/realm-in-electron/package.json +1ms
  electron-packager Application name: realm-in-electron +6ms
  electron-packager Target Electron version: 1.8.4 +0ms
  electron-packager Ignored path regular expressions: [ '/node_modules/electron($|/)',
  '/node_modules/electron-prebuilt(-compile)?($|/)',
  '/node_modules/electron-packager($|/)',
  '/\\.git($|/)',
  '/node_modules/\\.bin($|/)',
  '\\.o(bj)?$' ] +0ms
  electron-packager Downloading Electron with options {"platform":"darwin","arch":"x64","version":"1.8.4"} +0ms
⠸ Preparing to Package Application for arch: x64  electron-packager Removing /Users/jackytsang/GithubRepos/realm-in-electron/out/realm-in-electron-darwin-x64 due to setting overwrite: true +287ms
⠼ Preparing to Package Application for arch: x64  electron-packager Creating /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64-template +2s
  electron-packager Extracting /Users/jackytsang/.electron/electron-v1.8.4-darwin-x64.zip to /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64-template +1ms
⠧ Preparing to Package Application for arch: x64  electron-packager Initializing app in /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64/realm-in-electron-darwin-x64 from /var/folders/9y/7_hsjyyx7jx5dph83941r6tc0000gn/T/electron-packager/darwin-x64-template template +0ms
⠇ Preparing to Package Application for arch: x64  electron-packager Ignored paths based on the out param: [ '/Users/jackytsang/GithubRepos/realm-in-electron/out' ] +4s
⠧ Preparing to Package Application for arch: x64

config.forge in package.json:

"config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {
        "packageManager": "npm"
      },
      "electronWinstallerConfig": {
        "name": "realm_in_electron"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": "",
        "name": "realminelectron"
      }
    }
  }
@malept
Copy link
Member

malept commented Apr 8, 2018

I cannot reproduce this on Linux, using the repository and instructions above.

@jacky-ttt
Copy link
Author

jacky-ttt commented Apr 9, 2018

@malept
I tried to run my project on Ubuntu x64 to see if the packaging process succeeds. When I run electron-forge start, error occurs in the preparing native dependencies process.

I am developing on

  • Ubuntu 16.04.4 x64 (running on VirtualBox 5.2.8 on macOS 10.13.4)
  • node js 8.11.1
  • npm 5.6.0
  • python 2.7.12

Here is the log:
run DEBUG=electron-forge:* electron-forge start:

$ DEBUG=electron-forge:* electron-forge start
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +385ms
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Locating Application +0ms
  electron-forge:project-resolver searching for project in: /home/jackytsang/Desktop/realm-in-electron-master +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /home/jackytsang/Desktop/realm-in-electron-master/package.json +4ms
  electron-forge:lifecycle Process Succeeded: Locating Application +6ms
  electron-forge:lifecycle Process Started: Preparing native dependencies +5ms
  electron-forge:lifecycle Process Failed: Preparing native dependencies +2m

An unhandled error has occurred inside Forge:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/electron-forge/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/build'
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/vendor/realm-linux-x64
Resolved requirements: { CORE_SERVER_FOLDER: 'core',
  CORE_ARCHIVE: 'realm-core-5.4.0.tgz',
  CORE_ARCHIVE_ROOT: 'realm-core-5.4.0' }
Matching lockfile already exists at target - nothing to do (use --force to override)
Success
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/collection_notifications.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/index_set.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/list.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/placeholder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_store.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/results.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/shared_realm.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/thread_safe_reference.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_change_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/object_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/primitive_list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/realm_coordinator.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/results_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/transact_log_handler.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/weak_realm_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/uuid.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/epoll/external_commit_helper.o
  AR(target) Release/obj.target/object-store.a
  COPY Release/object-store.a
  CXX(target) Release/obj.target/realm/src/js_realm.o
  CXX(target) Release/obj.target/realm/src/node/node_init.o
In file included from ../src/node/node_init.hpp:29:0,
                 from ../src/node/node_init.cpp:19:
../src/node/node_class.hpp: In instantiation of ‘static void realm::node::ObjectWrap<ClassType>::construct(const v8::FunctionCallbackInfo<v8::Value>&) [with ClassType = realm::js::RealmClass<realm::node::Types>]’:
../src/node/node_class.hpp:162:68:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::create_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:50:81:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::get_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:135:55:   required from ‘static v8::Local<v8::Function> realm::node::ObjectWrap<ClassType>::create_constructor(v8::Isolate*) [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/js_realm.hpp:331:86:   required from ‘static typename T::Function realm::js::RealmClass<T>::create_constructor(realm::js::RealmClass<T>::ContextType) [with T = realm::node::Types; typename T::Function = v8::Local<v8::Function>; realm::js::RealmClass<T>::ContextType = v8::Isolate*]’
../src/node/node_init.cpp:27:72:   required from here
../src/node/node_class.hpp:232:5: warning: the address of ‘static void realm::js::RealmClass<T>::constructor(realm::js::RealmClass<T>::ContextType, realm::js::RealmClass<T>::ObjectType, size_t, const ValueType*) [with T = realm::node::Types; realm::js::RealmClass<T>::ContextType = v8::Isolate*; realm::js::RealmClass<T>::ObjectType = v8::Local<v8::Object>; size_t = long unsigned int; realm::js::RealmClass<T>::ValueType = v8::Local<v8::Value>]’ will always evaluate as ‘true’ [-Waddress]
     if (reinterpret_cast<void*>(s_class.constructor)) {
     ^
  CXX(target) Release/obj.target/realm/src/node/platform.o
  SOLINK_MODULE(target) Release/obj.target/realm.node
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a(sha256.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/realm.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/electron-forge/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
realm.target.mk:158: recipe for target 'Release/obj.target/realm.node' failed
make: Leaving directory '/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/build'
gyp ERR! System Linux 4.13.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/electron-forge/node_modules/.bin/node-gyp" "rebuild" "--target=1.8.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=realm" "--module_path=/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/compiled/electron-v1.8_linux_x64" "--host=https://static.realm.io" "--remote_path=/node-pre-gyp/2.3.3/"
gyp ERR! cwd /home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

Failed with exit code: 1
Error: gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/electron-forge/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/build'
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/vendor/realm-linux-x64
Resolved requirements: { CORE_SERVER_FOLDER: 'core',
  CORE_ARCHIVE: 'realm-core-5.4.0.tgz',
  CORE_ARCHIVE_ROOT: 'realm-core-5.4.0' }
Matching lockfile already exists at target - nothing to do (use --force to override)
Success
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/collection_notifications.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/index_set.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/list.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/placeholder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_store.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/results.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/shared_realm.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/thread_safe_reference.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_change_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/object_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/primitive_list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/realm_coordinator.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/results_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/transact_log_handler.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/weak_realm_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/uuid.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/epoll/external_commit_helper.o
  AR(target) Release/obj.target/object-store.a
  COPY Release/object-store.a
  CXX(target) Release/obj.target/realm/src/js_realm.o
  CXX(target) Release/obj.target/realm/src/node/node_init.o
In file included from ../src/node/node_init.hpp:29:0,
                 from ../src/node/node_init.cpp:19:
../src/node/node_class.hpp: In instantiation of ‘static void realm::node::ObjectWrap<ClassType>::construct(const v8::FunctionCallbackInfo<v8::Value>&) [with ClassType = realm::js::RealmClass<realm::node::Types>]’:
../src/node/node_class.hpp:162:68:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::create_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:50:81:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::get_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:135:55:   required from ‘static v8::Local<v8::Function> realm::node::ObjectWrap<ClassType>::create_constructor(v8::Isolate*) [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/js_realm.hpp:331:86:   required from ‘static typename T::Function realm::js::RealmClass<T>::create_constructor(realm::js::RealmClass<T>::ContextType) [with T = realm::node::Types; typename T::Function = v8::Local<v8::Function>; realm::js::RealmClass<T>::ContextType = v8::Isolate*]’
../src/node/node_init.cpp:27:72:   required from here
../src/node/node_class.hpp:232:5: warning: the address of ‘static void realm::js::RealmClass<T>::constructor(realm::js::RealmClass<T>::ContextType, realm::js::RealmClass<T>::ObjectType, size_t, const ValueType*) [with T = realm::node::Types; realm::js::RealmClass<T>::ContextType = v8::Isolate*; realm::js::RealmClass<T>::ObjectType = v8::Local<v8::Object>; size_t = long unsigned int; realm::js::RealmClass<T>::ValueType = v8::Local<v8::Value>]’ will always evaluate as ‘true’ [-Waddress]
     if (reinterpret_cast<void*>(s_class.constructor)) {
     ^
  CXX(target) Release/obj.target/realm/src/node/platform.o
  SOLINK_MODULE(target) Release/obj.target/realm.node
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a(sha256.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/realm.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/electron-forge/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
realm.target.mk:158: recipe for target 'Release/obj.target/realm.node' failed
make: Leaving directory '/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/build'
gyp ERR! System Linux 4.13.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/electron-forge/node_modules/.bin/node-gyp" "rebuild" "--target=1.8.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=realm" "--module_path=/home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm/compiled/electron-v1.8_linux_x64" "--host=https://static.realm.io" "--remote_path=/node-pre-gyp/2.3.3/"
gyp ERR! cwd /home/jackytsang/Desktop/realm-in-electron-master/node_modules/realm
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

Failed with exit code: 1
    at SafeSubscriber._error (/usr/lib/node_modules/electron-forge/node_modules/spawn-rx/lib/src/index.js:277:84)
    at SafeSubscriber.__tryOrUnsub (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:242:16)
    at SafeSubscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:201:26)
    at Subscriber._error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:132:26)
    at Subscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:106:18)
    at MapSubscriber.Subscriber._error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:132:26)
    at MapSubscriber.Subscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:106:18)
    at SafeSubscriber._next (/usr/lib/node_modules/electron-forge/node_modules/spawn-rx/lib/src/index.js:251:65)
    at SafeSubscriber.__tryOrSetError (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:251:16)
    at SafeSubscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:191:27)
    at Subscriber._next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:129:26)
    at Subscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:93:18)
    at DefaultIfEmptySubscriber._next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/operators/defaultIfEmpty.js:67:26)
    at DefaultIfEmptySubscriber.Subscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:93:18)
    at TakeLastSubscriber._complete (/usr/lib/node_modules/electron-forge/node_modules/rxjs/operators/takeLast.js:102:29)
    at TakeLastSubscriber.Subscriber.complete (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:118:18)

run DEBUG=electron-packager electron-forge package --platform=darwin --arch=x64:

DEBUG=electron-packager electron-forge package --platform=darwin --arch=x64
✔ Checking your system
⠋ Preparing to Package Application for arch: x64  electron-packager Electron Packager 11.2.0 +0ms
  electron-packager Node v8.11.1 +1ms
  electron-packager Host Operating system: linux (x64) +1ms
  electron-packager Packager Options: {"asar":false,"overwrite":true,"packageManager":"npm","afterCopy":[null],"afterExtract":[null],"afterPrune":[null],"dir":"/home/jackytsang/Desktop/realm-in-electron-master","arch":"x64","platform":"darwin","out":"/home/jackytsang/Desktop/realm-in-electron-master/out","electronVersion":"1.8.4","quiet":true} +0ms
  electron-packager Target Platforms: darwin +1ms
  electron-packager Target Architectures: x64 +2ms
  electron-packager Inferring application name from productName in /home/jackytsang/Desktop/realm-in-electron-master/package.json +0ms
  electron-packager Inferring appVersion from version in /home/jackytsang/Desktop/realm-in-electron-master/package.json +4ms
  electron-packager Application name: realm-in-electron +11ms
  electron-packager Target Electron version: 1.8.4 +0ms
  electron-packager Ignored path regular expressions: [ '/node_modules/electron($|/)',
  '/node_modules/electron-prebuilt(-compile)?($|/)',
  '/node_modules/electron-packager($|/)',
  '/\\.git($|/)',
  '/node_modules/\\.bin($|/)',
  '\\.o(bj)?$',
  '/tmp/electron-packager' ] +0ms
  electron-packager Downloading Electron with options {"platform":"darwin","arch":"x64","version":"1.8.4"} +0ms
⠙ Preparing to Package Application for arch: x64Downloading tmp-3567-0-electron-Downloading tmp-3567-1-SHASUMS256.txt-1.8.4
[============================================>] 100.0% of 3.43 kB (3.43 kB/s)
⠴ Preparing to Package Application for arch: x64  electron-packager Creating /tmp/electron-packager/darwin-x64-template +35s
  electron-packager Extracting /home/jackytsang/.cache/electron/electron-v1.8.4-darwin-x64.zip to /tmp/electron-packager/darwin-x64-template +1ms
⠴ Preparing to Package Application for arch: x64  electron-packager Initializing app in /tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64 from /tmp/electron-packager/darwin-x64-template template +0ms
⠦ Preparing to Package Application for arch: x64  electron-packager Ignored paths based on the out param: [ '/home/jackytsang/Desktop/realm-in-electron-master/out' ] +38s
✔ Preparing to Package Application for arch: x64
✔ Compiling Application
  electron-packager Pruning modules via: npm prune --production +0ms
✖ Preparing native dependencies: 0 / 1

An unhandled error has occurred inside Forge:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/electron-forge/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/build'
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/vendor/realm-linux-x64
Resolved requirements: { CORE_SERVER_FOLDER: 'core',
  CORE_ARCHIVE: 'realm-core-5.4.0.tgz',
  CORE_ARCHIVE_ROOT: 'realm-core-5.4.0' }
Matching lockfile already exists at target - nothing to do (use --force to override)
Success
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/collection_notifications.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/index_set.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/list.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/placeholder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_store.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/results.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/shared_realm.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/thread_safe_reference.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_change_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/object_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/primitive_list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/realm_coordinator.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/results_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/transact_log_handler.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/weak_realm_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/uuid.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/epoll/external_commit_helper.o
  AR(target) Release/obj.target/object-store.a
  COPY Release/object-store.a
  CXX(target) Release/obj.target/realm/src/js_realm.o
  CXX(target) Release/obj.target/realm/src/node/node_init.o
In file included from ../src/node/node_init.hpp:29:0,
                 from ../src/node/node_init.cpp:19:
../src/node/node_class.hpp: In instantiation of ‘static void realm::node::ObjectWrap<ClassType>::construct(const v8::FunctionCallbackInfo<v8::Value>&) [with ClassType = realm::js::RealmClass<realm::node::Types>]’:
../src/node/node_class.hpp:162:68:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::create_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:50:81:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::get_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:135:55:   required from ‘static v8::Local<v8::Function> realm::node::ObjectWrap<ClassType>::create_constructor(v8::Isolate*) [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/js_realm.hpp:331:86:   required from ‘static typename T::Function realm::js::RealmClass<T>::create_constructor(realm::js::RealmClass<T>::ContextType) [with T = realm::node::Types; typename T::Function = v8::Local<v8::Function>; realm::js::RealmClass<T>::ContextType = v8::Isolate*]’
../src/node/node_init.cpp:27:72:   required from here
../src/node/node_class.hpp:232:5: warning: the address of ‘static void realm::js::RealmClass<T>::constructor(realm::js::RealmClass<T>::ContextType, realm::js::RealmClass<T>::ObjectType, size_t, const ValueType*) [with T = realm::node::Types; realm::js::RealmClass<T>::ContextType = v8::Isolate*; realm::js::RealmClass<T>::ObjectType = v8::Local<v8::Object>; size_t = long unsigned int; realm::js::RealmClass<T>::ValueType = v8::Local<v8::Value>]’ will always evaluate as ‘true’ [-Waddress]
     if (reinterpret_cast<void*>(s_class.constructor)) {
     ^
  CXX(target) Release/obj.target/realm/src/node/platform.o
  SOLINK_MODULE(target) Release/obj.target/realm.node
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a(sha256.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
realm.target.mk:158: recipe for target 'Release/obj.target/realm.node' failed
make: Leaving directory '/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/build'
make: *** [Release/obj.target/realm.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/electron-forge/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.13.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/electron-forge/node_modules/.bin/node-gyp" "rebuild" "--target=1.8.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=realm" "--module_path=/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/compiled/electron-v1.8_linux_x64" "--host=https://static.realm.io" "--remote_path=/node-pre-gyp/2.3.3/"
gyp ERR! cwd /tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

Failed with exit code: 1
Error: gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/electron-forge/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/build'
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/vendor/realm-linux-x64
Resolved requirements: { CORE_SERVER_FOLDER: 'core',
  CORE_ARCHIVE: 'realm-core-5.4.0.tgz',
  CORE_ARCHIVE_ROOT: 'realm-core-5.4.0' }
Matching lockfile already exists at target - nothing to do (use --force to override)
Success
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/collection_notifications.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/index_set.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/list.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/placeholder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_store.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/results.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/shared_realm.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/thread_safe_reference.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_change_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/object_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/primitive_list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/realm_coordinator.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/results_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/transact_log_handler.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/weak_realm_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/uuid.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/epoll/external_commit_helper.o
  AR(target) Release/obj.target/object-store.a
  COPY Release/object-store.a
  CXX(target) Release/obj.target/realm/src/js_realm.o
  CXX(target) Release/obj.target/realm/src/node/node_init.o
In file included from ../src/node/node_init.hpp:29:0,
                 from ../src/node/node_init.cpp:19:
../src/node/node_class.hpp: In instantiation of ‘static void realm::node::ObjectWrap<ClassType>::construct(const v8::FunctionCallbackInfo<v8::Value>&) [with ClassType = realm::js::RealmClass<realm::node::Types>]’:
../src/node/node_class.hpp:162:68:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::create_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:50:81:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::get_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:135:55:   required from ‘static v8::Local<v8::Function> realm::node::ObjectWrap<ClassType>::create_constructor(v8::Isolate*) [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/js_realm.hpp:331:86:   required from ‘static typename T::Function realm::js::RealmClass<T>::create_constructor(realm::js::RealmClass<T>::ContextType) [with T = realm::node::Types; typename T::Function = v8::Local<v8::Function>; realm::js::RealmClass<T>::ContextType = v8::Isolate*]’
../src/node/node_init.cpp:27:72:   required from here
../src/node/node_class.hpp:232:5: warning: the address of ‘static void realm::js::RealmClass<T>::constructor(realm::js::RealmClass<T>::ContextType, realm::js::RealmClass<T>::ObjectType, size_t, const ValueType*) [with T = realm::node::Types; realm::js::RealmClass<T>::ContextType = v8::Isolate*; realm::js::RealmClass<T>::ObjectType = v8::Local<v8::Object>; size_t = long unsigned int; realm::js::RealmClass<T>::ValueType = v8::Local<v8::Value>]’ will always evaluate as ‘true’ [-Waddress]
     if (reinterpret_cast<void*>(s_class.constructor)) {
     ^
  CXX(target) Release/obj.target/realm/src/node/platform.o
  SOLINK_MODULE(target) Release/obj.target/realm.node
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a(sha256.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
realm.target.mk:158: recipe for target 'Release/obj.target/realm.node' failed
make: Leaving directory '/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/build'
make: *** [Release/obj.target/realm.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/electron-forge/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.13.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/electron-forge/node_modules/.bin/node-gyp" "rebuild" "--target=1.8.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=realm" "--module_path=/tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm/compiled/electron-v1.8_linux_x64" "--host=https://static.realm.io" "--remote_path=/node-pre-gyp/2.3.3/"
gyp ERR! cwd /tmp/electron-packager/darwin-x64/realm-in-electron-darwin-x64/Electron.app/Contents/Resources/app/node_modules/realm
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

Failed with exit code: 1
    at SafeSubscriber._error (/usr/lib/node_modules/electron-forge/node_modules/spawn-rx/lib/src/index.js:277:84)
    at SafeSubscriber.__tryOrUnsub (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:242:16)
    at SafeSubscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:201:26)
    at Subscriber._error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:132:26)
    at Subscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:106:18)
    at MapSubscriber.Subscriber._error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:132:26)
    at MapSubscriber.Subscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:106:18)
    at SafeSubscriber._next (/usr/lib/node_modules/electron-forge/node_modules/spawn-rx/lib/src/index.js:251:65)
    at SafeSubscriber.__tryOrSetError (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:251:16)
    at SafeSubscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:191:27)
    at Subscriber._next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:129:26)
    at Subscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:93:18)
    at DefaultIfEmptySubscriber._next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/operators/defaultIfEmpty.js:67:26)
    at DefaultIfEmptySubscriber.Subscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:93:18)
    at TakeLastSubscriber._complete (/usr/lib/node_modules/electron-forge/node_modules/rxjs/operators/takeLast.js:102:29)
    at TakeLastSubscriber.Subscriber.complete (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:118:18)

Are you sure you can package the project into .dmg?

@malept
Copy link
Member

malept commented Apr 9, 2018

In that case, it's not a matter of not being able to create DMGs (because it doesn't even get that far), but rather you can't cross-compile native node modules (i.e., you can't build a native node extension for Mac on Linux). Failing with a human-friendly error message before getting to this point is #380.

Try building for the Linux target on the Linux host, that should work.

@jacky-ttt
Copy link
Author

jacky-ttt commented Apr 9, 2018

I understand that is error when building native node module. I just try to start the project but it gets stuck at building that module. Does problem come from electron-forge or realm, the native module. Can you tell me what command you used to get a successful result?

Here is the command I used to initialize a new project and reproduce the error. Note that I did not pass in any argument so it should target linux automatically.

  1. DEBUG=electron-forge:* electron-forge init realm_electron --template=react
  2. cd realm_electron
  3. npm install --save realm
  4. DEBUG=electron-forge:* electron-forge start
jackytsang@jackytsang-VirtualBox:~$ cd Desktop/
jackytsang@jackytsang-VirtualBox:~/Desktop$ DEBUG=electron-forge:* electron-forge init realm_electron --template=react
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +577ms
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:init Initializing in: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:lifecycle Process Started: Initializing Project Directory +0ms
  electron-forge:init:directory creating directory: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:lifecycle Process Succeeded: Initializing Project Directory +16ms
  electron-forge:lifecycle Process Started: Initializing Git Repository +0ms
  electron-forge:init:git executing "git init" in directory: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:lifecycle Process Succeeded: Initializing Git Repository +44ms
  electron-forge:lifecycle Process Started: Copying Starter Files +7ms
  electron-forge:init:starter-files creating directory: /home/jackytsang/Desktop/realm_electron/src +0ms
  electron-forge:init:starter-files copying "/usr/lib/node_modules/electron-forge/tmpl/_gitignore" --> "/home/jackytsang/Desktop/realm_electron/.gitignore" +0ms
  electron-forge:init:starter-files copying "/usr/lib/node_modules/electron-forge/tmpl/_compilerc" --> "/home/jackytsang/Desktop/realm_electron/.compilerc" +12ms
  electron-forge:init:starter-files copying "/usr/lib/node_modules/electron-forge/tmpl/index.js" --> "/home/jackytsang/Desktop/realm_electron/src/index.js" +2ms
  electron-forge:init:starter-files copying "/usr/lib/node_modules/electron-forge/tmpl/index.html" --> "/home/jackytsang/Desktop/realm_electron/src/index.html" +2ms
  electron-forge:lifecycle Process Succeeded: Copying Starter Files +19ms
  electron-forge:lifecycle Process Started: Initializing NPM Module +0ms
  electron-forge:init:npm writing package.json to: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:lifecycle Process Succeeded: Initializing NPM Module +55ms
  electron-forge:lifecycle Process Started: Installing NPM Dependencies +6ms
  electron-forge:init:npm installing dependencies +44ms
  electron-forge:dependency-installer installing ["electron-compile","electron-squirrel-startup"] in: /home/jackytsang/Desktop/realm_electron dev=false,exact=false,withYarn=false +0ms
  electron-forge:dependency-installer executing ["install","electron-compile","electron-squirrel-startup","--save"] in: /home/jackytsang/Desktop/realm_electron +4ms
  electron-forge:runtime-config fetching key verbose +0ms
  electron-forge:init:npm installing devDependencies +7s
  electron-forge:dependency-installer installing ["babel-preset-env","babel-preset-react","babel-plugin-transform-async-to-generator","electron-forge"] in: /home/jackytsang/Desktop/realm_electron dev=true,exact=false,withYarn=false +7s
  electron-forge:dependency-installer executing ["install","babel-preset-env","babel-preset-react","babel-plugin-transform-async-to-generator","electron-forge","--save-dev"] in: /home/jackytsang/Desktop/realm_electron +1ms
  electron-forge:runtime-config fetching key verbose +7s
  electron-forge:init:npm installing exact dependencies +23s
  electron-forge:dependency-installer installing ["electron-prebuilt-compile"] in: /home/jackytsang/Desktop/realm_electron dev=true,exact=true,withYarn=false +23s
  electron-forge:dependency-installer executing ["install","electron-prebuilt-compile","--save-exact","--save-dev"] in: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:runtime-config fetching key verbose +23s
  electron-forge:init:npm not installing linting deps +19s
  electron-forge:lifecycle Process Succeeded: Installing NPM Dependencies +49s
  electron-forge:lifecycle Process Started: Locating custom template: "react" +1ms
  electron-forge:init:custom using local template +0ms
  electron-forge:lifecycle Process Succeeded: Locating custom template: "react" +3ms
  electron-forge:lifecycle Process Started: Installing Template Dependencies +2ms
  electron-forge:init:custom installing dependencies +4ms
  electron-forge:dependency-installer installing ["electron-devtools-installer@^2.1.0","react@^15.4.1","react-dom@^15.4.1","react-hot-loader@^3.0.0-beta.6"] in: /home/jackytsang/Desktop/realm_electron dev=false,exact=false,withYarn=false +19s
  electron-forge:dependency-installer executing ["install","electron-devtools-installer@^2.1.0","react@^15.4.1","react-dom@^15.4.1","react-hot-loader@^3.0.0-beta.6","--save"] in: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:runtime-config fetching key verbose +19s
  electron-forge:init:custom installing devDependencies +9s
  electron-forge:dependency-installer installing ["babel-plugin-transform-es2015-classes","eslint@^3","eslint-config-airbnb@^15","eslint-plugin-import@^2","eslint-plugin-jsx-a11y@^5","eslint-plugin-react@^7"] in: /home/jackytsang/Desktop/realm_electron dev=true,exact=false,withYarn=false +9s
  electron-forge:dependency-installer executing ["install","babel-plugin-transform-es2015-classes","eslint@^3","eslint-config-airbnb@^15","eslint-plugin-import@^2","eslint-plugin-jsx-a11y@^5","eslint-plugin-react@^7","--save-dev"] in: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:runtime-config fetching key verbose +9s
  electron-forge:lifecycle Process Succeeded: Installing Template Dependencies +20s
  electron-forge:lifecycle Process Started: Copying Template Files +1ms
  electron-forge:init:starter-files copying "/usr/lib/node_modules/electron-forge/node_modules/electron-forge-template-react/tmpl/_compilerc" --> "/home/jackytsang/Desktop/realm_electron/.compilerc" +1m
  electron-forge:init:starter-files copying "/usr/lib/node_modules/electron-forge/node_modules/electron-forge-template-react/tmpl/_eslintrc" --> "/home/jackytsang/Desktop/realm_electron/.eslintrc" +8ms
  electron-forge:init:starter-files copying "/usr/lib/node_modules/electron-forge/node_modules/electron-forge-template-react/tmpl/src/app.jsx" --> "/home/jackytsang/Desktop/realm_electron/src/app.jsx" +1ms
  electron-forge:init:starter-files copying "/usr/lib/node_modules/electron-forge/node_modules/electron-forge-template-react/tmpl/src/index.html" --> "/home/jackytsang/Desktop/realm_electron/src/index.html" +5ms
  electron-forge:init:starter-files copying "/usr/lib/node_modules/electron-forge/node_modules/electron-forge-template-react/tmpl/src/index.js" --> "/home/jackytsang/Desktop/realm_electron/src/index.js" +1ms
  electron-forge:lifecycle Process Succeeded: Copying Template Files +28ms
jackytsang@jackytsang-VirtualBox:~/Desktop$ cd realm_electron/
jackytsang@jackytsang-VirtualBox:~/Desktop/realm_electron$ DEBUG=electron-forge:* electron-forge start
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +331ms
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Locating Application +0ms
  electron-forge:project-resolver searching for project in: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /home/jackytsang/Desktop/realm_electron/package.json +4ms
  electron-forge:lifecycle Process Succeeded: Locating Application +6ms
  electron-forge:lifecycle Process Started: Preparing native dependencies +4ms
  electron-forge:lifecycle Process Succeeded: Preparing native dependencies +400ms
  electron-forge:hook could not find hook: generateAssets +0ms
  electron-forge:lifecycle Process Started: Launching Application +1ms
  electron-forge:lifecycle Process Succeeded: Launching Application +4ms
[2089:0410/005948.841779:ERROR:CONSOLE(7323)] "Extension server error: Object not found: <top>", source: chrome-devtools://devtools/bundled/inspector.js (7323)
[2089:0410/005949.835278:ERROR:CONSOLE(7323)] "Extension server error: Object not found: <top>", source: chrome-devtools://devtools/bundled/inspector.js (7323)
[2089:0410/005950.304560:ERROR:CONSOLE(7323)] "Extension server error: Operation failed: file:///home/jackytsang/Desktop/realm_electron/src/index.html has no execution context", source: chrome-devtools://devtools/bundled/inspector.js (7323)
jackytsang@jackytsang-VirtualBox:~/Desktop/realm_electron$ npm install --save realm

> [email protected] install /home/jackytsang/Desktop/realm_electron/node_modules/realm
> node-pre-gyp install --fallback-to-build

[realm] Success: "/home/jackytsang/Desktop/realm_electron/node_modules/realm/compiled/node-v57_linux_x64/realm.node" is installed via remote
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/macos-alias):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/appdmg):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ [email protected]
added 70 packages in 29.775s
jackytsang@jackytsang-VirtualBox:~/Desktop/realm_electron$ DEBUG=electron-forge:* electron-forge start
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +356ms
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Locating Application +0ms
  electron-forge:project-resolver searching for project in: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /home/jackytsang/Desktop/realm_electron/package.json +10ms
  electron-forge:lifecycle Process Succeeded: Locating Application +14ms
  electron-forge:lifecycle Process Started: Preparing native dependencies +17ms
  electron-forge:lifecycle Process Failed: Preparing native dependencies +2m

An unhandled error has occurred inside Forge:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/Desktop/realm_electron/node_modules/realm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/electron-forge/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/jackytsang/Desktop/realm_electron/node_modules/realm',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/jackytsang/Desktop/realm_electron/node_modules/realm/build'
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /home/jackytsang/Desktop/realm_electron/node_modules/realm/vendor/realm-linux-x64
Resolved requirements: { CORE_SERVER_FOLDER: 'core',
  CORE_ARCHIVE: 'realm-core-5.4.0.tgz',
  CORE_ARCHIVE_ROOT: 'realm-core-5.4.0' }
No lockfile found at the target, proceeding.
Download url: https://static.realm.io/downloads/core/realm-core-5.4.0.tgz
Downloading realm-core-5.4.0.tgz
Extracting realm-core-5.4.0.tgz => /home/jackytsang/Desktop/realm_electron/node_modules/realm/vendor/realm-linux-x64
Success
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/collection_notifications.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/index_set.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/list.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/placeholder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_store.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/results.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/shared_realm.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/thread_safe_reference.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_change_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/object_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/primitive_list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/realm_coordinator.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/results_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/transact_log_handler.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/weak_realm_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/uuid.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/epoll/external_commit_helper.o
  AR(target) Release/obj.target/object-store.a
  COPY Release/object-store.a
  CXX(target) Release/obj.target/realm/src/js_realm.o
  CXX(target) Release/obj.target/realm/src/node/node_init.o
In file included from ../src/node/node_init.hpp:29:0,
                 from ../src/node/node_init.cpp:19:
../src/node/node_class.hpp: In instantiation of ‘static void realm::node::ObjectWrap<ClassType>::construct(const v8::FunctionCallbackInfo<v8::Value>&) [with ClassType = realm::js::RealmClass<realm::node::Types>]’:
../src/node/node_class.hpp:162:68:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::create_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:50:81:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::get_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:135:55:   required from ‘static v8::Local<v8::Function> realm::node::ObjectWrap<ClassType>::create_constructor(v8::Isolate*) [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/js_realm.hpp:331:86:   required from ‘static typename T::Function realm::js::RealmClass<T>::create_constructor(realm::js::RealmClass<T>::ContextType) [with T = realm::node::Types; typename T::Function = v8::Local<v8::Function>; realm::js::RealmClass<T>::ContextType = v8::Isolate*]’
../src/node/node_init.cpp:27:72:   required from here
../src/node/node_class.hpp:232:5: warning: the address of ‘static void realm::js::RealmClass<T>::constructor(realm::js::RealmClass<T>::ContextType, realm::js::RealmClass<T>::ObjectType, size_t, const ValueType*) [with T = realm::node::Types; realm::js::RealmClass<T>::ContextType = v8::Isolate*; realm::js::RealmClass<T>::ObjectType = v8::Local<v8::Object>; size_t = long unsigned int; realm::js::RealmClass<T>::ValueType = v8::Local<v8::Value>]’ will always evaluate as ‘true’ [-Waddress]
     if (reinterpret_cast<void*>(s_class.constructor)) {
     ^
  CXX(target) Release/obj.target/realm/src/node/platform.o
  SOLINK_MODULE(target) Release/obj.target/realm.node
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a(sha256.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/realm.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/electron-forge/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.13.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/electron-forge/node_modules/.bin/node-gyp" "rebuild" "--target=1.8.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=realm" "--module_path=/home/jackytsang/Desktop/realm_electron/node_modules/realm/compiled/electron-v1.8_linux_x64" "--host=https://static.realm.io" "--remote_path=/node-pre-gyp/2.3.3/"
gyp ERR! cwd /home/jackytsang/Desktop/realm_electron/node_modules/realm
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
realm.target.mk:158: recipe for target 'Release/obj.target/realm.node' failed
make: Leaving directory '/home/jackytsang/Desktop/realm_electron/node_modules/realm/build'

Failed with exit code: 1
Error: gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/Desktop/realm_electron/node_modules/realm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/electron-forge/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/jackytsang/Desktop/realm_electron/node_modules/realm',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/jackytsang/Desktop/realm_electron/node_modules/realm/build'
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /home/jackytsang/Desktop/realm_electron/node_modules/realm/vendor/realm-linux-x64
Resolved requirements: { CORE_SERVER_FOLDER: 'core',
  CORE_ARCHIVE: 'realm-core-5.4.0.tgz',
  CORE_ARCHIVE_ROOT: 'realm-core-5.4.0' }
No lockfile found at the target, proceeding.
Download url: https://static.realm.io/downloads/core/realm-core-5.4.0.tgz
Downloading realm-core-5.4.0.tgz
Extracting realm-core-5.4.0.tgz => /home/jackytsang/Desktop/realm_electron/node_modules/realm/vendor/realm-linux-x64
Success
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/collection_notifications.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/index_set.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/list.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/placeholder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_store.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/results.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/shared_realm.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/thread_safe_reference.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_change_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/object_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/primitive_list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/realm_coordinator.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/results_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/transact_log_handler.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/weak_realm_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/uuid.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/epoll/external_commit_helper.o
  AR(target) Release/obj.target/object-store.a
  COPY Release/object-store.a
  CXX(target) Release/obj.target/realm/src/js_realm.o
  CXX(target) Release/obj.target/realm/src/node/node_init.o
In file included from ../src/node/node_init.hpp:29:0,
                 from ../src/node/node_init.cpp:19:
../src/node/node_class.hpp: In instantiation of ‘static void realm::node::ObjectWrap<ClassType>::construct(const v8::FunctionCallbackInfo<v8::Value>&) [with ClassType = realm::js::RealmClass<realm::node::Types>]’:
../src/node/node_class.hpp:162:68:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::create_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:50:81:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::get_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:135:55:   required from ‘static v8::Local<v8::Function> realm::node::ObjectWrap<ClassType>::create_constructor(v8::Isolate*) [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/js_realm.hpp:331:86:   required from ‘static typename T::Function realm::js::RealmClass<T>::create_constructor(realm::js::RealmClass<T>::ContextType) [with T = realm::node::Types; typename T::Function = v8::Local<v8::Function>; realm::js::RealmClass<T>::ContextType = v8::Isolate*]’
../src/node/node_init.cpp:27:72:   required from here
../src/node/node_class.hpp:232:5: warning: the address of ‘static void realm::js::RealmClass<T>::constructor(realm::js::RealmClass<T>::ContextType, realm::js::RealmClass<T>::ObjectType, size_t, const ValueType*) [with T = realm::node::Types; realm::js::RealmClass<T>::ContextType = v8::Isolate*; realm::js::RealmClass<T>::ObjectType = v8::Local<v8::Object>; size_t = long unsigned int; realm::js::RealmClass<T>::ValueType = v8::Local<v8::Value>]’ will always evaluate as ‘true’ [-Waddress]
     if (reinterpret_cast<void*>(s_class.constructor)) {
     ^
  CXX(target) Release/obj.target/realm/src/node/platform.o
  SOLINK_MODULE(target) Release/obj.target/realm.node
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a(sha256.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/realm.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/electron-forge/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.13.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/electron-forge/node_modules/.bin/node-gyp" "rebuild" "--target=1.8.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=realm" "--module_path=/home/jackytsang/Desktop/realm_electron/node_modules/realm/compiled/electron-v1.8_linux_x64" "--host=https://static.realm.io" "--remote_path=/node-pre-gyp/2.3.3/"
gyp ERR! cwd /home/jackytsang/Desktop/realm_electron/node_modules/realm
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
realm.target.mk:158: recipe for target 'Release/obj.target/realm.node' failed
make: Leaving directory '/home/jackytsang/Desktop/realm_electron/node_modules/realm/build'

Failed with exit code: 1
    at SafeSubscriber._error (/usr/lib/node_modules/electron-forge/node_modules/spawn-rx/lib/src/index.js:277:84)
    at SafeSubscriber.__tryOrUnsub (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:242:16)
    at SafeSubscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:201:26)
    at Subscriber._error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:132:26)
    at Subscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:106:18)
    at MapSubscriber.Subscriber._error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:132:26)
    at MapSubscriber.Subscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:106:18)
    at SafeSubscriber._next (/usr/lib/node_modules/electron-forge/node_modules/spawn-rx/lib/src/index.js:251:65)
    at SafeSubscriber.__tryOrUnsub (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:242:16)
    at SafeSubscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:189:22)
    at Subscriber._next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:129:26)
    at Subscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:93:18)
    at DefaultIfEmptySubscriber._next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/operators/defaultIfEmpty.js:67:26)
    at DefaultIfEmptySubscriber.Subscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:93:18)
    at TakeLastSubscriber._complete (/usr/lib/node_modules/electron-forge/node_modules/rxjs/operators/takeLast.js:102:29)
    at TakeLastSubscriber.Subscriber.complete (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:118:18)

The same error occurs when running DEBUG=electron-forge:* electron-forge package --platform=linux --arch=x64, which targets linux x64.

DEBUG=electron-forge:* electron-forge package --platform=linux --arch=x64
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +381ms
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Preparing to Package Application for arch: x64 +0ms
  electron-forge:project-resolver searching for project in: /home/jackytsang/Desktop/realm_electron +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /home/jackytsang/Desktop/realm_electron/package.json +73ms
  electron-forge:hook could not find hook: generateAssets +0ms
  electron-forge:hook could not find hook: prePackage +11ms
  electron-forge:packager packaging with options { asar: false,
  overwrite: true,
  packageManager: 'npm',
  afterCopy: [ [Function] ],
  afterExtract: [ [Function] ],
  afterPrune: [ [Function] ],
  dir: '/home/jackytsang/Desktop/realm_electron',
  arch: 'x64',
  platform: 'linux',
  out: '/home/jackytsang/Desktop/realm_electron/out',
  electronVersion: '1.8.4',
  quiet: true } +0ms
  electron-forge:lifecycle Process Succeeded: Preparing to Package Application for arch: x64 +25s
  electron-forge:lifecycle Process Started: Compiling Application +1ms
  electron-forge:lifecycle Process Succeeded: Compiling Application +1s
  electron-forge:lifecycle Process Started: Preparing native dependencies +11s
  electron-forge:lifecycle Process Failed: Preparing native dependencies +2m

An unhandled error has occurred inside Forge:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/electron-forge/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/build'
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/vendor/realm-linux-x64
Resolved requirements: { CORE_SERVER_FOLDER: 'core',
  CORE_ARCHIVE: 'realm-core-5.4.0.tgz',
  CORE_ARCHIVE_ROOT: 'realm-core-5.4.0' }
Matching lockfile already exists at target - nothing to do (use --force to override)
Success
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/collection_notifications.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/index_set.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/list.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/placeholder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_store.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/results.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/shared_realm.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/thread_safe_reference.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_change_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/object_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/primitive_list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/realm_coordinator.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/results_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/transact_log_handler.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/weak_realm_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/uuid.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/epoll/external_commit_helper.o
  AR(target) Release/obj.target/object-store.a
  COPY Release/object-store.a
  CXX(target) Release/obj.target/realm/src/js_realm.o
  CXX(target) Release/obj.target/realm/src/node/node_init.o
In file included from ../src/node/node_init.hpp:29:0,
                 from ../src/node/node_init.cpp:19:
../src/node/node_class.hpp: In instantiation of ‘static void realm::node::ObjectWrap<ClassType>::construct(const v8::FunctionCallbackInfo<v8::Value>&) [with ClassType = realm::js::RealmClass<realm::node::Types>]’:
../src/node/node_class.hpp:162:68:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::create_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:50:81:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::get_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:135:55:   required from ‘static v8::Local<v8::Function> realm::node::ObjectWrap<ClassType>::create_constructor(v8::Isolate*) [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/js_realm.hpp:331:86:   required from ‘static typename T::Function realm::js::RealmClass<T>::create_constructor(realm::js::RealmClass<T>::ContextType) [with T = realm::node::Types; typename T::Function = v8::Local<v8::Function>; realm::js::RealmClass<T>::ContextType = v8::Isolate*]’
../src/node/node_init.cpp:27:72:   required from here
../src/node/node_class.hpp:232:5: warning: the address of ‘static void realm::js::RealmClass<T>::constructor(realm::js::RealmClass<T>::ContextType, realm::js::RealmClass<T>::ObjectType, size_t, const ValueType*) [with T = realm::node::Types; realm::js::RealmClass<T>::ContextType = v8::Isolate*; realm::js::RealmClass<T>::ObjectType = v8::Local<v8::Object>; size_t = long unsigned int; realm::js::RealmClass<T>::ValueType = v8::Local<v8::Value>]’ will always evaluate as ‘true’ [-Waddress]
     if (reinterpret_cast<void*>(s_class.constructor)) {
     ^
  CXX(target) Release/obj.target/realm/src/node/platform.o
  SOLINK_MODULE(target) Release/obj.target/realm.node
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a(sha256.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/realm.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/electron-forge/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.13.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/electron-forge/node_modules/.bin/node-gyp" "rebuild" "--target=1.8.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=realm" "--module_path=/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/compiled/electron-v1.8_linux_x64" "--host=https://static.realm.io" "--remote_path=/node-pre-gyp/2.3.3/"
gyp ERR! cwd /tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
realm.target.mk:158: recipe for target 'Release/obj.target/realm.node' failed
make: Leaving directory '/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/build'

Failed with exit code: 1
Error: gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/electron-forge/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/electron-forge/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/jackytsang/.electron-gyp/.node-gyp/iojs-1.8.4/<(target_arch)/iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/build'
  TOUCH Release/obj.target/OpenSSL.stamp
  ACTION binding_gyp_vendored_realm_target_download_realm /tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/vendor/realm-linux-x64
Resolved requirements: { CORE_SERVER_FOLDER: 'core',
  CORE_ARCHIVE: 'realm-core-5.4.0.tgz',
  CORE_ARCHIVE_ROOT: 'realm-core-5.4.0' }
Matching lockfile already exists at target - nothing to do (use --force to override)
Success
  TOUCH Release/obj.target/vendored-realm.stamp
  TOUCH Release/obj.target/realm-core.stamp
  CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/collection_notifications.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/index_set.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/list.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/placeholder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/object_store.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/results.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/schema.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/shared_realm.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/thread_safe_reference.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_change_builder.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/collection_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/object_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/primitive_list_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/realm_coordinator.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/results_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/transact_log_handler.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/weak_realm_notifier.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/util/uuid.o
  CXX(target) Release/obj.target/object-store/src/object-store/src/impl/epoll/external_commit_helper.o
  AR(target) Release/obj.target/object-store.a
  COPY Release/object-store.a
  CXX(target) Release/obj.target/realm/src/js_realm.o
  CXX(target) Release/obj.target/realm/src/node/node_init.o
In file included from ../src/node/node_init.hpp:29:0,
                 from ../src/node/node_init.cpp:19:
../src/node/node_class.hpp: In instantiation of ‘static void realm::node::ObjectWrap<ClassType>::construct(const v8::FunctionCallbackInfo<v8::Value>&) [with ClassType = realm::js::RealmClass<realm::node::Types>]’:
../src/node/node_class.hpp:162:68:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::create_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:50:81:   required from ‘static v8::Local<v8::FunctionTemplate> realm::node::ObjectWrap<ClassType>::get_template() [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/node/node_class.hpp:135:55:   required from ‘static v8::Local<v8::Function> realm::node::ObjectWrap<ClassType>::create_constructor(v8::Isolate*) [with ClassType = realm::js::RealmClass<realm::node::Types>]’
../src/js_realm.hpp:331:86:   required from ‘static typename T::Function realm::js::RealmClass<T>::create_constructor(realm::js::RealmClass<T>::ContextType) [with T = realm::node::Types; typename T::Function = v8::Local<v8::Function>; realm::js::RealmClass<T>::ContextType = v8::Isolate*]’
../src/node/node_init.cpp:27:72:   required from here
../src/node/node_class.hpp:232:5: warning: the address of ‘static void realm::js::RealmClass<T>::constructor(realm::js::RealmClass<T>::ContextType, realm::js::RealmClass<T>::ObjectType, size_t, const ValueType*) [with T = realm::node::Types; realm::js::RealmClass<T>::ContextType = v8::Isolate*; realm::js::RealmClass<T>::ObjectType = v8::Local<v8::Object>; size_t = long unsigned int; realm::js::RealmClass<T>::ValueType = v8::Local<v8::Value>]’ will always evaluate as ‘true’ [-Waddress]
     if (reinterpret_cast<void*>(s_class.constructor)) {
     ^
  CXX(target) Release/obj.target/realm/src/node/platform.o
  SOLINK_MODULE(target) Release/obj.target/realm.node
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a(sha256.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libcrypto.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/realm.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/electron-forge/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.13.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/electron-forge/node_modules/.bin/node-gyp" "rebuild" "--target=1.8.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=realm" "--module_path=/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/compiled/electron-v1.8_linux_x64" "--host=https://static.realm.io" "--remote_path=/node-pre-gyp/2.3.3/"
gyp ERR! cwd /tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
realm.target.mk:158: recipe for target 'Release/obj.target/realm.node' failed
make: Leaving directory '/tmp/electron-packager/linux-x64/realm_electron-linux-x64/resources/app/node_modules/realm/build'

Failed with exit code: 1
    at SafeSubscriber._error (/usr/lib/node_modules/electron-forge/node_modules/spawn-rx/lib/src/index.js:277:84)
    at SafeSubscriber.__tryOrUnsub (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:242:16)
    at SafeSubscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:201:26)
    at Subscriber._error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:132:26)
    at Subscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:106:18)
    at MapSubscriber.Subscriber._error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:132:26)
    at MapSubscriber.Subscriber.error (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:106:18)
    at SafeSubscriber._next (/usr/lib/node_modules/electron-forge/node_modules/spawn-rx/lib/src/index.js:251:65)
    at SafeSubscriber.__tryOrSetError (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:251:16)
    at SafeSubscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:191:27)
    at Subscriber._next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:129:26)
    at Subscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:93:18)
    at DefaultIfEmptySubscriber._next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/operators/defaultIfEmpty.js:67:26)
    at DefaultIfEmptySubscriber.Subscriber.next (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:93:18)
    at TakeLastSubscriber._complete (/usr/lib/node_modules/electron-forge/node_modules/rxjs/operators/takeLast.js:102:29)
    at TakeLastSubscriber.Subscriber.complete (/usr/lib/node_modules/electron-forge/node_modules/rxjs/Subscriber.js:118:18)

@malept
Copy link
Member

malept commented Apr 9, 2018

I don't know why there's a linker error. I would do some searches for that error and see what you come up with.

@mkndn
Copy link

mkndn commented Apr 13, 2018

I'm facing the same issue. I'm using electron-forge with angular 6 (@angular-cli) and windows (win32, x64)
my compilerc looks like,

{ "env": { "development": { "application/javascript": { "presets": [ ["env", { "targets": { "electron": "1.8.4" } }], "react", "es2016-node5", "es2017-node7" ], "plugins": ["transform-async-to-generator"], "sourceMaps": "inline" } }, "production": { "application/javascript": { "presets": [ ["env", { "targets": { "electron": "1.8.4" } }], "react", "es2016-node5", "es2017-node7" ], "plugins": ["transform-async-to-generator", "transform-es2015-classes"], "sourceMaps": "none" } } } }

and using the commands
set DEBUG=electron-packager
npm run package

i got the following output

[email protected] package C:\projects\script-generator
electron-forge package --platform=win32 --arch=x64

√ Checking your system
- Preparing to Package Application for arch: x64  electron-packager Electron Packager 11.2.0 +0ms
  electron-packager Node v8.9.0 +15ms
  electron-packager Host Operating system: win32 (x64) +0ms
  electron-packager Packager Options: {"asar":true,"overwrite":true,"packageManager":"npm","icon":"src/assets/icons/win/icon.ico","prune":true,"companyName":"LE","fileDescription":"LE","productName":"ConversionScriptsGenerator","dir":"C:\\projects\\script-generator","ignore":[".gitignore",".idea","tsconfig.json","tslint.json","README.md","dev.env","dist"],"afterCopy":[null],"afterExtract":[null],"afterPrune":[null],"arch":"x64","platform":"win32","out":"C:\\projects\\script-generator\\out","electronVersion":"1.8.4","quiet":true} +16ms
  electron-packager Target Platforms: win32 +85ms
  electron-packager Target Architectures: x64 +16ms
\ Preparing to Package Application for arch: x64  electron-packager Inferring application name from productName in C:\projects\script-generator\package.json +0ms
  electron-packager Inferring appVersion from version in C:\projects\script-generator\package.json +16ms
  electron-packager Inferring win32metadata.CompanyName from author in C:\projects\script-generator\package.json +16ms
  electron-packager Application name: script-generator +100ms
  electron-packager Target Electron version: 1.8.4 +37ms
  electron-packager Ignored path regular expressions: [ '.gitignore',
  '.idea',
  'tsconfig.json',
  'tslint.json',
  'README.md',
  'dist',
  '/node_modules/electron($|/)',
  '/node_modules/electron-prebuilt(-compile)?($|/)',
  '/node_modules/electron-packager($|/)',
  '/\\.git($|/)',
  '/node_modules/\\.bin($|/)',
  '\\.o(bj)?$' ] +0ms
| Preparing to Package Application for arch: x64  electron-packager Downloading Electron with options {"platform":"win32","arch":"x64","version":"1.8.4"} +0ms
- Preparing to Package Application for arch: x64  electron-packager Creating C:\...\AppData\Local\Temp\electron-packager\win32-x64-template +16s
  electron-packager Extracting C:\...\.electron\electron-v1.8.4-win32-x64.zip to C:\...\AppData\Local\Temp\electron-packager\win32-x64-template +32ms
| Preparing to Package Application for arch: x64  electron-packager Initializing app in C:\...\AppData\Local\Temp\electron-packager\win32-x64\script-generator-win32-x64 from C:\...\AppData\Local\Temp\electron-packager\win32-x64-template template +0ms
/ Preparing to Package Application for arch: x64  electron-packager Ignored paths based on the out param: [ 'C:\\projects\\script-generator\\out' ] +20s
\ Preparing to Package Application for arch: x64

and it stays there forever.
I even tried

set DEBUG=*

with no luck

and this is my forge config,

"config": { "forge": { "make_targets": { "win32": [ "squirrel" ], "darwin": [ "zip" ], "linux": [ "deb", "rpm" ] }, "electronPackagerConfig": { "packageManager": "npm", "asar": true, "overwrite": true, "icon": "src/assets/icons/win/icon.ico", "prune": true, "companyName": "LE", "fileDescription": "LE", "productName": "ConversionScriptsGenerator", "dir": "src", "ignore": [ ".gitignore", ".idea", "tsconfig.json", "tslint.json", "README.md", "dev.env", "dist" ] }, "electronWinstallerConfig": { "name": "<%= productName %>", "outputDirectory": "release" }, "electronInstallerDebian": {}, "electronInstallerRedhat": {}, "github_repository": { "owner": "", "name": "" }, "windowsStoreConfig": { "packageName": "", "name": "scriptgenerator" } } }

@malept malept changed the title got stuck at "Preparing to Package Application for arch: x64" The realm native module cannot be rebuilt Apr 13, 2018
@malept
Copy link
Member

malept commented Apr 13, 2018

@Mani0608 this is a different issue, please move the discussion to #434 and answer the questions I posed there.

@MarshallOfSound
Copy link
Member

This doesn't appear to be 100% related to forge, we're just triggering a normal node-gyp build of that native module through electron-rebuild. If it's not working I'd suggest asking the realm folks why it's not building 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants