Skip to content

lazy symbol binding failed: Symbol not found #113

@7934345

Description

@7934345

Hi, I'm a starter of electron and nodejs, also ffi

ox : Darwin mac-dev.local 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64
node: v10.15.2 x64
npm: 6.4.1

package.json
{ "name": "helloworld", "version": "1.0.0", "description": "Hello Electron", "main": "main.js", "scripts": { "npm-install": "npm i", "package": "electron-packager . HelloElectron --all", "start": "electron .", "bs": "npm build && npm start", "postinstall": "electron-builder --mac --x64 install-app-deps" }, "author": "Jack Martin", "license": "ISC", "repository": { "private": true }, "devDependencies": { "asar": "^1.0.0", "electron": "4.0.3", "electron-builder": "^20.39.0", "electron-packager": "^13.1.1", "ffi": "^2.3.0" }, "dependencies": { "ref": "^1.3.5" } }

main.js
just create a basic window and load index.html

index.html

<body>
    <div>
        <button type="button" onclick="hello()">Call Hello</button>
    </div>
    <span id="hello"></span>
    
    <script>
        window.onload = function () {
            try {
                var ref = require('ref');
                // let ffi = require('ffi');
                // console.log('fii.Library result:', ffi);
                // window.lib = ffi.Library('test.dylib', {
                //     hello: ['int', ['pointer']]
                // });
                // console.log('fii.Library result:', window.lib);
            } catch (error) {
                console.error('ffi.Library', error);
            }
        };
        function hello() {
            // let callback = require('ffi').Callback('void', ['int', 'string'], function (size, reply) {
            //     document.getElementById('hello').innerHTML = reply;
            // });
            // window.lib.hello(callback);
        }
    </script>

</body>

npm i works well
npm start with the error below

dyld: lazy symbol binding failed: Symbol not found: __ZN2v811HandleScope12CreateHandleEPNS_8internal10HeapObjectEPNS1_6ObjectE
  Referenced from: /Users/jack/Desktop/test/electron/HelloWorld/node_modules/ref/build/Release/binding.node
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v811HandleScope12CreateHandleEPNS_8internal10HeapObjectEPNS1_6ObjectE
  Referenced from: /Users/jack/Desktop/test/electron/HelloWorld/node_modules/ref/build/Release/binding.node
  Expected in: flat namespace

I find nothing help when searching the google.

Its nothing to do with the ffi but the ref its self.

Could anyone help me of out this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions