How can I get past a "Library not loaded:" issue? - c++

I started playing with the Kinect and I would like to use skeleton tracking using OpenNI.
Since my knowledge of c++ is limited, the easiest option is to use the ofxOpenNI addon for OpenFrameworks.
I've downloaded the addon, and successfully compiled the example, but the application can't load a dylib:
[Session started at 2011-02-24 11:46:27 +0000.]
dyld: Library not loaded: #executable_path/./../../../data/openni/lib/libnimCodecs.dylib
Referenced from: /Users/george/Downloads/FirefoxDownloads/of_preRelease_v0062_osx_FAT/apps/examples/NI_userIsolation_4/bin/emptyExampleDebug.app/Contents/MacOS/emptyExampleDebug
Reason: no suitable image found. Did find:
/Users/george/Downloads/FirefoxDownloads/of_preRelease_v0062_osx_FAT/apps/examples/NI_userIsolation_4/bin/emptyExampleDebug.app/Contents/MacOS/./../../../data/openni/lib/libnimCodecs.dylib: unknown required load command 0x80000022
/Users/george/Downloads/FirefoxDownloads/of_preRelease_v0062_osx_FAT/apps/examples/NI_userIsolation_4/bin/emptyExampleDebug.app/Contents/MacOS/./../../../data/openni/lib/libnimCodecs.dylib: unknown required load command 0x80000022
/usr/lib/libnimCodecs.dylib: unknown required load command 0x80000022
The Debugger has exited due to signal 5 (SIGTRAP).The Debugger has exited due to signal 5 (SIGTRAP).
I am using XCode on osx 10.5.8 with OpenFrameworks 062.
This was a bit of background, but I imagine the dylib problem is something general.
I have the requested dylib files in my project, and the path seems ok.
Any clues ?

Sounds like the libs, though present, aren't compatible with your system -- it finds them but can't load them.
And indeed, checking the README on the OpenNI github page, in the section "Release Notes", we find the following:
* MacOSX: Only OSX 10.6 (Snow Leopard) with an Intel based CPU is currently supported.
You have the source, obviously, but fixing this yourself would probably be quite a chore. Otherwise, you could wait and see if future releases add Leopard compatibility, or you could upgrade your OS.

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

QtWebEngine to embedded linux cross-compilation fails

I'm trying to cross-compile my desktop project to a raspberry pi. My projects uses Qt 5.6, and QtWebEngine.
I followed this guide: RaspberryPi2EGLFS
It runs without the webengine-using parts, but I cannot use the WebEngine module because I cannot compile it. It gives me this:
gyp: Undefined variable clang_dir in /Users/aeron/raspi/qtwebengine/src/core/core_generated.gyp
gyp: Undefined variable clang_dir in /Users/aeron/raspi/qtwebengine/src/core/resources/resources.gyp
Project ERROR: -- running gyp_qtwebengine failed --
I have already tried to manually insert an empty variable, but these two lines are just the tip of the iceberg.
I get to this error too when I grab the full qt5 repository and try to compile it.
Update
I made some progress. With editing qtwebengine/src/core/config/embedded_linux.pri I managed to solve the clang_dir problem. I've just added the line clang_dir=0 to the end of the list of the variables.
But there is another problem of the same kind:
gyp: Undefined variable c_sources in /Users/aeron/raspi/qtwebengine/src/3rdparty/chromium/third_party/ffmpeg/ffmpeg.gyp
Project ERROR: -- running gyp_qtwebengine failed --
How can I resolve this? Or how can I turn off the ffmpeg part of the webengine, I don't have plans to use it anyway...
Update 2
Now it think I solved the ffmpeg problem. The way: in the file src/3rdparty/chromium/third_party/ffmpeg/ffmpeg.gyp I set the use_system_ffmpeg to 1.
Now I have a new problem:
Updating projects from gyp files...
gyp: Dependency '/Users/aeron/raspi/qtwebengine/src/3rdparty/chromium/base/base.gyp:symbolize#host' not found while trying to load target /Users/aeron/raspi/qtwebengine/src/3rdparty/chromium/base/base.gyp:base#host
Project ERROR: -- running gyp_qtwebengine failed --
So it still does not compile.
Probably not what you want to hear, but QWebEngine is not officially supported on the Pi.
From
https://doc.qt.io/qt-5/qtwebengine-platform-notes.html#all-platforms
"On Linux, Clang or GCC version 4.7 or later is required. Supported configurations are linux-g++ and linux-clang."
However, I know for a fact, it can be cross-compiled (I did it on Ubuntu 16) for Qt 5.7.1 and Qt5.8.0, but only if you configure for device "linux-rasp-pi2-g++" and not for "linux-rpi3-g++". It CANNOT be built for Qt5.9.0.
Note that Qt5.8.0 has bad OpenGL performance on the Pi. This issue is not present with Qt5.7 or 5.9.
Then again - it is probably too heavy for the Pi anyway.

Is the gstreamer-java 1.6 compatible with gstreamer 1.6.1 windows binaries

Do anyone have any idea if the gstreamer-java-1.6.jar downloadable from https://code.google.com/p/gstreamer-java/downloads/list is compatible with gstreamer windows 1.6.1 binaries? I installed both and setup the eclipse environment but somehow it gives me the warning for all(assuming as lot of warnings are on the eclipse console) the gstreamer plugins.
(javaw.exe:9744): GStreamer-WARNING **: Failed to load plugin 'D:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\libgstgio.dll': 'D:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\libgstgio.dll': The specified module could not be found..............
Although I can see everything is fine from command prompt running gstreamer(creating sample pipeline etc).
For any other, it will be helpful that gstreamer-1.6 compatible java bindings are there and available on https://github.com/praxis-live/praxis/tree/master/lib.gst1-java-core/release/modules/ext.
See reply on java-gstreamer forum.
No, it isn't!
The new home of the Java bindings is at https://github.com/gstreamer-java
The old GStreamer-Java only supports GStreamer 0.10. Try
gst1-java-core at https://github.com/gstreamer-java/gst1-java-core
There are no pre-built binaries there, although you can get my one
from Praxis LIVE -
https://github.com/praxis-live/praxis/tree/master/lib.gst1-java-core/release/modules/ext
Click on it, then click view raw and you can download it.
It's still a work in progress, and I haven't tested on Windows yet,
although others may have.
Best wishes,
Neil

Qt camera example does not find the laptop's webcam

I'm using Debian Jessie and dmesg | grep video returns:
[ 22.280407] Linux video capture interface: v2.00
[ 22.790704] uvcvideo: Found UVC 1.00 device Lenovo EasyCamera (13d3:5170)
[ 22.796546] usbcore: registered new interface driver uvcvideo
The example compiles fine but upon launch i get a dialog telling me that the camera service is missing. I'm using Qt 5.5.0. This question points to a similar issue but it's for windows. Also I've installed Qt using the installer provided at it's web site. I've tested my webcam with Cheese application and it works but QCameraInfo::availableCameras() returns nothing.
I don't know if this is a definitive answer, but in my experience the dreaded "camera service is missing" comes down to exactly what the message says; for some reason the media back-end that Qt uses to get video input from a camera is broken or miss-configured in some way. In my case I had this problem in the following situations:
1. Building Qt from source
Qt build system SILENTLY DISABLES FEATURES if you don't have all the dependencies that it requires to include them in the build. Make sure to read this official article very carefully for your platform. I lost count of the times this has ruined my <insert favourite period of time such as day/week/year here >, and not only for the multimedia module...
2. Missing some gstreamer packages on my Ubuntu
I develop for Linux & Debian mostly, and on those platforms Qt depends on gstreamer backend. gstreamer is basically a plugin architecture in the core with every single feature added as plugins, and with endless possibilities of manual intervention through configuration files. See where is this is going? Clue: make sure you have all the plugins you want installed and configured properly. Here is a link to some gstreamer tools you can use. Same probably goes for other back-ends on other platforms.
And a pro tip in the end: Since both Qt5.5 gstreamer0.1 (old) and gstreamer1.0 (new) are supported as back-ends, and since Qt5.6 the new one is default. This will give you some room for experimenting, for example if the old does not work, you can try the new etc.
Hope this was useful!

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.