Qt Release application with PSQL database - error on loading driver - windows

With QtCreator (for version 57) I created simple application that connects to DB and waits for notifications. There isn't realy much code for it and all of it works on LINUX:
MyDataBase = new QSqlDatabase(QSqlDatabase::addDatabase("QPSQL", "Main"));
Unfortunetly after transitioning from Linux to Windows (on which app will by mainy used) I encounteredd some issues. As usuall, missign dlls, but those were quick fast (copy-paste given .dll). Now I can't run this still on Windows, because it refuses to connect to db. With system's variable I managed to find more. Now even when I see error I can't even grasp what else could I do to make it work:
Found metadata in lib C:/_Qt/5.7/mingw53_32/plugins/sqldrivers/qsqlpsqld.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QPSQL7",
"QPSQL"
]
},
"className": "QPSQLDriverPlugin",
"debug": true,
"version": 329472
}
"The plugin 'C:/_Qt/5.7/mingw53_32/plugins/sqldrivers/qsqlpsqld.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "D:/QT_Notifi/build-Notifier-Desktop_Qt_5_7_0_MinGW_32bit-Release/release/sqldrivers" ...
loaded library "C:/_Qt/5.7/mingw53_32/plugins/sqldrivers/qsqlpsql.dll"
QLibraryPrivate::loadPlugin failed on "C:/_Qt/5.7/mingw53_32/plugins/sqldrivers/qsqlpsql.dll" : "Cannot load library C:\\_Qt\\5.7\\mingw53_32\\plugins\\sqldrivers\\qsqlpsql.dll: %1 is not correct application of Win32."
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

Related

Problems debugging mserver5

I have recently started debugging the mserver5 application using vscode and a very comfy plugin for cmake called CMake Tools. Moreover, I am using gcc 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) as a compiler together with the following launch.json debug configuration for mserver5 in vscode:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) mserver5 triangleDB",
"type": "cppdbg",
"request": "launch",
// Resolved by CMake Tools:
"program": "${command:cmake.launchTargetPath}",
"args": ["--dbpath=/home/mledl/dbfarm/triangleDB", "--set", "mapi_port=0"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build",
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "$PATH:${command:cmake.launchTargetDirectory}"
},
],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{ "description":"In this mode GDB will be attached to both processes after a call to fork() or vfork().",
"text": "-gdb-set detach-on-fork off",
"ignoreFailures": true
},
{ "description": "The new process is debugged after a fork. The parent process runs unimpeded.",
"text": "-gdb-set follow-fork-mode child",
"ignoreFailures": true
}
]
}
]
}
The database I am connecting to (here triangleDB) has been created within a dbfarm using the monetdb application and I am going to connect to it using the mclient application with the default username and password combination monetdb. I can successfully connect to and query my triangleDB when starting it using the monetdb application withing a running dbfarm.
When starting up the mserver5 for debugging from vscode using the above launch.json file and connecting to it using mclient and the monetdb user I cannot authenticate somehow and get the following error printed to the mserver5 logs:
client1: createExceptionInternal: !ERROR: InvalidCredentialsException:checkCredentials:invalid credentials for user 'monetdb'
Does anybody know why mserver5 cannot retrieve the default user? Does it rely on the deamon monetdbd to retrieve the user data from? Can someone tell me what I am missing or how I can efficiently debug the mserver5?
Another point is that I need to set mapi_port=0 in order to make mserver5 bind to available ports since it is opening two mapi connections somehow when debugging with vscode and CLion. The application crashes when using a specific port since the second binding attempt will be on an already use address. The following section shows that two connections are opened when debugging:
# MonetDB 5 server v11.40.0
# This is an unreleased version
# Serving database 'triangleDB', using 24 threads
# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
# Found 31.349 GiB available main-memory of which we use 25.549 GiB
# Copyright (c) 1993 - July 2008 CWI.
# Copyright (c) August 2008 - 2021 MonetDB B.V., all rights reserved
# Visit https://www.monetdb.org/ for further information
# Listening for connection requests on mapi:monetdb://localhost:46093/
# Listening for connection requests on mapi:monetdb://localhost:40387/
Thanks in advance for everybody that can help me out on this one. Looking forward to hearing from you and sty safe everyone.
If your database was created using monetdb and you want to start it directly using mserver5, you need to tell mserver5 where the .vaultkey is.
In you dbfarm, do a grep monet_vault_key merovingian.log, copy the whole --set monet_vault_key=/<path-to>/dbfarm/demo/.vaultkey and add this option to the start-up command of your mserver5.
I am giving an additional answer here, because I want to make clear what I had to do in order to debug the mserver5 using vscode and interact with it using the mclient application.
While trying to figure out why certain modules/libraries could not be loaded, I noticed that the GDK kernel is missing an environment variable called monet_mod_path which can be set using the --set monet_mod_path=/usr/local/lib/monetdb5 option for mserver5. The missing monet_mod_path has also been the reason why mserver5 listened on two addresses for a mapi connection.
I am now using the following command to start mserver5 for debugging:
mserver5 --dbpath=/home/mledl/dbfarm/triangleDB --set monet_vault_key=/home/mledl/dbfarm/triangleDB/.vaultkey --set monet_mod_path=/usr/local/lib/monetdb5 --set gdk_nr_threads=24 --set max_clients=64 --set sql_optimizer=default_pipe
A minimal working configuration would be the following one:
mserver5 --dbpath=/path/to/your/db --set monet_vault_key=/path/to/your/db/.vaultkey --set monet_mod_path=/usr/local/lib/monetdb5
Note: I installed the application into default installation directory. If you choose a custom one the monet module path has the following pattern:
monet_mod_path=/path/to/install/lib/monetdb5
I hope this answer will help someone in the future and saves all the investigation time I had to put in.

Cannot activate rust-analyzer: bootstrap error

Starting 2020-12-09, VSCode's Rust Analyzer extension no longer loads for me. On launch, it prints out this error message:
Cannot activate rust-analyzer: bootstrap error. See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). To enable verbose logs use { "rust-analyzer.trace.extension": true }
Enabling extension tracing produces the following diagnostic just before failing:
INFO [12/10/2020, 10:03:22 AM]: Using server binary at c:\Users\<user>\AppData\Roaming\Code\User\globalStorage\matklad.rust-analyzer\rust-analyzer-windows.exe
DEBUG [12/10/2020, 10:03:22 AM]: Checking availability of a binary at c:\Users\<user>\AppData\Roaming\Code\User\globalStorage\matklad.rust-analyzer\rust-analyzer-windows.exe
DEBUG [12/10/2020, 10:03:22 AM]: c:\Users\<user>\AppData\Roaming\Code\User\globalStorage\matklad.rust-analyzer\rust-analyzer-windows.exe --version: {
status: 3221225506,
signal: null,
output: [ null, '', '' ],
pid: 1648,
stdout: '',
stderr: ''
}
where <user> is the name of the user account I use to log into the system1.
The status value reported in the error diagnostic (3221225506) translates to 0xC0000022 (STATUS_ACCESS_DENIED). Navigating to the binary from within VSCode's integrated terminal and trying to execute rust-analyzer-windows.exe --version doesn't produce any output, which seems to reinstate that running this executable from VSCode is somehow blocked.
It appears that something changed with respect to access rights executing the server binary from within VSCode. In between Rust Analyzer working and Rust Analyzer no longer working I didn't update Rust, nor rustup, nor VSCode, nor any extensions.
I did install 2020-12 Cumulative Update for Windows 10 Version 20H2 for x64-based Systems (KB4592438), though, and the time Rust Analyzer started failing coincides with the time the update got installed. That could literally just be a coincidence.
What additional steps can I take to get to the root cause of the issue, and how do I get Rust Analyzer working again?
Version information:
Rust Analyzer (stable): v0.2.408
Windows 10 Pro: Version 10.0.19042 Build 19042
VSCode: 1.51.1 (user setup)
1 This is also the user account VSCode runs under, including all of its spawned processes. Navigating to the path from a command prompt running under this account reveals that rust-analyzer-windows.exe is present, and executing rust-analyzer-windows.exe --version prints a version identifier, as expected.
Unfortunately, I didn't quite get to investigate the root cause of this.
A system reboot that was forced upon me appears to have restored World Peace.
Clearing proxy config works for me.
I'm not sure this covered all situation, but it might be related to the network.

How to install DNX Secret Manager in Mac OSX

I'm developing with ASP.NET5 on Mac OS X. I want to implement OAuth and use Secret Manager to store my secret configuration, so I'm following this DNXSecret Configuration page.
https://github.com/aspnet/Home/wiki/DNX-Secret-Configuration
But, after following the instructions, I couldn't successfully install user-secret command to my Mac, and I'm pretty much stuck.
As the first step, I installed DNVM and confirmed dnvm list command returns Mono as the runtime engine.
$ dnvm list
Active Version Runtime Arch Location Alias
------ ------- ------- ---- -------- -----
* 1.0.0-beta4 mono ~/.dnx/runtimes default
I also installed Yeoman, Grunt, Bower etc, and dnu restore command worked fine. I successfully showed a Yeoman scaffolded ASP.NET5 page both locally and on Azure.
Then I started to install Secret Manager, following the above page. In the beginning, the following command failed:
dnu commands install SecretManager
with the error below:
Errors in /Users/<username>/.dnx/bin/packages/SecretManager/1.0.0-beta4/app/project.json
Unable to locate SecretManager >= 1.0.0-beta4-10173
So, I modified the above 'project.json' file in its "dependencies" block as:
{
"version": "1.0.0-*",
"description": "ASP.NET 5 tool to manage user secrets.",
"dependencies": {
"SecretManager": "1.0.0-beta4" // <<- modified here
//"SecretManager": "1.0.0-beta4-10173"
},
"commands": {
"user-secret": "SecretManager"
},
"userSecretsId": "testuserSecretsId",
"frameworks": {
"dnx451": {},
"dnxcore50": {
"dependencies": {
"System.Console": "4.0.0-beta-*"
}
}
},
"entryPoint": "SecretManager",
"loadable": false
}
(before) "SecretManager": "1.0.0-beta4-10173"
(after) "SecretManager": "1.0.0-beta4"
Then the command finished successfully and SecretManager seems to be installed with the result below:
konishis-air:AspNetSocialLoginTest Ryuji$ dnu commands install SecretManager
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='SecretManager'.
OK https://www.nuget.org/api/v2/FindPackagesById()?Id='SecretManager' 1674ms
Restoring packages for /Users/Ryuji/.dnx/bin/packages/e27d166dcf594105be47fff78420df10/project.json
Writing lock file /Users/Ryuji/.dnx/bin/packages/e27d166dcf594105be47fff78420df10/project.lock.json
Restore complete, 246ms elapsed
Restoring packages for /Users/Ryuji/.dnx/bin/packages/SecretManager/1.0.0-beta4/app/project.json
GET https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Console'.
OK https://www.nuget.org/api/v2/FindPackagesById()?Id='System.Console' 1395ms
Writing lock file /Users/Ryuji/.dnx/bin/packages/SecretManager/1.0.0-beta4/app/project.lock.json
Restore complete, 1751ms elapsed
The following commands were installed: .project.json, user-secret
However, when I run user-secret command, I get 'command not found'.
Sorry, that is a known issue and we've fixed in beta5.
You have two options:
Pass the fallback source: dnu commands install secretmanager 1.0.0-beta4 -f https://www.myget.org/F/aspnetrelease/api/v2
Update to the latest beta5 bits

Unable to compile Firefox OS

Sorry about the vagueness of the question title, but I've been having problems compiling Firefox OS and am unsure where to turn (I know there's Bugzilla but I'm not sure if what I'm experiencing is a bug or not)
Basically, I've been trying to compile the latest Firefox OS from source using the official instructions. I'm trying to build a system that supports the languages en-GB, en-US and tr (with en-GB as the default). My .userconfig is as follows:
export MAKE=
export CC=gcc-4.6
export CXX=g++-4.6
VARIANT=user
# GAIA l10n
export GAIA_DEFAULT_LOCALE="en-GB"
export LOCALE_BASEDIR="$PWD/locales"
export LOCALES_FILE="$PWD/locales/languages_some.json"
export GAIA_KEYBOARD_LAYOUTS="en,tr"
# Gecko l10n
export L10NBASEDIR=$PWD/gecko-locales
export MOZ_CHROME_MULTILOCALE="en-GB tr"
export PATH="$PATH:$PWD/compare-locales/scripts"
export PYTHONPATH="$PWD/compare-locales/lib"
The contents of languages_some.json is as follows:
{
"en-GB" : "English (GB)",
"en-US" : "English (US)",
"tr" : "Türkçe"
}
compare_locales contains an unmodified clone of this repo, and gecko-locales contains clones of en-GB and tr locales from the official repository (there is no 'en' or 'en-US' repository).
Now, I'm not 100% sure where the error is. I have tried searching Google for any suspect lines, but nothing has come up.
I have posted full output as a GitHub Gist. Suspect lines as far as I can tell (this is my first time compiling either Firefox or a mobile phone OS) are:
2015-03-16 16:43:12: stackwalker.cc:125: INFO: Couldn't load symbols for: |
2015-03-16 16:43:12: basic_code_modules.cc:88: INFO: No module at 0x2ab95ac94aa0
(then followed by a lot of 'No module at ...' errors)
also
System JS : ERROR file:///opt/src/B2G/gaia/b2g_sdk/34.0a1-2014-08-12-04-02-01/b2g/components/nsHandlerService.js:120 - NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIProperties.get]
This error is repeated a fair few times throughout the code, but I can't tell if it's harmless or if it's stopping the build.
There's also a bunch of lines about missing translations, but I imagine they're just harmless. I have tried to cut them down as much as possible (by adding the missing translations) but the problem persists.
Oh yes, and in case someone asks, I have been running with my phone plugged in, and it is visible on adb devices. I have also tried removing the out and backup-inari directories.
System specs, PC:
Debian Sid, mostly up-to-date, but running with an old version of make (build refuses to run on any version newer than 3.8)
GCC 4.6 and 4.9. export CC=gcc-4.6 set in .userconfig
G++ 4.6 and 4.9. export CXX=g++-4.6 set in .userconfig
Phone:
Original ZTE Open. This originally came with FFOS 1.0, but I have since upgraded to 1.1 by flashing the official ROM.

How to debug OpenERP / Odoo properly?

I am using pdb.set_trace() as a breakpoint in my python function during Odoo development and I keep getting the log messages.
pdb.set_trace()
-> if s['confirm_state'] in ['draft','confirmed']:
(Pdb) 2015-04-05 05:40:12,794 9981 INFO vvm_odoo_new werkzeug: 127.0.0.1 - - [05/Apr/2015 05:40:12] "POST /longpolling/poll HTTP/1.1" 200 -
2015-04-05 05:40:47,769 9981 INFO vvm_odoo_new werkzeug: 127.0.0.1 - - [05/Apr/2015 05:40:47] "POST /longpolling/poll HTTP/1.1" 200 -
I first thought that it was because of the instant messaging feature and so I un-installed it. But I still keep getting this message.
This does not stop me from using the pdb stack trace but the problem here is that this terminal message keeps showing up in between the typing in the pdb trace point.
You can add the --logfile=<logfile> to the parameters when you launch Odoo - which will send standard Odoo log messages to that file, with the debugger log left nice and clean.
i.e. I have a bash script in /usr/local/bin which calls:
python /path/to/odoo/odoo.py --addons-path=/path/to/addons,/path/to/custom/addons "$#"
The $# tells the script to accept any additional params on the end, so when I call:
odoo --logfile=~/odoospam.log
I can debug nice and tidy.
Then if you want to check the log just tail -f ~/odoospam.log.
Still trying to figure out the best way to debug with pdb inside a docker container, will update this when I find a suitable way of doing it.
EDIT:
Found how to do so in docker (Kudos to https://stackoverflow.com/users/941605/jamey): Docker-compose and pdb
docker-compose run --service-ports odoo
I recommend you to install the Visual Studio Code to debug Odoo:
Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring. It is free and open-source, although the official download is under a proprietary license.
First, you need to install the Python Extension within VSCode. Then, if you want to start debugging you just need to click on the Debug button and click on the wheel on the top of the sidebar. The file launch.json will open and you just need to add this element to the bottom.
{
"name": "Python: Odoo",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config:python.pythonPath}",
"console": "externalTerminal",
"program": "/odoo_path/odoo.py",
"args": [
"--config=/odoo_config_path/.odoo_8.conf",
],
"cwd": "${workspaceRoot}",
"env": {},
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
}
Once it is added you already can run Odoo under VSCode. For more information about the launch configurations click here
Now you can create breakpoint as usual. You can use the debugger console as well. And if you use the property: "console": "externalTerminal" as I did, you can show the log in an external console at the same time

Resources