0

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)

Homer
  • 1
  • 1
  • @ Homer , which mysql connector-c++ you used, there is a 64 bit as well as 32 bit connectors, your issue might around that. check the one already failed and switch to the other one. – Mohammad Kanan Jan 11 '18 at 22:07
  • Im using the source code obtained from git clone https://github.com/mysql/mysql-connector-cpp – Homer Jan 11 '18 at 22:13
  • I have also copied the libraries from the pi to the sysroot on my pc – Homer Jan 11 '18 at 22:15
  • I am not familiar with Ubuntu nor the library you mentioned, but please check this thread (https://stackoverflow.com/questions/42683438/qt-5-8-sql-connection-errorqmysql-driver-not-loaded-on-windows-10/45394110#45394110) – Mohammad Kanan Jan 11 '18 at 22:16
  • Thanks, however that is for the Qt libraries which I can not use on this project (refer original question) I could use it but that would mean having 2 lots of code that essentially do the same thing. – Homer Jan 11 '18 at 22:20

1 Answers1

0

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.

Homer
  • 1
  • 1