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

Can't start: MSVCP140.dll missing #416

Open
BenjaminRi opened this issue Jul 16, 2023 · 18 comments
Open

Can't start: MSVCP140.dll missing #416

BenjaminRi opened this issue Jul 16, 2023 · 18 comments
Labels
windows Related specifically to Windows

Comments

@BenjaminRi
Copy link

When I install Notepad Next v0.6.3 on a clean Windows 10 machine, I get the error:

Screenshot_20230716_221750

I guess it requires Microsoft Visual C++ Redistributable Packages for Visual Studio 2015? Ideally, the installer would either fetch the redistributable or throw an error to notify the user that this is a requirement (also, that seems like a pretty outdated dependency). Ideally, such shenanigans wouldn't even be needed (e.g. if you eliminate such dependencies and ship whatever is required with the installer).

@ZachBacon
Copy link

It's already being looked into. I already raised an issue on this.

@dail8859
Copy link
Owner

Ideally, such shenanigans wouldn't even be needed

I look forward to your pull request fixing such "shenanigans" without the need to bloat the installer.

@BenjaminRi
Copy link
Author

BenjaminRi commented Jul 16, 2023

I look forward to your pull request fixing such "shenanigans" without the need to bloat the installer.

I ship a similar piece of software in ~20MB. It uses GTK3 and the GNU toolchain and contains everything in the installer. I admit that I don't know Qt well but perhaps a similar thing is possible with NotepadNext? The dependency on the redistributable just seems like a blemish, for example it defeats the purpose of the per-user install that doesn't require admin rights because you need admin rights to install the redistributable. Anyway, I did not mean to diminish your work. A truly cross-platform Notepad++ is a thing the world needs.

@BenjaminRi
Copy link
Author

Hmm... How does Notepad++ avoid the dependency on the Visual C++ Redistributable with its tiny 4.2MB installer? Perhaps like this? They do seem to link statically.

@dail8859
Copy link
Owner

I admit that I don't know Qt well but perhaps a similar thing is possible with NotepadNext

I'm definitely not a Qt expert either. There may be other stuff the NSIS installer can do. I took a crack at this a bit ago to get it to download the installer and run it in the fly. I had mixed results and got too busy to put any more time into it.

I did not mean to diminish your work. A truly cross-platform Notepad++ is a thing the world needs.

Understood. This entire project is a huge learning experience for me...so I'm grateful for any help people are willing to contribute.

How does Notepad++ avoid the dependency on the Visual C++ Redistributable

I've wondered the same thing myself since I don't recall these kinds of issues being reported with Notepad++.

They do seem to link statically.

CMake isn't their official build system so that may not be the same when it is built with visual studio.

@BenjaminRi
Copy link
Author

CMake isn't their official build system so that may not be the same when it is built with visual studio.

Seems to be the same in the Visual Studio solution. Perhaps the elimination of the redistributable dependency is just a few options/clicks away.

@dail8859
Copy link
Owner

Perhaps the elimination of the redistributable dependency is just a few options/clicks away.

Interesting...this may address the root issue then. The changes should be simple enough but haven't had time to even boot up my dev machine for a few weeks...so hopefully I can get around to this eventually or someone can submit a PR. I think it should be something like this in the qmake file:

msvc:QMAKE_CXXFLAGS_RELEASE += /MT
msvc:QMAKE_CXXFLAGS_DEBUG += /MTd

@dail8859
Copy link
Owner

dail8859 commented Sep 6, 2023

You can try a zip build of the application statically linked here:

https://github.com/dail8859/NotepadNext/suites/15858669490/artifacts/904907341

If someone could test this and verify it works, that would be great since I don't have access to a clean install of Windows anywhere.

@dail8859
Copy link
Owner

Can anyone verify this fix?

I have no way to test this myself.

@BenjaminRi
Copy link
Author

I can take a look within the next few days 👍

@dail8859
Copy link
Owner

I can take a look within the next few days 👍

Greatly appreciated!

@BenjaminRi
Copy link
Author

BenjaminRi commented Sep 24, 2023

I tried to access the link

https://github.com/dail8859/NotepadNext/suites/15858669490/artifacts/904907341

but I get a 404 error. Hence, I was unable to test it.

By the way: Anyone can test this with a clean Windows virtual machine.

@dail8859
Copy link
Owner

@BenjaminRi
Copy link
Author

Try this link: https://github.com/dail8859/NotepadNext/suites/15858669490/artifacts/916495554

Still the same thing, it doesn't find the libraries.

@dail8859
Copy link
Owner

Still the same thing, it doesn't find the libraries.

Thanks for trying it. Looking at the GitHub action and also my machine I can confirm that the PR doesn't change the /MD flag.

I tweaked it on my development machine and I'm getting the compiler to use the /MT flag as expected now. However, my concern now is this linker warning:

LIBCMT.lib(initializers.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

My assumption is this is because the Qt DLLs are linked to the dynamic runtime, even if the exe itself is using the static runtime. Short of custom compiling the Qt DLLs to use the static runtime, I'm not sure if there is a way to solve this to not rely on the Visual C++ Redistributable.

Maybe I'm misunderstanding the exact nature of the error as this is all an educated guess. Even if this does run I'd be quite concerned to publish the app built this way.

If interested, another build to test:

https://github.com/dail8859/NotepadNext/suites/16556741509/artifacts/945757281

@BenjaminRi
Copy link
Author

https://github.com/dail8859/NotepadNext/suites/16556741509/artifacts/945757281

Same issue again. I believe that the person who works on this needs to be able to test it themselves. This is easily done with a Windows VM (Microsoft distributes them free of charge) or a second PC.

@dail8859
Copy link
Owner

Same issue again.

Getting back to my prior point...this fix may not be possible due to the Qt DLLs

@BenjaminRi
Copy link
Author

Same issue again.

Getting back to my prior point...this fix may not be possible due to the Qt DLLs

Then the installer needs to install MSVC++ redistributable. If NotepadNext just doesn't run after installation, people are not going to use it. Unfortunately, I'm involved in too many other projects to have time to fix this.

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

Successfully merging a pull request may close this issue.

3 participants