Compile the Qt4.8.2 and MySQL drivers in Ubuntu12.04

Source: Internet
Author: User
Compile Qt4.8.2 in Ubuntu12.04: Enter the qt directory./configure-prefix directory (this directory is the installation path after compilation) * This problem occurs: BasicXLibfunctionalitytestfai

Compile Qt4.8.2 in Ubuntu 12.04:

The pure version of Ubuntu does not require g ++ to be installed first.

Sudo apt-get install g ++

Decompress the tar.gz package

Tar zxvf xxx.tar.gz

Enter the qt directory

./Configure-prefix directory (this directory is the installation path after the final compilation)

* This problem occurs:

Basic XLib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in/home/gcgily/qt-everywhere-opensource-src-4.8.2/mkspecs/linux-g ++


Three packages are required

Sudo apt-get install libX11-dev libXext-dev libXtst-dev

Then make and make install.

Compile the mysql DRIVER:

Install mysql first

Sudo apt-get install mysql-server

Sudo apt-get install mysql-client

Sudo apt-get install libmysqlclient-dev

Sudo apt-get install emma (it is recommended to install mysql gui, similar to the Front function in windows)

/* Uninstall mysql:

* Sudo apt-get autoremove -- purge mysql-server-5.0

* Sudo apt-get remove mysql-server

* Sudo apt-get remove autoremove mysql-server

* Sudo apt-get remove mysql-common

*/

After installing mysql and the Development Kit, compile the mysql driver.

Find mysql. h and libmysqlclient. so

The files on my computer are under the/usr/include/mysql and/usr/lib/i386-linux-gnu directories respectively.

You need to configure environment variables first.

Export PATH = $ PATH: bin PATH (bin PATH after qt installation,/home/jerry/qt-4.8.2/bin/on my computer /)

Otherwise, qmake cannot be found.

Enter the mysql directory of the compilation package. For example, on my computer, yes ~ /Desktop/qt-everywhere-opensource-src-4.8.2/src/plugins/sqldrivers/mysql

Run the following command:

Qmake-o Makefile export depath + = "/usr/inclue/mysql" LIBS + = "/usr/lib/i386-linux-gnu/libmysqlclient. so" mysql. pro

Then execute make.

You can ~ /Desktop/qt-everywhere-opensource-src-4.8.2/plugins/sqldrivers directory find libqsqlmysql. so

Move libqsqlmysql. so to the plugins/sqldrivers directory under the installation directory. For example, in my computer ~ /Qt-4.8.2/plugins/sqldrivers

Now you can use QMYSQL in your project ~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.