I have a list of DLLs and I would like to know the versions of all other DLLs, used by those files. In UNIX this is very simple:
ldd *.dll
But in Windows this does not work (I tried using my Ubuntu WSL).
Does anybody know a commandline command for this? (Powershell is good, too)
dumpbin.exe /imports will list the immediate static load dependencies, but not attempt to resolve them (which implies no version numbers nor transitive dependencies)
depends.exe will resolve dependencies (including dynamic load ones if you run in "profiler" mode which supports a variety of different methods for hooking LoadLibrary(Ex) and GetProcAddress) but is not a command-line tool. For each dependency it lists the path and version number, along with a lot of other information such as link date and required OS version -- you should be able to save this list to a file for command-line processing.
Neither of these is included in the OS distribution, you'll need a Windows SDK tools package.
Related
It is very long time (~20 years) since I tried last time to program something in C/C++ under Windows, and I completely forgot how it works.
I have some project using GLEW, SDL2 and Lua52 under Linux, but my friend wants to compile it under windows.
I installed MinGW and cmake under windows, and downloaded the .zip files with the libraries (lua-5.2.4_Win64_bin.zip, lua-5.2.4_Win64_dllw6_lib.zip, SDL2-devel-2.0.12-mingw.tar.gz, SDL2_mixer-devel-2.0.4-mingw.tar.gz )
What I don't see, where should I unpack these files so that Cmake can find them?
In Linux I install the libraries from system repo, and then corresponding .cmake scripts can find the automatically use some helper files like (FindSDL2.cmake, FindSDL2_mixer.cmake, FindLua52.cmake) but I don't see how to do this under Windows where is no such central repo-manager I have to unpack the libs in some folder manually.
I want to avoid manual setup of PATHS, since this I always mess up.
If you have a Linux background you should definitively use the MSYS2 environment (https://www.msys2.org/). It comes with a bash shell and a package manager.
I was informed about the "windeployqt" utility, which should be able collect all Qt/MinGW DLLs that are required to run my Windows Qt application properly. So I gave it a try.
Unfortunately I have noticed that it collects more files then neccessary. I compared the files collected by the windeployqt utility against the ones that are reported by the "Dependency Walker". The files that are really required have been collected properly, but also following files were collected for some reason:
Qt5Svg.dll
iconengines\qsvgicon.dll
imageformats\qdds.dll
imageformats\qgif.dll
imageformats\qicns.dll
imageformats\qico.dll
imageformats\qjp2.dll
imageformats\qjpeg.dll
imageformats\qmng.dll
imageformats\qsvg.dll
imageformats\qtga.dll
imageformats\qtiff.dll
imageformats\qwbmp.dll
imageformats\qwebp.dll
The application just deals with QBus and uses QWidgets to display a simple Window. Therefore I see no reason why these DLLs have been collected.
The fact that a DLL is no listed by Dependency Walker does not mean it is not required.
Dependency Walker will only list DLL required for you exe to be loaded and started by Windows. But other DLLs may be loaded later, while your program is running. This happens in particular when Qt loads plugins like the image format plugins
Because it cannot know beforehand what plugin will be needed, windeployqt deploys all Qt plugins (all which are relevant in regard to the required DLLs).
You can alter the way windeployqt behaves by using command line modifiers like --no-plugins (see windeployqt -help).
You can take a look at Qt for Windows - Deployment in the Qt documentation, in particular the part about Qt Plugins.
windeployqt utility will parse your "EXE" file and determine what packages were used, then it copies needed DLLs accordingly. Make sure to invoke the utility in a configured/set environment.
I use the utility in this way:
Perform release clean build of the project and record build path and "exe" generated. For insrance
c:\myApp\release\ and myApp.exe
Create deployment folder // other than the release build folder//. for instance
c:\myApp\deploy
then invoke the utility from Qt command line utility, as follows:
- Go to all progrmas --> Qt --> Qt command line utility
- cd c:\myApp\deploy
- windeployqt --dir . c:\myApp\release\myApp.exe
I have to C program which is compiled using gcc in ubuntu. I want to run that executable in android terminal. When i run it is showing either "file or directory is not found" or "not executable:ELF32".
I want to run the code in android terminal. Is there any way or flags in gcc or using any other compiler so that i can run my code in the android terminal.?
Android does not use the same system libraries as Ubuntu, so they will not be found.
There are two solutions:
Copy the libraries you need.
If you can place them in the same filesystem locations they have in Ubuntu then great, otherwise you'll need to run the ld-linux.so manually and tell it where to find the libraries. Or, you could relink the program such that it expects to find the dynamic linker and libraries in a non-standard place. You might also use a chroot, but that requires root, and you'd need to find a chroot binary that works.
Use a static link.
This usually just means passing -static to GCC. You get a much larger binary that should be entirely self-contained, with no dependencies. It requires that static versions of all your libraries are available on your build system. Also, some features (such as DNS lookup) always expect a shared library, so they won't work this way.
Even then, you should expect some Linux features to not work. Basically, anything that requires hardware features or configuration files in /etc are going to need a lot of effort. There are various projects that have done this already (search "linux chroot android").
I'm not sure what the "not executable:ELF32" message means, but you should check whether you're building 32 or 64-bit executables, and which the Android binaries are using (file <whatever> should tell you).
I am trying to compile some open source libraries in MinGW+MSYS. During the configure phase, I kept seeing some 3rd party libraries are missing.
For now, my solution is to download the source of the missing libraries and follow the GNU build process to compile and install them into my MinGW environment.
Is there any package management system for MinGW+MSYS to install packages easily? Just like apt-get.
I tried the mingw-get for the missing package. But it reports the error below.
mingw-get is the (closest equivalent to apt-get) package manager for MinGW and MSYS. However, it can only manage packages which are actually available for MinGW and/or MSYS, (either because a MinGW developer has built and packaged them, or a member of the MinGW user community has contributed them).
Arbitrarily guessing what packages may be available, and even what their correct package names may be, is unlikely to be productive. Run mingw-get in its GUI mode, (if it's properly installed, just running mingw-get without arguments should start it in this mode), to see a list of packages which are actually available; if you don't see any likely candidates for what you are looking for, then it doesn't (yet) exist. In that case, you will need to either find a non-MinGW alternative build, or build it yourself, from source. (If you choose the latter option, and your build is successful, then you may wish to consider contributing it to MinGW.org).
This works for me as a "package manager".
Install MSYS2. It comes with a package manager called pacman.
I've got some perl source code here, how do I build it on Windows, to get a windows binary that I can work with?
Usage of external tools normally comes with compatibility issues, random errors etc. You are better off using the inbuilt perl 'pp' tool. Install PAR::Packer (which includes the pp tool) module and then read the manual for it...
It allows you to pack your perl scripts to executables, and has options as what modules and dependencies to include, I've used it on winXP and win7 and never had an issue with any executabe produced.
pp manual
I've found Cava Packager to be just what I needed.
(source: cavapackager.com)
How to compile Perl scripts into EXEs
Download ActivePerl 5.10 for Windows.
Install it.
Restart your PC.
Download Cava Packager
Install it.
Open it.
Make a new project choosing a blank folder.
Scripts > Add..
Choose your .PL script file
Perl library > [...]
Choose "C:\Perl\bin\perl510.dll"
Add
Choose "C:\Perl\lib\"
Save
Build
You could use the Perl Development Kit from ActiveState to "compile" your script to a .exe file. I used it to create binaries of MRTG and a couple tools more to be deployed on windows servers running as a service. There used to be another product (from IndigoStar or something) called perl2exe I think to get the same result.
Just a note that Cava Packager also supports creating executables from Perl code on Linux and Mac OS X in addition to the original Windows version.
Note: As indicated by my name, I am affiliated with Cava Packager.