How do I bundle in ImageMagick's dependencies in a Qt project? - c++

I currently have a C++/QML application that uses ImageMagick to handle large images. I've written it only for Mac. It works fine when I run the program from Qt Creator, or even when I build it for Release and let it rely on weak linking.
I want to share this program with a friend who does not have the Qt libraries or ImageMagick installed. So I've run macdeployqt over the app bundle in a hope it would insert the frameworks required to run the program.
Thankfully that works. The program starts up and runs. However, once ImageMagick kicks in and tries to open a TIFF file, I'm presented with this error from an exception:
Error: Magick: no decode delegate for this image format 'TIFF'
After some various Google searches, I've only found issues from people who had that error from installing ImageMagick directly and are trying to use it from console. I can use ImageMagick and read TIFFs completely fine UNTIL I run the app after it has been deployed.
I'm guessing my question now is: How can I deploy the required "delegate" for tiff along with my app bundle?
Any help is appreciated! Thanks!

Related

Cannot run Qt Creator GUI outside of Qt. "The application was unable to start correctly (0xc000007b)" error

I downloaded C++ code from GitHub to tag images for training an object detector using Machine Learning.
Within Qt Creator 4.2.1 Based on Qt 5.8.0 (MSVC 2015, 32bit), I was able to compile and run the code. Unfortunately, I was not able to run the .exe outside of Qt Creator.
Initially, I received an error that
"The program can't start because libgcc_s_dw2-1.dll is missing".
Thanks to
QT The program can't start because libgcc_s_dw2-1.dll is missing, that was fixed easily by adding
"QMAKE_LFLAGS += -static"
to the .pro file. Now, when I run it I get
"The application was unable to start correctly (0xc000007b). Click OK to close the application."
I was able to reproduce the error using the simple "Hello World" default project that appears when you create a Qt Widget Application. This led me to believe something was wrong with my installation.
Based on the advice of this article: https://stackoverflow.com/questions/12099117/32-bit-qt-application-on-win-7-x64-wont-run-but-runs-fine-from-qt-creator, I used Dependency Walker to identify possible causes. I expected to see only a few items that I can follow up on. Instead, I received a list of close to 100 missing .dll files. All the files started with
"API-MS-WIN ###.DLL" or "EXT-MS ###.DLL"
where ### represent some additional text characters, for example;
"API-MS-WIN-SHCORE-STREAM-WINRT-L1-1-0.DLL"
I'm attaching a sample output.
Another suggestion was to copy over
libwinpthread-1.dll, libstdc++-6.dll, libgcc_s_dw2-1.dll.
That did not work either.
My next move was to simply get the latest version of QT and wish for the best. I installed Qt Creator 4.8.1 Based on At 5.12.0 (MSVC 2015, 32 bit). This time, I could not even get the code to run in the IDE. I received 1000+ error messages!
Based on advice from several pages, I added
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
to the .pro file and it still would not compile.
Also, I verified that the application is being built as a 32bit application. I'm running on a 64 bit Windows 10 system.
If anyone would like to take a crack at it to see if they can create a working .exe, here is the link: github.com/clavicule/BBTag
Qt provides a tool to copy the necessary dlls to the folder of your executable.
The tools is called windeployqt.exe and comes with your Qt installation. For me it is located at C:\Qt\5.9.1\msvc2015_64\bin\windeployqt.exe. You will have to look at your installation path and probably the msvc_32 folder to find it.
Then you go to the folder with your executable in it, oben a command prompt or powershell and execute path\to\windeployqt.exe yourProgram.exe and it will automatically copy the necessary dll files to this folder. Afterwards you can run your program without issues.
The official documentation for the tool can be found here.
Alternative 1: While developing you could use QtCreator which automatically adds the paths to the dlls when running your program - make sure to include them if you deploy your program!
Alternative 2: Add the path to the necessary dlls to your PATH variable. This isn't recommended either, since everyone who gets your program would have to do the same to run it.
I figured it out! My installation of Anaconda (a Python distribution popular for data science and machine learning) is the culprit.
From: #remy-lebeau
The application was unable to start correctly (0xc000007b)
The error:
"The application was unable to start correctly (0xc000007b) ..."
is a good indicator that the 32-bit app tried to load a 64-bit DLL. At first, this did not make sense since I verified many times that I was using the 32 bit version of Qt.
It turns out that the installation of the 64 bit version of Anaconda also contained many Qt5 dlls used for the PyQt5 package. Since the path to this folder came before the path to my c:\Qt...\bin folder, it was used in the build instead of the actual 32 bit version installed with Qt. This was not obvious because I was unaware of PyQt5 so I had no idea that it came with Anaconda. A simple reordering of the path entries using the System Environment Variables interface AND a system restart fixed the problem.
Silver lining: I now know C++ and designing GUIs w/ QT and PyQt5
Thanks #albertmand and #jwernerny

QT Wrong JPEG Library version

I'm trying to build and run an application with Qt Creator, but got the error message Wrong JPEG library version: library is 62, caller expects 80. I've already remove the old version of my library on my OpenSuse system and installed the new libjpeg8. But still get the same error.
I was trying the same with YaST installer on OpenSuse, but it isn't help me too.
One more thing. When I try to build and run an application with the same code (from examples, it is camera example). It doesnt request it and start without problems. When I commentout the code from the camera example in my application, its starts.
I've already search and read the other Questions here on stackoverflow.

Deploying Qt application on OSX issue finding GStreamer plugins

I am trying to deploy an application on OSX 10.8.5 which builds and runs on an OSX system but I am having runtime issues when the application is started due to it not location a GStreamer Plugin (in this case osxvideosink).
I did the following steps to make the .app bundle.
Compiled the application in QtCreator release mode.
Ran macdeployqt on the resulting .app file
Added in additional libraries e.g. boost and gstreamer.
Used macdependency to find which paths were wrong, changed them to the right ones. All of the dependencys are found within the .app bundle and no errors are reported.
Ran the software on the machine with the libraries install and it works.
Made a .dmg file and moved it onto another machine. Copied out the .app.
Ran it and it work for a few seconds until the required gstreamer plugin is loaded when it crashes out as it cannot find that plugin.
The way I see it, it could be caused by two issues. 1. osxvideosink does not work on that machine, which would be odd as it works on machines with exactly the same operation system. Or the libosxvideosink.dylib file is not found by the linker at run time.
I'm pretty new to macs so any help / ideas would be appreciated.

How do I build a Qt application without an X server requirement on Windows?

I am trying to build a Piet IDE, but I am unable to figure out how to do so without the program giving an error saying cannot connect to x server.
It is called PietCreator, and can be found here.
The pre-built binary can be found here.
Thar binary doesn't require an X server, but for some reason the author didn't compile in GIF support. So I compiled it myself, with all the required dependencies, but when I build it it requires an X server. So when I start up Cygwin-X and run it through its terminal, and it starts, but the application has a lot of bugs not present in the pre-built binary.
I tried searching for how to build a Qt application without it requiring an X server, but I couldn't find anything. Can anyone offer any help? Thanks.

Apply VST audio effect/plugin to audio-file

This is my first question after leeching over here for some time.. So spare me.
I need to apply the iZotope Vinyl VST effect to some audio files via CLI or C++ (so language doesn't really matter), it has to work on a Mac or on a Unix based system. I've researched all over the webs and can't find any working solution.
I've tried using MissWatson, a command line utility, this works but my result audio files are silent...
./MissWatson -plugin=Vinyl -input-file="/Users/Sjaq/Desktop/test.wav" -output-file="/Users/Sjaq/Downloads/MissWatson-v1.0-mac/res.wav" -parameter=1:0.6,2:0.6,11:0.4
Then I tried using the Steinberg VST SDK by creating a host application, starting from the vstvalidator provided by the SDK. But when I try to load the VST I get this error:
2010-12-01 16:57:40.774 vstvalidator[4654:903] Error loading /Library/Audio/Plug-Ins/VST/Vinyl.vst/Contents/MacOS/Vinyl: dlopen(/Library/Audio/Plug-Ins/VST/Vinyl.vst/Contents/MacOS/Vinyl, 262): no suitable image found. Did find:
/Library/Audio/Plug-Ins/VST/Vinyl.vst/Contents/MacOS/Vinyl: no matching architecture in universal wrapper
And I don't know what to do. I'm pretty new to C++ and and made a few apps without any issues, but this time I've hit a dead end.
I've read about pyvst but it seems to need a DLL for the VST so that didn't work either.
I'm the author of MissWatson, and as you probably noticed on the webpage, I unfortunately was required to close-source the code, so I can't really ask you for more diagnostic information, since I wouldn't be able to patch MissWatson if it's a bug there. However, I would recommend running MissWatson with the -verbose switch and perhaps logging that output to file if that floods your terminal. You might find something in that output which helps you to diagnose the problem.
Anyways, as for the error in your VST host, I have a feeling that you are compiling your app as a 64-bit executable and trying to load a 32-bit plugin. Since hardly any VST/AU plugins (and also sequencers, for that matter) have made the leap to 64-bit, you'd be better off just compiling your app as a 32-bit x86 binary.
By default, the "debug" configuration in Xcode only builds your app for the native architecture of your machine to save time during compilation. I would advise that you disable this feature in your project's build settings and always build with the architectures you plan to ship with. This will prevent weird cross-architecture types of errors like the one you saw above.
Edit: I have since started a new command-line VST host to replace MissWatson which is called MrsWatson. You should try using this tool instead.
Perhaps you can port the source code of this open source vst host to match your platforms?
http://www.hermannseib.com/english/vsthost.htm
Scroll down to the bottom of the page.
Hope it helps.