Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 77
Registered: ‎05-21-2012
My Device: DA C, Z10 LE, Passport
My Carrier: TIM

Re: Compiler error - undefined reference to QMYSQLDriver

Thank you dotuner.

 

Acrually file command gives this:

$ file libclientlib.a 
libclientlib.a: current ar archive

Does this means that I need to cross compile binutil (where ar command is provided) ?

 

thanks for your time

Contributor
Posts: 12
Registered: ‎09-10-2012
My Device: none
My Carrier: none

Re: Compiler error - undefined reference to QMYSQLDriver

We would really need a libmysqlclient / connector port fro Native SDK..

 

I've been also trying myself and i must admit it's a real mess :-/

 

Sqlite was a good idea for local access database, why not extending this to external databases ??

 

Using QT is not always possible or an option..

 

Anyone ?? ;-)

New Developer
Posts: 6
Registered: ‎08-13-2013
My Device: BlackBerry 10 - Developer
My Carrier: Telus

Re: Compiler error - undefined reference to QMYSQLDriver

lildeimos, were you ever successful in cross compiling the ODBC source?

Developer
Posts: 77
Registered: ‎05-21-2012
My Device: DA C, Z10 LE, Passport
My Carrier: TIM

Re: Compiler error - undefined reference to QMYSQLDriver

No sorry. I made a php api and stored it on the server to be queried from my app

New Contributor
Posts: 2
Registered: ‎03-15-2014
My Device: Z10
My Carrier: Rogers

Re: Compiler error - undefined reference to QMYSQLDriver

Hi Folks,

 

           I am able to compile the C API 100%. not sure if it will work or not. If you are intrested, let me know, i can get you the .so and .a files.

Retired
Posts: 35
Registered: ‎10-15-2013
My Device: BlackBerry Z30
My Carrier: O2 UK

Re: Compiler error - undefined reference to QMYSQLDriver

@shinghotra Are you able to provide the steps you went through to compile the libraries? 

New Contributor
Posts: 2
Registered: ‎03-15-2014
My Device: Z10
My Carrier: Rogers

Re: Compiler error - undefined reference to QMYSQLDriver

@doturner - made a small tutorial

 

software used - ubuntu 13, cmake 2.8, gcc_ntox86 compiler and linker
Toolchain file - https://github.com/blackberry/OGRE/blob/master/src/CMake/toolchain/blackberry.toolchain.cmake


------------------------------------commands----------------------------------

# source bbndk/blackberryenvironment.sh
# mkdir build
# cd build
# cmake ../mysql-src -DCMAKE_TOOLCHAIN_FILE="../mysql-src/toolchain.cmake" -DSTACK_DIRECTION=1

 

gives two TRY_RUN() errors, cmake can't run something in cross compile environment, so got rid of both steps which are casuing problem

1 - HAVE_LLVM_LIBCPP
2 - PTHREAD (noticed there is no such library called libpthread in QNX, everything is in libc)

after removing both TRY_RUN, cleaned the build directory and ran cmake command again. No errors (1 warning).

 

# cd libmysql
# make -j4

 

gives /bin/sh comp_err not found, very common error for cmake, cannot find excutable on host system.
To fix this, i compiled the whole code on ubuntu first without any error,
copied comp_err from ~/build(ubuntu)/extra/ to ~/build(blackberry)/extra

 

# make -j4

 

gives lot of "std:: not declared" errors for ~/mysql-src/extra/yassl/src/lock.cpp
to fix this, opened ~/mysql-src/extra/yassl/include/lock.h and added 2 lines following

#ifdef MULTI_THREADED
#ifdef _WIN32
#include <windows.h>

 

//added following 2 lines
#else
#include <pthread.h>
// thats it


#endif
#endif

this fixed all the std namespace errors

 

# make -j4

 

gives error while compiling ~/mysql-src/mysys/my_syslog.cpp "syslog.h : no such directory or file"
did some research and found that qnx doesnt have syslog.h (may be it doesnt support "system logging")
got rid of compiling my_syslog.cpp in all Makefiles

# make -j4

gives last error for some maths.h function like -log and -floor.
to fix this I simply added -lm (maths library) in link.txt file for this step

# make -j4

Wallah!!!!!!

100% complete... output gives you libmysqlclient.a libmysqlclient_r.a libmysqlclient.so.18.2.0 and some more symbolic links


reply if you have confusion.
I am not a pro, if i am wrong somewhere, please let me know.

Highlighted
Retired
Posts: 35
Registered: ‎10-15-2013
My Device: BlackBerry Z30
My Carrier: O2 UK

Re: Compiler error - undefined reference to QMYSQLDriver

@shinghotra Many thanks for this write up - very helpful! Smiley Happy