MySql connector-c++ wont link in QtCreator but works fine locally on raspberry pi3 - c++

Firstly, thank you in advance for at least reading this question.
Secondly, feel free to call me an idiot if this is a "no brainer"
Now down to the issue at hand...
I am running Ubuntu 16.04 (64bit) with QT Creator as my IDE and on the whole it works great. I can cross compile for the Raspberry Pi3 (running raspbian) and also compile plugins for X-Plane.
Everything was going great until I needed to implement MySql into my project. That's when it all went south.
I can not use the Qt library for this as X-Plane does not like anything Qt related in its plugins. But that is fine, I have connector-c++ working on that machine and it connects to my MySql server and does everything it's supposed to.
I think I have read just about every forum and watched every youtube video on this but can not get Qt Creator to compile with connector for the raspberry pi.
I wrote/compiled a test app locally (with g++) on the pi and it works great. However for some reason (government plot maybe?) it refuses to link the libraries when compiling under Qt Creator.
The error I get when compiling in QtCreator is:
undefined reference to `get_driver_instance'
Currently,
I have followed the instructions for setting up a cross compiler here:
https://wiki.qt.io/RaspberryPi2EGLFS
Downloaded the connector code from here:
git clone https://github.com/mysql/mysql-connector-cpp
I have followed the instructions for compiling connector-c++ here:
https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-installation-source-unix.html
And I have banged my head 1000x on a brick wall here:
(picture of blood stained wall not available)
Also, I have tried compiling connector on my Ubuntu pc with paths to the pi's sysroot etc. but i think it made a 64bit version which causes Qt Creator to have a dummy spit about "unrecognized format".
I am hoping that this is just me having a "senior moment" and that someone can point me in the right direction.
To save putting up irrelevant logs/code I will wait until someone asks for it and then copy/paste what they need.
Again, thanks in advance and know that I will be eternally grateful for any light on this matter (preferably before I go even insanerer)

Well after 2 weeks of pain, I have solved this problem. Here is what I think is the issue:
Firstly, I found that mysqlcppconn is not needed (at least for me) and used the mysql libraries in /usr/lib
Secondly, the symlinks to libmysqlclient.so.6.0.22 were by default:
libmysqlclient.so.6 -> libmysqlclient.so.6.0.22
The compiler was looking for libmysqlclient.so which didn't exist. So I created the link (libmysqlclient.so -> libmysqlclient.so.6) and it worked!!
Thanks to all who helped.

Related

Qt app starts on device where it was compiled, but not on others

I built a Qt 5.12 app on Ubuntu then moved it to another computer (the very same Ubuntu system) - and it gave me a "__cxa_throw_bad_array_new_length, version Qt_5" at start (and quit)...
When I try with a default Qt windowed starting project (one window, nothing else) and copy the executable to the other computer (where my app is failing), it works. So I think the problem is not in the project setup and the kit.
Very strange is that several weeks ago everything was fine. I don't have any idea what has changed since. I presume that there is a version conflict with a library, but I am not a linux pro and dont't know how to figure that out.
It would be great if any of you could help. :)

Microbit Platformio development - 'PlatformIOLibBuilder' object has no attribute 'get_inc_dirs'

I am currently trying to play around with developing on a BBC microbit on c++ through the Platformio IDE on Atom.
I have got the software working with other boards (various NUCLEO boards that I own), and the code itself for the mircobit is the simple "Hello World" scroller that compiles fine on the mbed online compiler.
When compiling on platformio I get:
Attribute Error: 'PlatformIOLibBuilder' object has no attribute 'get_inc_dirs'
I have tried installing the microbit University of Lancaster libraries, and platformio says they are installed but it doesn't appear in the lib folder of the project I am using.
When it comes to developing I am very much a newbie in terms of setting up environments and IDEs, and I keep searching everywhere for answers on this but its hard to filter out what I need to do to fix this issue. While the microbit is a supported board, there is no guide as to how to get started with it, and every other board just seems to work fine with all the default installations.
UPDATE: The solution below works also for Ubuntu and windows though LED displays come out a bit garbled when you try and scroll text. However, serial communication shows that the actual microbit is doing what it should.
The errors in the display may be down to the fact that the microbit libraries are v2.0.0-rc4 whereas the most up to date version of the University of Lancaster Libraries appear to be v2.0.0-rc10.
Edit:
I am using Linux Mint and the platformio plugin in Atom. I had the reported error. First of all I used the command line tool to update platoformio:
~/.platformio/penv/bin/pio update
To remove the get_dirs error and enable my code to compile:
In
~/.platformio/lib/nrf51-sdk/platformio_extra.py
change line:
pio_lib_builder.env.Prepend(CPPPATH=pio_lib_builder.get_inc_dirs())
to:
pio_lib_builder.env.Prepend(CPPPATH=pio_lib_builder.get_include_dirs())
I got this idea from:
https://github.com/palfrey/nrf51-sdk/pull/1/files
To get my compiled code to load I run atom as sudo:
sudo atom

Qt crashes when I try to execute any program

I've looked for an answer during a few days and I haven't found anything similar anywhere;
I downloaded Qt from the official website, installed it and apparently compiling is fine. But whenever I try to execute (Ctrl+R) any app, even the basic one which only displays a window or widget, QtCreator itself crashes. No error message, nothing, just crashing.
I've tried to redownload and reinstall it a few times with different settings, but nothing will do.
I'm running QtCreator on Windows 7 64 bits. I'll try on my laptop which is also running windows and will update if I find anything.
Any help would be appreciated, I need to start a project as soon as possible. I'm relatively new to QT and if you need info on anything just ask me. Thanks :)
Use dependency walker, http://www.dependencywalker.com/
and post any missing dependencies. It is possible some install targets or options are missing from when you installed QtCreator, which can be resolved with the maintenance tool in the same directory you installed Qt.
Also, are you using the Visual Studio compiler(must have Visual Studio installed separately, and mark the option during install), or the Ming compiler(2 options checked during install or maintenance)?
Check if your antivirus is locking it, I had a similar issue time ago and it was due to antivirus (Avast specifically). Disable antivirus' realtime shields and try to execute a basic app.
It is necessary to use QtCreator? I use QtDesigner snd VS2013 and things go very well. :)
check this thread Qt Creator Plain C++ Project won't run/debug... and this C++ - QtCreator doesn't show any output

OpenCV in Code::Blocks: The application was unable to start correctly (0xc00000be)

I set up OpenCV with Code::Blocks as per this tutorial: http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/.
I've got as far as building the test program at the end successfully, but when I try to run it I get the following error: "The application was unable to start correctly (0xc00000be). Click OK to close the application."
The one thing that is certainly different from the tutorial for me is that I'm working with OpenCV 3.0.0, Code::Blocks 13.12 and the latest version of mingw (number not obvious from their website or the installer).
I found that other people had had this problem in the past, e.g. The application was unable to start correctly (0xc00000be)
However, it has been a long time since that thread was active, I'm working with newer versions of the software and, most importantly, the answer given there didn't help (I compiled openCV with the same mingw that I'm using with Code::Blocks), so I thought this question would be worth asking (sorry if it's not, I'm rather new to this).
Could anybody suggest a fix that might get rid of this error?
A few other things to note:
I didn't download the Code::Blocks that came with mingw as I was advised against it, I got them separately as per the tutorial
I have installed OpenCV and Code::Blocks on my E: drive, though mingw is still on my C:.
I have added both mingw and OpenCV to my PATH variable, and mingw to my Path variable
I have linked the libraries in both the main compiler settings for Code::Blocks and the Build Options of my project.
I'm working from a 64-bit Windows 7 Laptop, but I have done everything 32-bit style as advised in the tutorial.
Thanks in advance!
So, one solution I've found to this problem is to copy all the .dll files from "...\opencv\build\x86\mingw\bin" to the project file (build directory).
Having done that, the project will run fine. This still doesn't (directly) explain why it wont run without those files (at least, several sources including the tutorial imply it should), and so isn't really optimal. I will continue to look for a solution for this so I don't have to clutter every opencv project I make with the .dlls.
However, for anyone simply wanting to get stuck into coding who is having this problem, I recommend that solution.

OpenCV - How do I get started?

I just don't seem to be able to get OpenCV to work properly. Here's what I want to accomplish:
Use CodeBlocks (which I installed using codeblocks-10.05mingw-setup.exe) with OpenCV (installer: OpenCV-2.4.2.exe) on my Windows x64.
I've tried a lot of different configurations which will only bother you if I posted them all, so I hope you don't mind if I just ask the simple question: how do I get this to work?
I think I'm missing the smallest detail right now, so a detailed description of how to get started would be welcome.
If the OpenCV installer did the job, you should have by now OpenCV libraries and headers already installed in your system.
I would then go ahead and try to compile a hello world basic code, like the one you can get from here. If you would like to program using an IDE, like VisualC++ in Windows, you can follow this guide that will help you setting up the environment.
OpenCV team just introduced their new web site. There you can find Introduction to OpenCV section with installation instructions, including detailed instructions for Windows. Don't forget to cleanup your system before installation to avoid problems with mixing different install options. If you still can't get it working with CodeBlocks, follow Dan's advice and try compiling from command line.
When you are done with installation, go on and read there great new tutorials!