QT 5.2 app cannot start (Bad allocation error) when Qt5Core.dll is in app directory - windows

I have a funny problem on my machine
Windows 7 x64, using QT 5.2 for the GUI
I'm not able to start the app I always receive the error
First I thought I had a broken dll, so through some trial and error I found a solution:
I add the QT5Core.dll via enviroment path, and NOT directly to the app folder. Then the programm works. If I copy the dll back to the app Folder, Same problem as before!?!?!?1
I'm really confused, because the error only occurs on my machine?
Debugging doesn't really help,
In code, the error occures here:
MyApplication::MYApplication(int argc, char** argv, int version)
: QApplication(argc, argv, version) // <<< this call fails!
{ }
somebody can help me?
Why is the location of the qt5core.dll a problem?!?!?
UPDATE
I used the profiling function of depends and found the following behaviour:
Failing
GetProcAddress(0x76800000 [c:\windows\syswow64\KERNEL32.DLL], "CreateSymbolicLinkW") called from > "dirone\xxxx.EXE" at address 0x00FF2877 and returned 0x7688CCE9.
First chance exception 0xE06D7363 (Microsoft C++ Exception) occurred in "c:\windows\syswow64\KERNELBASE.DLL" at address 0x765CC41F.
Exception: "bad allocation"
Working
LoadLibraryW("C:\BuildPackages\QT\plugins\platforms\qwindows.dll") called from "dirtwo\QT5CORE.DLL" at address 0x66AA5154.
Loaded "c:\buildpackages\qt\plugins\platforms\QWINDOWS.DLL" at address
0x0F380000. Successfully hooked module.
somehow the path to the qwindows.dll is hardcoded into the dll (there is no environment path to this directory)
If I rename the qwindows.dll or delete it, startup failes again.
BUT the qwindows.dll is bundeld with our product. It is in a subdirectory ./platforms/
AND the files are the same (diff returns equal)
Somebody have some clue what I should try next?

Check if you already have some qt related environmental variables.
Crashes are usually due to this, remove those envronmental variables first. Check whether you have any other qt installed libraries.
it would be better if you can post the cal stacks.

Some other dlls are needed that reside in the directory of the qt5core.dll. When you add this path to the search path the dlls are found. When you simply copy the dll these dlls can not be found. You can check dependencies with the depends tool.
Candidates for the additional dlls are:
icuin51.dll and icuuc51.dll

Found the Problem:
The enviromentvariable:
QT_QPA_PLATFORM_PLUGIN_PATH=C:\BuildPackages\QT\plugins\platforms
was set to the path. If removing this variable, everything works as it should!

Related

psqlodbc driver not found on heroku despite being in my app directory

I am trying to get RODBC to work on heroku. I have a rails app that calls an R script from RinRuby, which then queries the production database in order to do some analysis. It all works fine on my local Mac, so I thought the best approach was to use the binary compiled on my Max (psqlodbcw.so) into my repo, and reference it in production as well. Unfortunately, when I try to make the connection in production using this connection string:
> library(RODBC)
> dbhandle <- odbcDriverConnect('driver=./psqlodbcw.so;database=nw_server_production;trusted_connection=true;uid=nw_server')
Warning messages:
1: In odbcDriverConnect("driver=./psqlodbcw.so;database=<db_name>;trusted_connection=true;uid=<user>") :
[RODBC] ERROR: state 01000, code 0, message [unixODBC][Driver Manager]Can't open lib './psqlodbcw.so' : file not found
2: In odbcDriverConnect("driver=./psqlodbcw.so;database=<db_name>;trusted_connection=true;uid=<user>?") :
ODBC connection failed
I have seen this error in a similar post online here, but using SQL server instead of postgres. But the accepted answer on that post doesn't explain why the file isn't found, despite being in the app directory. I did follow the same approach and made my own custom buildpack (available here: https://github.com/NovaWulf/r-rodbc-buildpack). I replaced the .so file with the one I compiled on my mac, and simply deleted the .rll file and the code that copies it, since I don't have that file (and hopefully don't need it for psqlodbc?). When I run that buildpack it runs without error on heroku, but then when I reference the .so file copied from the buildpack, I get the same "file not found" error.
Is this happening because the .so file was compiled on the wrong system architecture? I tried compiling psqlodbc on linux, but I do not get a psqlodbcq.so file when I do that (let alone an .rll file). The closest thing I get is a file called libodbcpsqlS.so, which is a setup file, not a driver file.
Could someone please help me understand the best approach to this problem? Why is heroku not seeing the file that is not there? And what is the best solution? Is there a simple way to just download the correct driver file somewhere?
Any help is much appreciated!
Best,
Paul

Trouble Creating and Executing an Intel SGX Enclave

I'm very new to SGX and wanted to start with something simple. Fortunately, I found this very basic tutorial. Unfortunately, as simple as it is, I can't get it to work. The code executes, but there are errors in the output.
[sgx_create_enclavew ..\urts\win\urts.cpp:195] Couldn't open file with CreateFile()
error 0x200f, failed to create enclave.
Buffertests:
Buffer before change: Hello World!
Buffer after change: Hello World!
Stringtests:
Returned Secret:
Saved Secret: My secret string
Load Secret:
Integertests:
secretIntValue first load: 0
saved a 1337 to the enclave.
secretIntValue second load after 1337 was saved: 0
error, failed to destroy enclave.
image of output
the tutorial says:
If you get the error SGX couldn't find the enclave file. The solution is to move the enclave_test_save.signed.dll into the same folder where the app_test_save.exe is located.
which I've tried, but it didn't solve the problem.
when I try to create the enclave using:
sgx_create_enclave(ENCLAVE_FILE, SGX_DEBUG_FLAG, &token, &updated, &eid, NULL);
it returns: SGX_ERROR_ENCLAVE_FILE_ACCESS
could the problem be a result of using a different version of Visual Studio? (The tutorial uses VS 2012, while I'm using VS 2015)
Did you run the application through command prompt or from IDE?
If you are using IDE, You need to change the debugging properties to $(OutDir) from $(ProjecttDir) under Project Properties->Configuration Properties->Debugging->Working Directory.(Both Enclave and Application) Select the Intel(R) SGX Debugger.
Disclaimer: I had the same error although under a different setting (Ubuntu, eclipse) so I am not sure to what extent this will help.
Before initialize_enclave() is called (which in turn calls sgx_create_enclave()), a chdir(absolutePath) command needs to be executed, where absolutePath needs to be the absolute path to where your executable is.
My error was due to a wrong path I used.
Thanks, I solved it. turns out I had to place enclave_test_save.signed.dll in the root folder with the .edl file and not with the .exe file.

Qt 5.3.1: macdeployqt tries to include everything on my hard drive; how to fix?

I'm running Qt 5.3.1 on Mac OS X 10.8 and 10.9 I'm trying to use the macdeployqt tool to bundle libraries and plugins with my executable, but it's apparently trying to include everything on my hard drive.
I invoke it with:
/Applications/Qt/5.3.1/5.3/clang_64/bin/macdeployqt /Users/adamwilt/Desktop/temp/DesktopPixie.app -verbose=2
-qmldir=/Users/adamwilt/Desktop/temp/DesktopPixie.app/Contents/Resources/qml/DesktopPixie
and get lots of normal, expected log messages like:
Log: copy: "/Applications/Qt/5.3.1/5.3/clang_64/qml/QtQuick/Controls/Styles/Base/images" "/Users/adamwilt/Desktop/temp/DesktopPixie.app/Contents/Resources/qml/QtQuick/Controls/Styles/Base/images"
...and all runs fine until I start getting messages like:
Log: copy: "" "/Users/adamwilt/Desktop/temp/DesktopPixie.app/Contents/Resources/qml/MessageBoxUI/Enums"
ERROR: file copy failed from "/do-gst"
ERROR: to "/Users/adamwilt/Desktop/temp/DesktopPixie.app/Contents/Resources/qml/MessageBoxUI/Enums/do-gst"
ERROR: file copy failed from "/rescuepro.properties"
ERROR: to "/Users/adamwilt/Desktop/temp/DesktopPixie.app/Contents/Resources/qml/MessageBoxUI/Enums/rescuepro.properties"
ERROR: file copy failed from "/rescuepro34act.lic"
and then the fun begins:
Log: copy: "/Applications" "/Users/adamwilt/Desktop/temp/DesktopPixie.app/Contents/Resources/qml/MessageBoxUI/Enums/Applications"
Log: copied: "/Applications/License.rtf"
Log: to "/Users/adamwilt/Desktop/temp/DesktopPixie.app/Contents/Resources/qml/MessageBoxUI/Enums/Applications/License.rtf"
Log: copy: "/Applications/0xED-1.0.7.app" "/Users/adamwilt/Desktop/temp/DesktopPixie.app/Contents/Resources/qml/MessageBoxUI/Enums/Applications/0xED-1.0.7.app"
It appears it's trying to copy everything (that is, "") into the app, but I ^C out of it while I still have disk space left!
It didn't do this at first; then it did so for a week; then it stopped; now it's back. This is a distributed development project; I'm doing the QML stuff and folks elsewhere are doing the C++. It's possible the other folks are changing a configuration somewhere that's causing this to occur, but I'm the only one doing Mac deployments, so I'm the only one who sees this.
Is there a config file of some sort for macdeployqt where this might be getting triggered? Or is it more likely a problem related to the C++ object MessageBoxUI, which defines several Q_ENUMs (apparently correctly, as it compiles without warnings or errors, and appears to run properly), since that's the target directory when it starts going mad?
Sussed it (well enough that I can go on):
The Qt app I'm trying to deploy lives in ~/Desktop/temp. If I set my current directory to ~/Desktop or ~/Desktop/temp before I run macdeployqt, it runs as expected.
If I run it from from my home directory ~, or ~/Documents, macdeployqt tries to pull in everything it finds in /Applications, /opt, and/or other directories unassociated with the app.
Setting cwd to most other paths, including ~/Downloads, /Applications, subdirectories of ~/Documents, etc. also seems to work; it's only running macdeployqt from ~ and ~/Documents that causes the problem.
No proper explanation as to why this is happening, but just a warning in case someone else sees this sort of weird behavior: try changing to the apps's location before running macdeployqt.

F# Microsoft.ParallelArrays not defined

So I downloaded and installed Microsoft Accelerator v2 to use ParallelArrays. I have referenced it in my project but when I try and execute the code from the module in a script file I get:
"The namespace 'ParallelArrays' is not defined
I have followed the instructions on this post:
Microsoft Accelerator library with Visual Studio F#
I've added a reference to the managed version "Microsoft.Accelerator.dll" to my F# project and then added the native "Accelerator.dll" as an item in my solution and set it's 'Copy To Output Directory' to Copy Always.
Still getting the FSI error and inline error in my script file on the '#load ...' line, however the solution builds fine, and no error in the module file.
Any ideas on what I'm missing? I'm sure it's something stupid.
Thanks,
Justin
UPDATE
I tried mydogisbox's advice, which got rid of the error above, but now when I run the code in the .fsx file I get this error instead:
--> Referenced 'F:\Work\GitHub\qf-sharp\qf-sharp\bin\Debug\Microsoft.Accelerator.dll' (file may be locked by F# Interactive process)
[Loading F:\Work\GitHub\qf-sharp\qf-sharp\MonteCarloGPU.fs]
error FS0192: internal error: F:\Work\GitHub\qf-sharp\qf-sharp\Accelerator.dll: bad cli header, rva 0
UPDATE 2
So the bad header error has dissapeared, but now I get this instead:
Microsoft.ParallelArrays.AcceleratorException: Failure to create a DirectX 9 device.
at Microsoft.ParallelArrays.ParallelArrays.ThrowNativeAcceleratorException()
at Microsoft.ParallelArrays.DX9Target..ctor()
at <StartupCode$FSI_0002>.$FSI_0002_MonteCarloGPU.main#() in F:\Work\GitHub\qf- sharp\qf-sharp\MonteCarloGPU.fs:line 14
Stopped due to error
I found this thread on MSDN however the answers proposed as fixes on that thread barely even relate to the question.
http://social.msdn.microsoft.com/Forums/vstudio/en-US/98600646-0345-4f62-a6c5-f03ac9c77179/ms-accelerator?forum=csharpgeneral
My Direct X version is 11, and I imagine that will suffice, however I tried installing DX9 however, it tells me that a newer version is detected therefore cant install.
There are special directives for referencing dlls from fsi. The #load directive loads the .fs file only. You need to use the #r directive to reference the file. You can either use the full path of the file or you can use #I to include the path to the file. More details here. Keep in mind that fsi is completely independent of your project, so all references in your project must be duplicated in fsi for it to access the same types.

EmguCV 'Emgu.CV.CvInvoke' Exception

I have installed EmguCV 2.4.2.1777. I have a 32-bit windows 7 so I installed it using the installer. Now I am trying to write a simple code to capture a webcam's video in a window in C#.
The problem is after during execution I am getting the following famous error:
A first chance exception of type 'System.DllNotFoundException' occurred in Emgu.CV.dll
A first chance exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll
An unhandled exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll
The file Emgu.CV.dll is present in the folder. I don't understand why its giving that error.
I tried all the checks which are suggested by fellow stackoverflow users and also many other references:
1) Installed MSVCR: MSVCRT 10.0 SP1 x86
2) copied the OpenCV dlls to the execution directory
3) I also have a 32-bit OS. So that also should'nt be an issue.
But when I checked for dependencies, I faced a problem:
I used DependecyWalker to open cvextern.dll and found the following dependencies missing:
NVCUDA.DLL
API-MS-WIN-CORE-COM-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL
DCOMP.DLL
IESHIMS.DLL
It also gave the following:
Error: At least one required implicit or forwarded dependency was not found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
Please help me out with the exception. Thanks in advance.
I copied all the dll files from C:\Emgu\emgucv-windows-universal-gpu 2.4.9.1847\bin\x86 to a folder called includes in my project and updated the "Copy To Output Directory" Option for these DLLs to "Copy Always" and it got rid of this issue.

Resources