"Failed to load dynlib/dll" error for libdmtx.dll when running an executable generated by auto-py-to-exe - auto-py-to-exe

I am using the library pylibdmtx to generate a data matrix in my python script. Since the library uses the dll libdmtx.dll, I added it to the "Additional Files" (--add-data) section of auto-py-to-exe.
When I run the executable on my computer where I wrote developed the python project, the executable works perfectly but when I transfer the executable to a different computer and try running it there, I get the Failed to load dynlib/dll error.
I checked the temp folder that the executable was creating and using and found libdmtx.dll to be present there. I am not sure why the executable works only on my computer but not the others. Am I missing adding any other dependencies for libdmtx.dll?
Image of the error when the executable is run

Related

Running software build in MSYS2 MINGW32 shell

I'm trying to run a piece of software I built in MSYS2 MINGW32 shell. The software is 32bits (don't have time to port it to 64bits) and there is one statically linked executable. Here is how I setup the build environment:
Installed a fresh copy of MSYS2;
$ pacman -Syu
Installed the following packages: git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-SDL mingw-w64-i686-SDL_mixer mingw-w64-i686-zlib mingw-w64-i686-libpng mingw-w64-i686-make
Git checkout the repo
Run the build in CMake
Build runs fine and the exe is generated.
Now the problem starts: the executable can't run and displays an error message about missing DLLs. I copied the missing DLLs to the same folder of the executable, and them another error message pops up complaining about error 0xC000007B, which I tracked down to be missing dependencies. After a while I figured out that the problem was that some of the DLLs is missing a dependency itself. Copied this last dependency to the folder.
Now, the big question: I can run the exe perfectly fine in the MINGW32 shell but I can't run it neither in cmd.exe nor by double-clicking in Windows Explorer and this is a problem (I can't ship a software this way). Is there any way to produce a binary that is able to run from explorer and from cmd.exe? What is the cause of this problem? Can it be mitigated?
I solved my problem!
After a lot of research, I realized that nothing was wrong with my MSYS2 build/setup/dependencies. The real problem was that CMake hide one parameter for the linker: -mwindows. Actually, the CMake find_package routine from one of the libraries I'm using (SDL) added this parameter to the linker command line parameters.
Adding a -mconsole to the linker parameters (using add_link_options("-mconsole")) solved the problem. The CLI now works as expected.
Thank you all for your help.

How can I build liquidfun library with cmake?

I am trying to run SFML-LiquidFun-Water-master open source file (https://github.com/alextrevisan/SFML-LiquidFun-Water) on VS2015, but it had some errors (such as there is no proper library "Box2D", "Liquidfun"), I realized that I have to install liquidfun librabry and bring it to the source code which I want to run. I downloaded liquidfun library from https://github.com/google/liquidfun and Cmake from https://cmake.org/ and followed instructions based on here http://google.github.io/liquidfun/Building/html/md__building_windows.html but It keep saying that there is no such command name Cmake whatever.. What am I supposed to do to run source code thank you!!

How to run objective-c console application (with a library) outside of xcode?

I have a simple console application intended to exercise a library from a larger project. The console application is one target within an XCode project that also contains the library ( plus some other targets I don't care about right now). The console target references the library by listing it in the Build Phases "Target Dependencies" and "Link Binary with Libraries".
I can run the console program just fine from within XCode by clicking the "Run" button and examining the console output under "All Output".
However I get a load error if I try to run outside of XCode. I select the console application under "Products" in the project navigator, and then I locate the "Full Path" in the "Identity" section of the information panel. When I copy this path to a terminal window and run it, I get an error like:
dyld: Library not loaded:
#executable_path/../Frameworks/[LIBRARY].framework/Versions/A/[LIBRARY]
Referenced from: [THE PATH THAT I TYPED]
Reason: image not found
What should I do differently to get my console application to execute from the console?
(Note, in the "Copy Files" phase, I have tried leaving the "Subpath" blank and setting it to "#executable_path/../Frameworks" per this answer, which was about a cocoa app, but neither way has helped.)
As the commenters above explain, dyld is the dynamic loader and it is looking for my library at the path it printed. (When it says #executable_path, it means the location of the console application I'm actually trying to run.)
Looking at the compiled output from XCode, I see a folder hierarchy like this:
Debug/
MyProgram
Frameworks/[LIBRARY].framework/Versions/A/[LIBRARY]
For whatever reason, this structure does not match what the loader wants -- it is looking for the library at ../Frameworks rather than ./Frameworks.
Rather than messing with the environment variables used by the loader or trying to tweak the program itself, I just copied these files a new folder with the structure specified in the error message:
foo/
bin/MyProgram
Frameworks/[LIBRARY].framework/Versions/A/[LIBRARY]
I can now run foo/bin/MyProgram from the terminal without any problem.

Is there any way to change the dynamic library search path in Xcode

Below is my scenario,
In my Application i had to make use of libopus library , i downloaded and install, compile --> install procedure is normal as its for any other open source library,
I linked libopus.a with my application, the way i did is , by default it will get installed in /usr/local/lib, so i drag from there and add it to my application,
Worked fine and no error on my machine,
On Another machine, i was expecting it to be run smoothly as i included this library statically, but its throwing error as
dyld: Library not loaded: /usr/local/lib/libopus.0.dylib
so i concluded, libopus.a somehow including libopus.0.dylib also dynamically,
Now i am able ot add a copy phase in my build setting , so it will get copied in ../Framework folder
if i do otool -L libpus.a then it shows following result
otool -L /usr/local/lib/libopus.a
Archive : /usr/local/lib/libopus.a
/usr/local/lib/libopus.a(bands.o):
/usr/local/lib/libopus.a(celt.o):
/usr/local/lib/libopus.a(cwrs.o):
/usr/local/lib/libopus.a(entcode.o):
/usr/local/lib/libopus.a(entdec.o):
/usr/local/lib/libopus.a(entenc.o):
/usr/local/lib/libopus.a(repacketizer.o):
It doesn't show as its depend upon the dylib library
Now my Question is
How to tell Application to look into this path first
I tried following option,
install_name_tool but it seems it will work on other machine , so the user need to run this script NOT DEVELOPER,
trying to set the some option in the xcode to set the RUNTIME Search path to locate that particular dylib but not getting succeed so far
install_name_tool is run by the developer during the build process, not by the user.
If you're building the library, you should use libtool(1) with the option -install_name #rpath; otherwise, you can use install_name_tool(1) with -id #rpath to do the same thing on the dylib. Then, when you're building your application, set the "Runpath search paths" to the path where you will install the library.
Apple has some good documentation on this in their Mach-O Programming Topics and Dynamic Library Programming Topics.

Problems registering a dll

I am trying to register a .dll file but I am getting an error. The .dll is in the SysWOW64 folder, through the command line I then cd \Windows\SysWOW64 and run the following command regsvr32 php_sdo.dll
I then get the following error:
"The module "php_sdo.dll" failed to load.
Make sure the binary is stored at the specified path of debug it to check for problems with the binary or dependent.DLL files.
The specified module could not be found"
This kind of failure often occurs when one of the dependency of the DLL one wants to register (which physically means, that the program that attempts to register the DLL internally calls LoadLibrary) is missing. You can have a look at the dependency (tree) of your DLL using Dependency Walker.