I wrote an executable python program using PyInstaller but I am getting a runtime error:
The app runs perfectly but it always has this error come up. I want to get rid of this problem.
I followed some advice from Stack Overflow and used dependency walker to find issues. In the log section I am getting output like this:
Where a bunch of .dll files have a red x86 while PyInstaller has a black x64. Does this have something to do with 32 bit and 64 bit CPUs? Do I need to update my .dll files to 64 bit?
It looks like you have opened a 64-bit executable with the 32-bit version of Dependency Walker. If you re-open the file with the 64-bit version of Dependency walker it should get rid of your second error. And should point you to your first error which is a missing MS CRT DLL.
Related
I'm getting a DLLNotFoundException in standalone builds on some windows machines, others work perfectly. Dll file is definitely in the plugins folder, copied it to the projectName_Data folder too but no difference.
Also attempted to add dll to streaming assets folder and set new path (Environment.SetEnvironmentVariable) as above but that didn't work either.
Using Unity 4.5.5 btw
Any help at all would be greatly appreciated!!!
What I found is that the error DllNotFoundException is, in some circumstances, very misleading. Unity is not to blame for this because when something goes wrong with dll loading, Unity simply doesn't have that dll in memory and tells you so.
As Keysosaurus says, Visual C++ Redistributable must be installed for your standalone version to work and in most cases this solves the trouble but there can be other reasons like third party dependencies.
In case you are using third party libraries then you must also copy all the needed DLLs or SOs to your executable's folder.
For example I am working with OpenNI 2 and when I build I immediately copy all files from C:\Program Files (x86)\OpenNI2\Redist folder to the folder that contains the .exe. Not doing this results in DllNotFoundException.
Also don't forget that DLLs (and SOs) must match the architecture you are targeting so if you are targeting x64 (64 bit) then your DLL must be x64 too and if you try to use a x86 (32 bit) DLL Unity will be confused and will not load that giving you the same error.
As a side note bear in mind that Unity 5 comes both in 32 and 64 bit versions. In order to run your game in Unity Editor, all third party libraries must be present in both x86 and x64 (in Unity's conventional folders) or at least the one that matches you Unity Editor's architecture.
I discovered that the problem was that players needed Visual C++ redistributable installed, which can be downloaded here:
https://www.microsoft.com/en-gb/download/details.aspx?id=40784
How do I install zlib?
I'm having a major headache trying to get zlib working on my computer. I need it for setting up a SFML Tiled map loader, but don't really have a clue what I'm meant to be doing.
I've read the brief documentation that came with the zlib DLL download, and have put the zlib1.dll in my System32 folder, but the test programs that came included with the download keep giving me "The program can't start because zlib1.dll is missing from your computer. try reinstalling the program to fix this problem." errors.
I think I've set it up right in Visual Studio 2012 as I get no compiling errors, just that error when I try to run the program.
They work fine when I copy the .dll into the same folder as the .exe. Why does what I read about installing zlib tell me to put the dll in System or System32? What is the System32 folder even for?
Will I have to pack the .dll in with any programs that I make? Can zlib be statically linked into my program?
I had a look around before asking but all other questions I found were too specific to be useful for me. D=
I have downloaded both a .dll and a .lib file compatible for 32-bit Windows from libspotify. The project I am working on requires me to use other libraries that does not work on Windows, but compile and work using Cygwin. I therefore need a way to get the .dll and/or .lib file "converted" into a compatible Cygwin format. Is that possible?
The .dll file does not contain symbols, so the suggested method described in the bottom of the Cygwin doc did not work.
The other libraries that I have, generated the following files:
/usr/local/lib/{libname.la, libname.dll.a and sometimes libname.a}
/usr/local/bin/cyglibname.dll
Where libname is the name of the library correctly compiled and installed. How do I get these files from the native 32-bit Windows .dll and .lib files?
Update:
I tried to include the full path to the .dll file instead of using -l and -L as I am used to linking libraries, and I got the following message:
/usr/bin/ld: i386 architecture of input file `/usr/local/test/libspotify.dll' is
incompatible with i386:x86-64 output
It seems like the problem is the 32-bit vs 64-bit. Anyone know how to fix that?
Another update:
It worked by adding -m32 to CFLAGS and LDFLAGS. I now got a different error that I believe is irrelevant for the original question.
It seems like the problem is the 32-bit vs 64-bit. Anyone know how to fix that?
Yes; use 32 bit Cygwin for a project that depends on third party DLL's only available in 32 bit form. Do not use 64 bit Cygwin.
Cygwin and Cygwin-64 can be installed side by side, by the way. (And it's possible to share the same home folder between them, so you don't have to duplicate your .bashrc and whatnot.)
This is not a Cygwin problem. If you build a 64 bit executable with, say, Microsoft Visual Studio, it also will not load the 32 bit libspotify DLL.
When I try to register the 32 bit version of my C++ / ATL project with
regsvr32 project.dll
i'm getting this error:
LoadLibrary("project.dll") failed - The specified module could not be found
project.dll is my dll built using ATL on Visual Studio 10.
The 64 bit version registered fine.
What am I missing?
I have observed this exact same error, but the solution was not installing the redistributable. All the dependent DLLs were present on the system1 according to depends.exe.
In my case, the icon of KERNEL32.DLL was slightly red tinted. Depends.exe did not offer much explanation, but digging around revealed that one of the imported functions were missing from the DLL on the system. To see the imported functions, select the dependent DLL in the treeview and look for the import on the right panel. Order by the PI column to see the red icons of missing imports.
In my case, the missing function was a function that did not exist on my sad target operating system, Windows XP. Since my program did not directly depend on this function, I was able to get away with #defineing the following in my project:
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
Compiling with these macros made it so the function in question was not declared in the headers, and consequently not imported at load-time. Now I was able to use regsvr32. This of course is a very specific (and lucky) case. I did not depend on that import or any other newer APIs, so I could get away with retargeting the project. Were it not a system DLL, I would have needed to find a newer version which could easily lead to a need to update a whole sub-tree of the dependency graph. Or even worse, if I depended on the missing imports, some serious refactoring would be needed.
To sum it up, this error message2 can be caused by the following issues:
The DLL file was not found or could not be read. Check the command line.
Some dependent DLLs were not found or could not be read.
Some imports are missing from some dependent DLLs. If these are system DLLs, you are likely targeting a wrong version of Windows. If these are non-system DLLs, you need to install newer versions of them and all their dependencies.
1.: Apart from IESHIMS.DLL and WER.DLL which is apparently a bug in this old tool.2.: Or really, any problems in loading the DLLs on a particular system
The error description is misleading in this case. The system finds your DLL (project.dll) but one (or more) dependency of your DLL might be missing.
I just installed
Microsoft Visual C++ 2010 Redistributable Package
and now I can install the dll.
Although this works, I'm not too happy with this, because I don't want to have to install this package on a client in order for my dll to work by them.
I have a mex64 dll compiled on my machine. I used Matlab 2009b with VS2008 Pro to compile the dll. The dll works fine on my Matlab installation.
I want a colleague to use the dll so I sent it to him and he gets the following error message when trying to use the dll:
??? Invalid MEX-file 'filename.mexw64': The specified module could not be found.
My current assumption is that this is caused because he uses an older Matlab version or missing a dll that I have. I ran dependency checker and asked him to check that he has all the listed dlls.
I am still waiting for him to confirm his Matlab version.
What other reasons can cause this and can the Matlab version make a difference? (I mean R2009a when I have R2009B and not a huge version diff)
The other person has Matlab R2009a. Shouldn't the mex just work if I compile it on my computer and deliver it to him?
Does this only leave a missing dependent dll?
The issue is strange, but I can confirm it exists.
Using pre-built libraries for matlab that are correctly installed and in the path, I sometimes get the same error. If I type in the function name at the command-line, the function is visible and will auto-complete. However, the function will not initialize until I 'cd' into the directory with the .mexw64 library file.
>> AndorInitialize('')
Invalid MEX-file 'C:\Program
Files\MATLAB\R2011b\toolbox\andor\AndorInitialize.mexw64': The
specified module could not be found.
>> path
MATLABPATH
C:\Program Files\MATLAB\R2011b\toolbox\andor
C:\Program Files\MATLAB\R2011b\toolbox\andor\camera files
C:\Program Files\MATLAB\R2011b\toolbox\andor\m files
... etc
It turns out this is due to missing dependencies, which shouldn't be missing. To resolve the issue, use dependency walker (free, lightweight) to identify what's missing. The mathworks explains this.
http://www.mathworks.com/support/solutions/en/data/1-2RQL4L/
In my case, two DLL's weren't showing up properly, even though they were on my system and in the path. I copied the DLL's into the windows/system32 folder and the library functions now work correctly. What's particularly strange is that the same library worked on my computer a few days ago (prior to the moving the DLL's).
In general, MEX files should work across different versions of Matlab; in particular, they should be forward-compatible. You're right; sounds like a dll problem.
If you built it with Visual Studio, it may be linked to the Visual C++ Runtime. This is a set of libraries that is not installed on Windows by default. The "redistributable" for it can be downloaded here; having your coworker install that could resolve the problem. If that doesn't work, you can use Dependency Walker to check for other unsatisfied DLL dependencies.
Normally, configuring Matlab's "mex -setup" to use the Lcc compiler that's distributed with Matlab could be a way around this, but it's not supported for 64-bit Windows AFAIK.
Also, are you sure he has the 64-bit version of Windows?
Another possible source of the problem could be that you compiled in debug mode. The Visual C++ redistributables only support release mode.
The Dll was a wrapper for MySql access. We ended up using Matlab's ODBC and the MySql Connector.