Error loading DLL for authenticator in safe browser

I have compiled the dev branch of safe_browser and am receiving the following Dynamic Linking Error upon running npm start:

Win32 error 126, according to Microsoft System Error Codes, means:

ERROR_MOD_NOT_FOUND
126 (0x7E)
The specified module could not be found.

Following the stack trace in the logged error, I found that the error begins in api.ffi.ffiLoader.loadLibrary() in C:\Users\...\safe_browser\app\node_modules\beaker-plugin-safe-authenticator\index.js

In C:\Users\...\safe_browser\app\node_modules\beaker-plugin-safe-authenticator\dist\api.js I’ve logged pieces of information to ensure that the correct .dll is being loaded.

OS PLATFORM: win32

LIBRARY PATHS:
{ win32: ‘./safe_authenticator.dll’,
darwin: ‘./libsafe_authenticator.dylib’,
linux: ‘./libsafe_authenticator.so’ }

libPath variable used to load library: ./safe_authenticator.dll

CURRENT WORKING DIRECTORY: C:\Users.…\safe_browser\app\node_modules\beaker-plugin-safe-authenticator\dist

safe_authenticator.dll exists in the expected directory:

When compiling safe-authenticator by way of compiling safe_browser (multiple times), no errors occurred.

Are there other ways that this file can be corrupted so that it’s not recognizable by the FFI loader as a proper module?

I need a hint about where to find my next clue.

2 Likes

Maybe I found a clue in C:\Users\...\safe_browser\authenticator\webpack.config.api.js:

if (os.platform() === ‘win32’) {
dependenciesToCopy.push({ context: ‘src/ffi’, from: ‘libwinpthread-1.dll’, flatten: true });
}

Should libwinpthread-1.dll also be in the same directory as the other .dll’s? Perhaps it’s a dependency that’s required for the other modules to be recognized?

I need to find out why it’s not making it to it’s destination.

UPDATE:

Thank goodness for find in powershell.

Found this way up in the output:
ERROR in [copy-webpack-plugin] unable to locate 'libwinpthread-1.dll' at 'C:\Users\...\safe_browser\authenticator\src\ffi\libwinpthread-1.dll'

I placed libwinpthread-1.dll where it needs to be and everything is working as it should now.
:seedling: :herb::four_leaf_clover::deciduous_tree::evergreen_tree:

Still interested to learn where it’s supposed to be sourced from during the build process.

2 Likes

Nice one @hunterlester. There is one step which is missing in the README for windows. Can you also manually copy and paste the libwinpthread-1.dll into the app\node_modules\beaker-plugin-safe-authenticator\dist from the bin folder of mingw installation? I hope that should resolve this issue.

Please let us know if this doesn’t fix.

Thanks

1 Like

It varies based on the installation. One option to automate will be to use a MINGW_HOME env variable from where the libwinpthread-1.dll can be copied. This is not integarted, but I can think of this as an option to automate and emphasize on setting this env variable for building the browser on windows.

1 Like

I originally copied libwinpthread-1.dll from safe_browser\app\node_modules\beaker-plugin-safe-app\dist to resolve the dependency.

Copying from my local mingw installation works perfectly as well. :+1:

Would this look like downloading once via,
src

"ENV": {
      "win32": {
        "libwinpthread-1": {
          "mirror": "https://github.com/gnunicorn/safe_core/releases/download/v",
          "version": "0.1.0-pre3",
          "targetDir": "src/native",
          "filePattern": "^libwinpthread-1.dll$"
        }
      }
    }

and then setting the MING_W env variable equal to the target directory?

1 Like