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

[Windows] Visual C++ Redistributable is required at runtime #167

Closed
thomvaill opened this issue May 10, 2019 · 4 comments
Closed

[Windows] Visual C++ Redistributable is required at runtime #167

thomvaill opened this issue May 10, 2019 · 4 comments
Assignees
Labels
documentation Documentation updates, including examples code

Comments

@thomvaill
Copy link

thomvaill commented May 10, 2019

IoHook cannot run on a Windows platform that does not have Visual C++ Redistributable installed (which is the case of a lot of people. Example: it is not installed on a fresh Windows 10 install).
I don't know if it has always been the case or if it's a new compilation bug.

After some search, those issues may be related:

Expected Behavior

I am not a Windows developer, but I think uiohook.dll should be linked with static runtime libs, so the end user does not have to install Visual C++ Redistributable

Current Behavior

It looks like uiohook.dll is linked with the dynamic C Runtime library.

Dependency Walker output of uiohook.dll:
dependency-walker

Possible Solution

Here again, I am not a Windows developer, but this may be a hint: https://stackoverflow.com/questions/1073509/should-i-redistribute-msvcrt-dll-with-my-application
https://braintrekking.wordpress.com/2013/04/27/dll-hell-how-to-include-microsoft-redistributable-runtime-libraries-in-your-cmakecpack-project/
I wish I could fix it, but I don't know where this /MT option should be set.

Steps to Reproduce

On a fresh Windows 10 install:

  1. git clone https://github.com/wilix-team/iohook.git && cd iohook/
  2. npm install
  3. node examples/example.js
Loading native binary: D:\git\iohook\builds\node-v64-win32-x64\build\Release\iohook.node
internal/modules/cjs/loader.js:730
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: Le module spécifié est introuvable.
\\?\D:\git\iohook\builds\node-v64-win32-x64\build\Release\iohook.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (D:\git\iohook\index.js:10:21)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)

Then, go to https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads and install vc_redist.x64.exe.
Now it works!

NB1: if Visual C++ Redistributable is already installed on your Windows instance, you can reproduce the bug by uninstalling it:
visual-cpp-redist

NB2: I showed you how to reproduce the bug with a pre-built version of iohook. I tested to build it myself --> the bug is still there!

Context

I am developing a "click to screenshot" app with Electron. I want to distribute it on Linux, MacOS and Windows.

Possible workaround 1:
I ask my users to go to https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads and install vc_redist.x64.exe before installing my app.
--> I can't ask this to my users!

Possible workaround 2:
I achieve to distribute the missing DLLs into my Electron bundle.
I wish I could do that but I did not find a way to do it :(

Possible workaround 3:
I find a Windows installer that is able to install my app and install Visual C++ Redistributable in the background.
--> I have find one compatible with Electron :(

Your Environment

  • Version used: 0.4.5
  • Environment: Node v10.15.3
  • Operating System and version: Windows 10 Pro x64 v1809
@besserwisser
Copy link

besserwisser commented Feb 27, 2020

Thank you so much. I spend the last 3 hours looking for a solution and installing VC_redist.x64.exe totally worked for me. Honestly it SHOULD be mentioned in the readme...

@joravkumar
Copy link

@thomvaill Thanks for the this solution. It's working fine on win 10 but makes error on win 7. Can u provide me a solution for win 7 ?
Thanks in advance!!

@ash0x0
Copy link
Collaborator

ash0x0 commented Jun 11, 2021

Will add to docs. Thanks for the solution.

@ash0x0 ash0x0 added documentation Documentation updates, including examples code and removed electron Electron-related issues, bugs or questions windows Windows related issues, includes WSL and MSYS labels Jun 11, 2021
@ash0x0 ash0x0 self-assigned this Jun 12, 2021
@ash0x0
Copy link
Collaborator

ash0x0 commented Jun 12, 2021

Added to doc.

@ash0x0 ash0x0 closed this as completed Jun 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation updates, including examples code
Projects
None yet
Development

No branches or pull requests

5 participants