Program loading (incorrect) dll even though it is statically linked - windows

I'm building some thrift code on windows which has the following dependencies:
open ssl
thrift
Setup:
Windows 7 64-bit
VS2013
Goal:
32-bit thrift app
I compiled open ssl using these instructions (32-bit release) which produced libeay32.lib and ssleay32.lib. Next I created a VS2013 project to build the thrift library that depends on open ssl. On compilation, this project produced libthrift.lib which is (as far as I can tell) statically linked:
All good so far...
Next, I build my thrift app., again, linking statically:
However, when I run my thrift app., I get the following error that complains about incompatible image types (x86/x64):
To find the cause, I ran dependency walker on my app only to find that it's pulling in 64-bit ssl dlls (!) that came with the 32-bit (!!!) mercurial installation:
My understanding is that my application should only link against libthrift.lib which has already statically linked the open ssl stuff (above).
It seems my understanding is not up to scratch but I'm stumped as to where I'm going wrong...

Related

Godot app stop working when added external DLL

I have a problem using external DLL-s in Godot and would like to ask for advice.
I use Godot with Rust. For that, I compile a DLL which contains the game logic written in Rust (dylib.dll). So far everything is good, my application can be run.
Now I added an other external library to the stack (ValveSoftware/GameNetworkingSockets, GNS) as a DLL. This DLL is referenced only by my game logic dll (dylibd.dll), and Godot does not know about it. My game-logic-dll compiles fine referencing GNS.
Now when I start my Godot app, I get an error whic says:
ERROR: Can't open dynamic library: project/libs/dylib.dll, error: Error 126: The specified module could not be found.
.
At: platform/windows/os_windows.cpp:2395
ERROR: get_symbol: No valid library handle, can't get symbol from GDNative object
At: modules/gdnative/gdnative.cpp:501
ERROR: init_library: No nativescript_init in "res://libs/dylib.dll" found
At: modules/gdnative/nativescript/nativescript.cpp:1506
Sidenotes:
It works on linux without any issue, the problem occurs only on windows.
I use nightly-x86_64-pc-windows-msvc rust toolchain
The GameNetworkingSockets was built on the same machine, I think the vcpkg builder uses Visual Studio for the build.
all the required DLLs (my game logic DLL and the lib's DLL) is in the Working directory.
Any idea?
I have found the issue :)
The problem was really simple, the main issue here is rather the misleading and lacking error message from Windows.
The issue was that my external DLL also depends on other DLL-s as well, which windows could not find on its searching paths (in this case, libprotobuf.dll, libssl.dll, libcrypto.dll).
On my linux machines those shared libraries probably were already installed, that is why it worked there but not on Windows.
This tool also helped me al ot: https://learn.microsoft.com/en-us/sysinternals/downloads/procmon#download
With this tool it was easy to spot that my app tried to load the aforementioned DLL-s but could not find them.
I had the same problem. I developed a project with Godot on my pc (Win 10). Then I moved the same project on another pc (Win 10).
When I tried to import the project I found the "ERROR: Can't open dynamic library: C:/GodotProjects/mylib.dll, error: Error 126: The specified module could not be found."
The new pc needed some Visual C++ Redistributable packages:
Visual C++ Redistributable package
I hope this could help you

Does FIPS OpenSSL work with Boost ASIO?

I've built the fips mode OpenSSL using OpenSSL version 1.0.2d and the fips canister with version 2.0.13. The whole thing compiles and links successfully to create a Windows 32-bit version of the libeay32 and ssleay32 lib and dll files.
I've created a small sample program (just a console program in VS2010) that can run correctly - just setting OpenSSL into fips mode and printing errors if anything goes wrong.
However, when I link those same lib/dll files in the actual program I'm developing things don't work at all. The program is an executable that loads dll modules for functionality. One of those dll modules is the one that links to the OpenSSL library. That dll module also uses Boost asio. When my program starts, it can't load its own dll module that uses the OpenSSL dlls.
I thought there might be a dependency issue (something not found) that was preventing the load. That's what lead me to creating the small console sample. It works using the same linkage settings and files.
If I build the OpenSSL without the fips canister - just 'regular' OpenSSL version 1.0.2d, the resulting lib/dll files work fine in my application.
So, I'm wondering if there is something that the boost library might be doing that is preventing the fips OpenSSL dlls from loading correctly.
Has anyone heard of anything like this?
Thanks.

Qt 5.2.1 with MinGW 4.8 32bit wont run applications on Windows 8.1

Using Qt Creator 3.0.1, Qt 5.2.1, MinGW 4.8 32bit on Windows 8.1 64bit, I am able to build an application but not run it.
When trying to debug the application (new clean project), the output tells me
This application failed to start because it could not find or load the
Qt platfor plugin "windows". Available platform plugins are: minimal,
offscreen. Reinstalling the application may fix this problem.
follow by a
Runtime Error!
Program C:\Qt\Qt5.2.1\test\debug\test.exe
This application requested the runtime to terminate in an unusual way
etc...
I tried adding the qwindows.dll's under my /debug/platforms/*.dll but no difference there.
Is my problem due to my Windows installation?
EDIT: After trying out #paulm's solution, putting the windows dll's inside plugins instead, nothing changes.
Dependancy Walker tells me that I miss
API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL
EDIT2
After adding these DLL's (had to download them from here) and seing I had to change the name of one of the DLL's I downloaded from this site, I now get the new error
This application failed to start because it could not find or load the
Qt platform plugin "windows".
Available platform plugins are: minimal, offscreen
And not the following runtime error.
Since I had to go to external sources to get the Microsoft DLL's, doesn't this really points to something faulty with the Windows 8.1 DLL's?
EDIT3:
To clarify, in my \platforms I have
qminimal.dll
qmoffscreen.dll
qwindows.dll
whilst in my \plugins I copied the same DLL's.
All required steps are described on this page of the documentation. Check especially the "plugandpaint" example under "Creating the application package".
My guess is that you are missing the second one:
myapp.exe
platform/qwindows.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Widgets.dll
And yes, dependency management on Windows is a pain. It should be part of the OS, instead, it's not, and you have to take care of everything yourself.

Wxwidgets project compiled using Codlite asking for dll on Windows

I am atempting to build a Multiplatform desktop application using WxWidegts. As the IDE I am using Codlite. Version info is
Codlite: Revision 5770
WxWidgets: 2.9.4
OS: Windows 7
Compiler: g++
The problem is, after compiling, trying to start the program will give an error that tells me wxbase294u_gcc_cl.dll is missing. I thought maybe its a debug library thing, so I set the build configs to release but still the same error.
My understanding was that Wxwidgets builds nativly to the OS so it shouldn't be dependant on such a large dll. The dll exists in the libs that was installed by Codlite, but the system does not seem to pick it up.
Am I supposed to build using VC++? not sure how to set that on the build settings.
I've been a WebApp guy for a long time and new to Cross-Platform devlopment, so help me out if I'm going the wrong way.
Thanks in advance.
The wxWidgets library code must be linked to your application code. This can be done in two ways: A) to use static libraries, which are linked to your application executable when it is built, or B) to use DLLs, which are linked to your application when it runs.
From your question, you have built your application to use DLLS.
You have two options to fix this problem. Easiest will be to copy the required DLLs into your application folder.
You can also change the codelite options to use wxWidgets static libraries - you will need a codelite expert to help you to do that.
I took a quick look at the codelite webpage. It does look like codelite uses wxWidgets DLLs by default. To change this, you will need to built wxWidgets the "DIY" way as described here but set the SHARED make option to 0

Access violation when compiling in debug

I'm trying to profile a C++ project in Embarcadero RAD Studio 2010. To do this I wanted to use AQTime, but I'm running into a bit of a problem.
I can compile and run the application in release mode. But when I compile in debug mode, using the settings mentioned at http://smartbear.com/support/viewarticle/18053/, I get an access violation.
... faulted with message: 'access
violation at 0x062324bd: read of
address 0x62324bd'. Process stopped.
Use Step or Run to continue.
It seems to come when I load a bunch of dll's at the startup. But since it goes well in release mode I can't seem to figure out what could be the cause.
When the access violation occurs I get thrown out into assembly and that isn't one of the languages I'm fluent in ;)
EDIT : When scanning the .exe with Dependency Walker I get a message saying that the following files can't be found
CC32100MT.DLL
INET140.BPL
RTL140.BPL
VCL140.BPL
IESHIMS.DLL
Could this be the problem somehow? Are these debugspecific or is Dependency Walker not giving me correct information? The same files are said to be missing when I try a release compiled version to.
I'm running on Windows 7 x64, if that could be part of the issue. I have had problems before with the symlink-look-alike (user/AppData/Local...) that MS used for some folders. Notably when I ran an apache server and the htdocs folder actually wasn't located where the server thought it was (and where it appeared to be) :)
Have you tried disabling dynamic rtl which can be found in the C++ builder linker options pane?

Resources