Compile Oracle SQL Drivers plug-in qsqloci in Mac system

Source: Internet
Author: User

Today, the Oracle SQL driver plug-in is compiled on Mac. The compilation process is recorded here for your reference.

First introduce the compiling environment: Mac OS X 10.7.3, install Qt SDK 1.2 for Mac, XCode 4.2.1.

1. first, download the relevant libraries and Development kits from the Oracle website. Follow the instructions in the Qt document (How to Build the OCI Plugin on Unix and Mac OS X ), you need to download the "Instant Client Package-Basic" and "Instant Client Package-SDK" packages. You can find the content to download from here.

2. decompress the downloaded zip file to the same directory, such as Oracle10gClient;

3. compile. There are two methods in qt documents: one is to use configure to generate makefile and the other is to generate makefile by using qmake. I failed to use the first method here (the reason is unknown). Here I am talking about the second method:

1) Go to the Qt source code directory ,~ /QtSDK/QtSources/4.8.0/src/plugins/sqldrivers/oci

2) execute the qmake command and follow the instructions in the document to execute

  1. Qmake "INCLUDEPATH + = [your_oracle_dir]/instantclient_10_2/sdk/include" "LIBS + =-L [your_oracle_dir]/instantclient_10_2-Wl,-rpath, [your_oracle_dir]/instantclient_10_2 "-lclntsh-lnnz10" oci. pro

[Your_oracle_dir] must be replaced with the directory created in step 1. Then execute make to generate the library file.

During execution, make finds that the <QtSql/private/qsqlcachedresult_p.h> file cannot be found, which is www.bkjia.com, but actually exists in the directory, the reason is that when qmake is executed by default, only the binary include directory QtSDK/Desktop/Qt/4.8.0/gcc/include directory is placed in INCLUDEPATH, and this file is in the source code directory, therefore, the header file cannot be found. The solution is to directly add the include directory of the source code to qmake, that is, execute the following qmake command:

  1. Qmake "INCLUDEPATH + = [your_oracle_dir]/instantclient_10_2/sdk/include ~ /QtSDK/QtSources/4.8.0/include "" LIBS + =-L [your_oracle_dir]/extract-Wl,-rpath, [your_oracle_dir]/instantclient_10_2 "-lclntsh-lnnz10" oci. pro

This can be compiled successfully, but there is still an error at the end of the link. The library file "library not found for-lclntsh" cannot be found and the oracle installation directory is located, this file does not exist, but there is a libclntsh. dylib.10.1. I guess this is a dynamic library, but the version is different. Therefore, create a symbolic link for this file and run it in the [your_oracle_dir] Directory.

Ln-s libclntsh. dylib.10.1 libclntsh. dylib

Then you can run the make command to create it. After the file is created ~ /QtSDK/QtSources/4.8.0/src/plugins/sqldrivers/oci directory, copy them to the sqldrivers directory of Qt.

The above is the entire process of generating the driver plug-in.

Related Article

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.