build mysql driver for Necessitas (qt-android) - mysql

I´m trying to build a mysql driver to use it in a qt-android app.
Now everything seems to be clear but there is a inconsistency in my head.
While i´m compiling the mysql-connector-c source ( 6.0.2 ) cmake got a lot of missing header files.
Thats ok, but my problem is where to get these headers? or can I just use my gcc headers?
Thank you in advance!
Link to the guide I Worked with: http://qa-android.com/comp-lib-qt-android/2012-11/pdfNpp3xMBVQQ.pdf

Related

QMSQL : Cannot mix incompatible Qt library (version 0x50b03) with this library (version 0x50c05)

I'm trying to use a MySQL database in a QT application. For this I needed to build the MySQL manually and nothing went as planned at all.
Using:
Qt 5.12.5
g++ 8.3.0
Make 4.2.1
MySQL 15.1
Debian 10.1
I first tried to follow this guide: https://doc.qt.io/qt-5/sql-driver.html but qmake wouldn't detect MySQL headers.
After searching the internet I found out somebody managed to work things out by building directly the driver.
I went in ~/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/mysql and ran :
qmake qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/x86_64-linux-gnu/ -lmysqlclient_r"
It didn't work :
Project ERROR: Library 'mysql' is not defined.
After some googling, I changed the mysql.pro file to this one:
TARGET = qsqlmysql
HEADERS += $$PWD/qsql_mysql_p.h
SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
OTHER_FILES += mysql.json
PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
include(../qsqldriverbase.pri)
It worked, for now. Next step, running make ! Guess what? Didn't work either.
/usr/include/c++/8/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
ran qmake again without "INCLUDEPATH [...]", now I was missing mysql.h. I added manually the path to it to the Makefile. It worked.
I tried running my QT app again, still no MySQL driver.
Turned out the newly built driver was not copied in the right directory with the other ones. So I copied in Qt/5.12.5/gcc_64/plugins/sqldrivers.
Now it seems my plugin is indeed recognized by Qt but it just crashes with this error :
Cannot mix incompatible Qt library (version 0x50b03) with this library (version 0x50c05)
I don't know what to do next, can't find anything useful for this case on the internet...
Help, please?
Turned out I had another version Qt installed on my system. I don't where it came from but this issue is now solved.

Error Building Scaffolding Site Yesod

I have tried to setup the Yesod scaffolding site with MySQL, in the book it said to use yesod init but apparently that command no longer exists and I should use stack new project_name template. So I ran stack new project_name yesod-mysql which created all the files but then when running yesod devel from within the directory my site is in I get two errors. Below are the log contents for each:
mysql-0.1.4.log:
[1 of 2] Compiling Main ( C:\Users\James\AppData\Local\Temp\stack23220\mysql-0.1.4\Setup.hs, C:\Users\James\AppData\Local\Temp\stack23220\mysql-0.1.4\.stack-work\dist\ca59d0ab\setup\Main.o )
[2 of 2] Compiling StackSetupShim ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\Users\James\AppData\Local\Temp\stack23220\mysql-0.1.4\.stack-work\dist\ca59d0ab\setup\StackSetupShim.o )
Linking C:\Users\James\AppData\Local\Temp\stack23220\mysql-0.1.4\.stack-work\dist\ca59d0ab\setup\setup.exe ...
Configuring mysql-0.1.4...
setup.exe: The program 'mysql_config' is required but it could not be found
pcre-light-0.4.0.4.log:
Configuring pcre-light-0.4.0.4...
Cabal-simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe: The program 'pkg-config' version
>=0.9.0 is required but it could not be found.
I've searched around a bit for a solution but couldn't find much. I also tried following the quick start guide on the Yesod website but that didn't fix anything.
I'm running Windows 7.
Thanks in advance :)
EDIT: I installed pkg-config via MSYS2 but that didn't help. I also tried installing MySQL but that didn't help regarding the mysql-config problem.
For mysql error seems like this can help
sudo apt-get install libmysqlclient-dev

Can't get JRuby to work on AIX machine

I looked everywhere and I can't find any help on how to get JRuby to work on AIX. I tried unpacking the binary package, tried using the jruby-complete.jar but I stumble on the same problems.
All errors seem to occur because JRuby is looking in the wrong directories for lib files.
For instance, I set my GEM_PATH=/home/dev999/install_tmp/gem and then I try to require activerecord-jdbc-adapter, which is installed under ./gem/gems/activerecord-jdbc-adapter-1.3.12, but for some reason JRuby keeps looking for the gem under ./gem/gems/activemodel-4.1.8/lib as shown below.
dev-host:/home/dev999/install_tmp$ jruby -e "require 'activerecord-jdbc-adapter'"
Errno::ENOENT: ENOENT - /home/dev999/install_tmp/gem/gems/activemodel-4.1.8/lib/activerecord-jdbc-adapter
file? at org/jruby/RubyFileTest.java:131
contains_requirable_file? at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/basic_specification.rb:46
any? at org/jruby/RubyEnumerable.java:1473
contains_requirable_file? at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/basic_specification.rb:46
any? at org/jruby/RubyEnumerable.java:1473
contains_requirable_file? at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/basic_specification.rb:44
find_inactive_by_path at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/specification.rb:898
find at org/jruby/RubyEnumerable.java:592
find_inactive_by_path at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/specification.rb:897
try_activate at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems.rb:183
require at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:132
(root) at -e:1
Any insights on what may be causing this are greatly appreciated.
EDIT: The server is an AIX 64 bits; we tried Java 1.6 and 1.7 both 64 and 32 bits (IBM custom build for AIX) but we ended up sticking with 1.7 64 bits in the final solution, although the version doesn't seem to affect the issues found in the Ruby 1.7.9 installation, but since we couldn't get JRuby 1.7.16 to work, I can't be sure if the Java builds we used could have played part in the problem.
OK, so the server admin and I spent two days trying to figure these things out and I can finally summarize the solution we ended up with to get JRuby working on AIX_64.
1 . First and most important of all, I had to install JRuby 1.7.9 since the 1.7.16 stable version from the main download page in jruby.org has many (seemingly AIX specific) bugs that we could not figure out; for instance, the wrong gem path resolution shown in my original question. Version 1.7.9 sorts out most of the issues automatically;
2) For some weird reason that I'm still unable to figure out, jirb won't work with the jline-2.11.jar lib that comes with the downloaded JRuby package. At some point I got it to work but then I could not retrace my steps so I gave up. To sort this issue out I downloaded jline-1.0.jar and replaced the jline jar located under <jruby_path>/lib/ruby/shared/readline/jline-2.11.jar; please note that even if we are replacing this with jline-1.0, the jar file name must still be the same i.e. jline-2.11.jar otherwise jirb will complain about a missing lib;
3) Some common steps: add jruby/bin to $PATH; make sure which java shows the correct Java version you want to use; set $JAVA_HOME;
4) (Optional, but very useful) in order to avoid having to grant my user write access to the /usr/<jruby>/<gem_paths> directories but still allow me to install gems without having to ask the admin I added export GEM_PATH=~/.gem to my .profile, then mkdir ~/.gem. To install gems to my home directory I do jgem install <gem_name> -i $GEM_PATH.
Hopefully this helps other users struggling with the same problems.
My main suggestion is to join the jruby mailing list and ask there. I've used jruby just once and managed to get it working. Here is a bit of magic that I don't really understand that I have at the top of one of the first files I require:
# We need the db2j.jar loaded
require 'db2j.jar'
# Some feaking magic Java needs
Java::JavaClass.for_name 'com.ibm.db2j.jdbc.DB2jDriver'
# The connection string is jdbc:db2j:the/path/to/the/file where the
# file is actually a directory.
CloudscapeDriver = 'jdbc:db2j'
You can see the email thread here: http://comments.gmane.org/gmane.comp.lang.jruby.user/17856
good luck

How to get NetBeans 7.4, Ruby and MySQL to play together (on Windows)

The tags say it all, really. This is a project that used to work on earlier versions, but not now. If you know the answer, just stop reading and tell me how.
An existing project is working fine on older releases of NetBeans and MySQL. I am just trying to get it working on the latest release of everything. Nothing fancy. Just plain vanilla Ruby on Rails on Windows/MySQL.
Clean install of Netbeans 7.4. No problems.
Clean full install of MySQL 5.5. No problems. Includes Java connector.
Clean install of ruby and rails from community: http://plugins.netbeans.org/plugin/38549. No problems.
Everything is working just fine.
Webrick starts and runs. Absolutely no surprises to this point.
I tried to gem install MySQL: it fails, but it is not unexpected. I have no interest in pursuing that line. Ditto for MySQL 2. It's always hard building native libraries on Windows.
I tried to gem install all/any of the following:
* activerecord-jdbc-adapter
* activerecord-jdbcmysql-adapter
* jdbc-mysql
They install just fine, but the end point is always the same:
cannot load com.mysql.jdbc.Driver.
I think I know what this means, but I have no idea how to fix it. Is it a classpath problem? Is it a bug? Is it an incompatibility just about to be fixed? Is it because I'm using Windows? Who knows? I can't think of anything else to try, and the forums are full of these errors with no solutions that seem to fit my problem.
I am not sure, but maybe the blog post Installing MySQL on Windows 7 x64 and using Ruby with it will help.

How Do I Correct mysql.rb Drivers?

For the last several days, I've been struggling to get ruby on rails to work on my mac. The main culprit is MySQL. Every time I fix one thing, another error shows up. I upgraded/downgraded MySQL to play nice with ruby, rail and gems, but nothing. My latest error is:
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
/!\ FAILSAFE /!\ Wed Aug 05 21:09:23 -0700 2009
Status: 500 Internal Server Error
dlopen(/usr/local/lib/ruby/site_ruby/1.8/i686-darwin9.7.0/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib...
I don't have libmysqlclient.16.dylib; just *.15.dylib. Tried all the techniques, even installed or tried to install ruby-mysql-0.2.6 posted at tmtm.org
FYI: Last error prior to the one stated above had to do with authentication.
Appreciate any help.
Well, this question is a bit old already, but since I got here after getting the same error (but on LINUX), I would like to post my solution for future reference.
I simply had to install ruby-mysql.i686
yum install ruby-mysql.i686
Hope it helps somebody else in the future... tnx
Have you installed Xcode Developer tools? You can download it for free at http://developer.apple.com/.
Whenever I have issues with Ruby and MySQL, I never had Xcode installed. Could be wrong.
Answering my own question.
I don't know why and I don't know how, but took #Garrett's advice and re-installed Xcode. That didn't do anything. Went ahead and upgraded MySQL after that, which I had done before, and voilá! it worked. I'm guessing both re-installations finally got it working somehow. Weird!
Try using the below command . Provide the location of the mysql directory in your Mac .
sudo gem install mysql -- --with-mysql-dir= /usr/local/mysql
It looks like you haven't specified the location of mysql directory .
Good luck !