Can you update isolated components of MinGW? - gdb

After installing MinGW-w64 on Windows 10, can you update single programs, like GDB alone (without updating the whole MingGW-w64 version)?
If so, how do you do it?
Thanks in advance

A lot of those tools have dependencies (in the form of .dll files) and those dependencies have dependencies, etc...
So just replacing the .exe file is usually not the solution (unless it's a staticaly build .exe with no .dll dependencies), and overwriting .dll files that come with the new version mahy break other .exe and .dll files' dependencies.
In conclusion: it's not a good idea unless you keep the single program (like GDB) in a seperate directory.
The https://winlibs.com/ standalone build of MinGW-w64 includes recent versions of tools like GDB, and is always distributed as a whole package to avoid the issues above. Such package is created by building all the components and their dependencies from source.

Related

Missing libgcc_s_seh-1.dll starting the .exe on Windows

Intro
I have a CMake-based C++ project. Until now I build and ran the project via CLion. Everything worked fine until I tried to run the .exe-file directly (not via CLion).
Problem
When I navigate to the cmake build directory in order to start my program via the executable file, it fails with the following message in the popup: Cannot continue the code execution because libgcc_s so-1.dll was not found. Reinstalling the program may resolve the issue.
I have the following questions
If I interpret the error message correctly, then this dll is missing on my computer. So I ask myself, why does my program still work when I start it via the development environment (CLion), although the error message expressly states that the source code requires this dll?
Is it the fault of my application/source code that the error appears or rather the current state of my computer? If the former, how can I prevent this error from appearing for other users?
What is the best way to fix this error? It's obvious that I need to download this dll, but where is the best place to put it (which directory and environment variable to use on Window)?
Which source is trustworthy to download this dll? I don't want to download any malware under this dll-name.
Optional: What kind of library is that? What functionalities does it offer?
Additional information
I use CMake as my build tool, CLion as the IDE and MinGW as the compiler.
What I have did so far?
I made sure it still works through the IDE.
I found this dll does not exist in the MinGW installation folder.
I searched the web for more information. Unfortunately, there are only pages unknown to me that only offer the download of this dll. That doesn't satisfy me.
I found the cause of my problem: I had two MingGW installations on my machine. Once the installation that comes with CLion and a separate one. The latter did not have the required dll. However, CLion used its own installation, which in turn owns the DLL. So the solution was to remove the separate installation and include the path to the CLion installation's bin/ directory in the PATH environment variable.
This file is part of MinGW-w64 when using SEH as exception model (as opposed to Dwarf or SJLJ). You need to distribute the .dll files your .exe file(s) depend on in the same folder as the .exe file(s).
If you don't have that file, then you probably have been using libraries compiled with different versions of GCC/MinGW(-w64). I recommend building everything with the same compiler to ensure stable binaries.
Tools like Dependency Walker can help you figure out which .dll files your .exe file depends on.
Or use the command line tool copypedeps -r from https://github.com/brechtsanders/pedeps to copy the .exe files along with it's dependencies.

How to deploy Qt app compiled using MSCV so that it won't neet vc_redist installed?

Is there a way to deploy a Qt desktop application that is compiled using MSVC in such a way that it will be "portable" (just run exe from a folder, not install anything, not even install VC_redist)?
Of course, it is possible to use it if Microsoft Visual C++ Redistributable is installed on target computer, but is it possible to make it run without installing it (eg. by putting some dll from vcredist to application's folder)?
Just as you commented, you can use windeployqt to add Qt-related DLLs and resources. As for other required DLLs, you could use Dependencies to find them and MANUALLY copy them into your application folder, including MSVC DLLs.
PS: I know manually copy those DLLs is low efficient and fallible. This is why I ask Is there any way to search and copy all the DLL dependencies?, but I haven't found a tool smart enough to do this chore automatically. You might try those tools mentioned in the comments, like NDepend, though.
If you build/link your application statically, you will only have 1 .exe without DLL. The second way is to build your app with shared libraries and at runtime your app will search those DLL in PATH and in the current directory so you just need to put all your needed DLL in this folder. How do you manage your Qt library ?

Building a Qt executable in Visual Studio 2017

I made a Qt Application in Visual Studio and it works when I run it in the program. However then I build the solution and try to run the executable errors pop up that certain .dll files are not found(QtWidgets.dll, QtCore.dll,QtCored.dll etc.). How can I fix this?
To make your application ready for deployment, you can use windeployqt.
It is a commandline program that comes with Qt and collects all the required dependencies of your executable. Go to your QTDIR/bin/ folder and run this command
windeployqt <path-to-app-binary.exe>
It will scan your binary and copy everything that is needed next to it. For further details, have a look at the documentation.
Well, you have two options:
If you want to distribute your application, you have to copy the required DLLs to the folder where your executable is. You can do this either by copying them manually or you write a script for this. The DLLs are in the binary folder of your Qt installation, e.g.
Qt\5.12.2\mingw73_64\bin
Add the above mentioned folder to your system PATH variable, then the DLLs should be found by your application.

Distributing raw msvcp.dll or installing vc_redist.exe

Deploying an app compiled with MSVC, should I include msvcp140.dll and vcruntime140.dll copy-pasted from VC folder with other .dll's, or distribiute vc_redist.exe installer, installing environment on each user computer?
What is the 'right' approach, and why?
There is no thumb rule or "right approach" for this scenario, rather pros and cons of choosing one over other. In my opinion, this depends on how the product/file is being deployed.
If the file is not getting installed (extracted from a zip or runs before the installer), then placing the necessary redist in the same file is good enough. May be statically linking is better (?)
If everything is getting installed via an installer, then installing the redistributables is cleaner way of doing this. There are already merge modules available to integrate with installer or even standalone executables
Won't recommend placing the necessary files in the folders where installer could be run as it's easier to maintain/update the redist files with each newer version ( of compilers and product)

Installing msvcr90.dll easy way! (without C++ Redistributable Package)

My program is a converted python file to exe file. The problem with this exe file is that it does not run without python installed and it only needs mscvr90.dll! I don't want to install C++ Redistributable Package just for this dll file! That big fat package! If I copy this msvcr90.dll to my application folder it just won't work!
The file path of msvcr90.dll when I install python is:
C:\windows\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
I don't really know how python installs this file but there has to be an easy way to do that.
Any ideas?
The VCRT libraries are hardly a 'big fat' package. I'm looking at them now and they're just over 2mb - almost nothing.
That said the only real way to circumvent the SxS linking would be to change the manifest of the executable that is linking to the files. You can use Visual Studio to open the .exe and edit the manifest to not use SxS linking.
If you compile with /MT then it wont dynamically link to the msvcr90 library.