Preparations
Downloading Code
Prerequisites
Git and Git Large File Storage (LFS) have been installed and configured on the local host.
Procedure
Run the following command to download the openGauss-server code. In the command, [git ssh address] indicates the code download address, which can be obtained from the openGauss community.
[user@linux sda]$ git clone [git ssh address] openGauss-server
NOTE:
- openGauss-server: openGauss code repository.
- Database compilation depends on open-source third-party software. You can obtain the open-source third-party software from Building Open-source Software. Since open-source software build takes a long time, we have built binarylibs using openGauss-third_party and compressed and uploaded it to the Internet.
The community provides binary files compiled on three platforms. The download links are as follows:
openEuler_arm: https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz openEuler_x86: https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz Centos_x86: https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz
When the progress of each download reaches 100%, the download is successful.
Building Open-source Software
The community provides built third-party binary files. If you directly use the built file, skip this step.
Downloading the Code of the Open-Source Third-Party Software Repository
Install git and git-lfs, and then run the following commands to download the openGauss-third_party repository code:
[user@linux sda]$ git clone [git ssh address] openGauss-third_party
Building Open-source Software
Before building openGauss, build the open-source third-party software on which openGauss depends. The open-source third-party software is stored in the openGauss-third_party code repository. After downloading the software, you can use git lfs pull to obtain large files from the code repository. Generally, you only need to build the software once. If the open-source software is updated, rebuild the software.
Since this step takes a long time, we have built binarylibs using openGauss-third_party. You can download the package by referring to Downloading Code.
Table 1 openGauss open-source third-party software required before build
Prepare GCC 7.3 before building the third-party libraries. You are advised to use the released and built third-party library GCC and configure environment variables.
After installing the software listed in Table 1, point the default Python version to python3.x and perform the following operations:
Perform the following operations to go to the directory of the open-source third-party software on which the kernel depends, build the open-source third-party software, and generate binary programs or library files. /sda/openGauss-third_party is the directory for downloading open-source third-party software.
[user@linux sda]$ cd /sda/openGauss-third_party/build [user@linux build]$ sh build_all.sh
After the preceding commands are executed, the open-source third-party software required for openGauss build is automatically generated. To generate any open-source third-party software independently, go to the corresponding directory and run the build.sh script. For example:
[user@linux sda]$ cd /sda/openGauss-third_party/dependency/openssl [user@linux openssl]$ sh build.sh
The OpenSSL is generated.
NOTE: For error logs, you can view the corresponding log in the build directory and the log in the corresponding module. For example, you can view the OpenSSL build and installation logs in the dependency module.
- /sda/openGauss-third_party/build/dependency_build.log
- /sda/openGauss-third_party/dependency/build/openssl_build.log
- /sda/openGauss-third_party/dependency/openssl/build_openssl.log
Build Result
After the preceding script is executed, the final build result is stored in output under the openGauss-third_party directory These files will be used during the openGauss-server build.
Introduction to cmake_package_mini.sh
openGauss-server/build/script/cmake_package_mini.sh is the build script of openGauss Lite. Lite compilation and packaging can be quickly performed.
The following table describes the parameters.
Table 2 cmake_package_mini.sh parameters
Specifies the path of binarylibs. The path must be an absolute path. | |||
NOTE:
- -m [debug | release | memcheck] indicates that three target versions can be selected:
- release: indicates that the binary program of the release version is generated. During this version build, the GCC high-level optimization option is configured to remove the kernel debugging code. This option is usually used in the production environment or performance test environment.
- debug: indicates that a binary program of the debug version is generated. During this version build, the kernel code debugging function is added, which is usually used in the development self-test environment.
- memcheck: indicates that a binary program of the memcheck version is generated. During this version build, the ASAN function is added based on the debug version to locate memory problems.
- -3rd [binarylibs path] is the path of binarylibs. You need to specify the absolute path of the third-party library.
- -nopkg performs only lite compilation, and no packaging is performed. The compilation result is stored in the openGauss-server/mppdb_temp_install directory. If this parameter is not specified, the file is packaged by default and the packaging result is stored in the openGauss-server/output directory.
- Each option in this script has a default value. The number of options is small and the dependency is simple. Therefore, this script is easy to use. If the required value is different from the default value, set this parameter based on the actual requirements.