How to fix "SDL_Init failed -1" in buildroot Raspberry image? - sdl

I'm trying to compile Navit for Raspberry Pi 3 with Buildroot image (WPE Framework included). There is only WPE Framework running on startup (no x server) therefore I would like to display Navit using framebuffer directly. I know there is support for this feature. I have configured Navit as follow:
https://i.stack.imgur.com/cDZ3O.png
but I'm not able to run it anyway. There is following error:
error:graphics_sdl:graphics_sdl_new:SDL_Init failed -1
I've installed SDL from buildroot. How to fix it or make SDL more verbose to find out what is the reason of this -1 error (missing dependencies, incompatible lib version, Navit configration problems, missing system variables pointing to specified dependencies)?

It turned out that Navit is very quiet about SDL error messages. -1 Error is just very general information... I had to recompile Navit sources and add SDL_GetError() function to code to find out what is a real reason.
The problem was missing mouse. I don't need it so I had to set up:
export SDL_NOMOUSE=1

Related

Fatal error: debugger does not support channel locks

I am trying to use ocamldebug with my project, to understand why a 3rd party lib I'm using is not behaving the way I expected.
https://ocaml.org/manual/debugger.html
The OCaml debugger is invoked by running the program ocamldebug with the name of the bytecode executable file as first argument
I have added (modes byte exe) to my dune file.
When I run dune build I can see the bytecode file output, alongside the exe, as _build/default/bin/cli.bc
When I pass this to ocamldebug I get the following error:
ocamldebug _build/default/bin/cli.bc
OCaml Debugger version 4.12.0
(ocd) r
Loading program... done.
Fatal error: debugger does not support channel locks
Lost connection with process 33035 (active process)
between time 170000 and time 180000
Restart from time 170000 and try to get closer of the problem ? (y or n)
If I choose y the console seems to hang indefinitely.
I found the source of the error here:
https://github.com/ocaml/ocaml/blob/f68acd1a618ac54790a8347fad466084f15a9a9e/runtime/debugger.c#L144
/* The code in this file does not bracket channel I/O operations with
Lock and Unlock, so fail if those are not no-ops. */
if (caml_channel_mutex_lock != NULL ||
caml_channel_mutex_unlock != NULL ||
caml_channel_mutex_unlock_exn != NULL)
caml_fatal_error("debugger does not support channel locks");
...but I don't know what might be triggering it.
My project is using cmdliner and lwt ...I think at this early point of execution it hasn't hit any lwt code though.
Is ocamldebug incompatible with cmdliner?
If that's the case then I will need to make a new entrypoint just for debugging I guess. (currently the bin/cli is the only executable artefact in my project, the code I need to debug is all under lib/s)
It looks like that the OCaml debugger is broken for your version of macOS. Please, report the issue to the OCaml issue tracker including the detailed information on your system. I can't reproduce it on my machine, but I am using a pretty old version of macOS (10.11.6) and I have the 4.12 debugger working flawlessly.
As a workaround, try using an older version of OCaml, as this channel lock test was introduced very recently you can install any version prior to 4.12,
opam switch create 4.11.0
eval $(opam env)
Then, do not forget to rebuild your project (previously installing the required dependencies),
opam install lwt cmdliner
dune build
and then you can use the debugger to your taste.

dlib object detection always return zero results on iOS

I have been using dlib object detection successfully on mac. Now I want to use it in an iOS app. However, after spending countless hours, dlib object detector always returns zero rectangles.
ifstream fin(dataDir + "/object_detector.svm", ios::binary);
typedef dlib::scan_fhog_pyramid<dlib::pyramid_down<6> > image_scanner_type;
dlib::object_detector<image_scanner_type> detector;
dlib::deserialize(detector, fin);
vector<dlib::rectangle> dets = detector(dlibImage);
To make sure it’s not due to a different image, I am using exact same image for which detector returns 1 hit on mac. I have also printed uchar from part of the image in both mac and iOS, and it’s returning same values. So image data is exactly the same.
Probably dlib library is not built correctly for iOS. I have tried multiple approaches for this. From /example/build dir, below command was invoked.
cmake -G Xcode ..
cmake --build . --config Release
It generated dlib.xcodeproj project in dlib_build dir. I opened the project in xcode, changed architecture to iOS (armv7, arm64) and rebuild the library. This library was linked to my project. I got zero results with this approach. dlib was built in debug mode; I did not get any assertion errors.
Second approach tried was to use dlib/all/source.app in my project. I used all the proprocessing flags that are used by cmake or dlib.xcodeproj project. No errors, but still no matches.
I have compared build settings of my xcode project with examples.xcodeproj generated by cmake and it’s same. Also checked the xcode project from https://github.com/zweigraf/face-landmarking-ios, but no help.
Strange thing is detector takes couple of seconds to process and comes back with zero matches. So it’s doing something. I wish there was a debug logging that I can turn on for the detector.
I am out of ideas. Will appreciate if anyone can help. dlib is a wonderful library, I just wish it would have been easier to work with on iOS.
dlib is working fine on iOS too. Kicking myself for it, but I mixed up the detector instances. The detector on which I called below line was not used for object detection.
dlib::deserialize(detector, fin);
I was just using an empty detector instance, and it was returning 0 detections. By empty detector, I mean it was defined but deserialize method was not invoked. It would have been nice if dlib returned an error or warning, if a detector not loaded with object_detector.svm file is used for detection.
I have observed the same behavior with shape detector too. If sp.dat is not loaded, it silently reports 0 parts detected. Posting this as answer, in case someone else also makes such a silly mistake.

OpenCV 3.0 install WITH_OPENCL_SVM=ON on Machine with OpenCL 1.1

So I installed OpenCV WITH_OPENCL_SVM=ON thinking that I was going to eventually get a GPU with OpenCL 2.0 on it (currently only 1.1.) However now when I try to run any programs with OpenCV I get an
Error on line 2629 (ocl.cpp): CL_DEVICE_SVM_CAPABILITIES via clGetDeviceInfo failed: -30
I believe when I create a cv::UMat. The line of code in ocl.cpp is dependent on HAVE_OPENCL_SVM being defined, I assume it then does a check for the SVM capability and fails that check because I don't have 2.0. I tried:
#undef HAVE_OPENCL_SVM
in my code and modifying cvconfig.h (honestly don't know how/when that file is referenced) so that it is not defined as well as un-defining it there again... and the error persists.
Thanks!

Exe built using pyinstaller on a Django with pylucene app giving JVM error

I am getting an error:
"Error occurred during initialization of VM
Unable to load native library: Can't find dependent libraries"
The error arises when I try to execute my exe file.
I have created exe file through pyinstaller on a django application. Application uses pylucine library. I think it may be the issue of error.
How to fix the error?
Since I can't be certain given you've provided very few details here is a shot in the dark to help solve your problem:
First, try removing the jvm.dll file that gets packaged with the pyinstaller -D youmodule.py command (for now work with the directory command rather than -F option). The reason why is here.
With that jvm.dll file gone, you should start seeing the actual error code - and with that the java class or dependency that isn't being loaded.
If it's a java class that isn't being properly loaded then you know instantly it must not be correcly represented in the classpath environment variable and you should do everything in your power to make sure it is:
e.g.: os.environ['CLASSPATH'] += 'the/path/to/the/jar'
Otherwise, consider bulking up your question with more details, especially if you can get a more meaningful error output.
I had the same error trying to run a .exe built with PyInstaller through wine.
My problem went away by adding C:\Program Files\Java\ [your jdk version here] \jre\bin\server to the PATH environment variable in wine - I suppose it might be the same in Windows.
It also reappeared if I tried to build with C:\Program Files\Java\ [your jdk version here] \jre\bin\server in my PATH, so I had to build without it and then append it before running it (I have no explanation as to why this happens).

:-1: error: Automatic patching failed at C:\QtSDK\Symbian\SDKs\Symbian1Qt473\bin\createpackage.pl line 357

I've installed Qt SDK 1.2.1, and when I'm building one of the example applications - Haptics Player, for Symbian S60, using Qt 4.7.3.
The example compiles successfully, but it fails on the Deploy step. This is the compiler output:
ERROR: Automatic patching failed at C:\QtSDK\Symbian\SDKs\Symbian1Qt473\bin\createpackage.pl line 357.
make[1]: *** [ok_sis] Error 2
C:\QtSDK\Symbian\SDKs\Symbian1Qt473\epoc32\tools\make.exe: *** [sis] Error 2
01:38:16: The process "C:\QtSDK\Symbian\SDKs\Symbian1Qt473\epoc32\tools\make.exe" exited with code 2.
Error while building project hapticsplayer (target: Symbian Device)
When executing build step 'Create SIS Package'
However, a newly created, empty project runs on my phone successfully, i.e. this error happens in the Example project that ships with Qt SDK, but not for a newly created project.
How do I fix this error?
Upon closer inspection of the compiler output, I noticed this:
Patching: Executable with capabilities incompatible with self-signing detected: "hapticsplayer_patched_caps.exe". (Incompatible capabilities: "ReadDeviceData", "WriteDeviceData".) Reducing capabilities is only supported for libraries.
Patching: Unable to patch the package for self-singing.
Use a proper developer certificate for signing this package.
Apparently, the capabilities WriteDeviceData and ReadDeviceData can't be used for self-signed packages, and require a proper developer's certificate (which is not free, and I don't have it).
Removing those lines from the .pro file fixed the problem, and Haptics Player now compiles:
symbian: {
TARGET.CAPABILITY = WriteDeviceData ReadDeviceData
}
It seems it does not really need those capabilities, I have no idea why they were added. Probably an oversight.