Compilation Environment Configuration

If you have developed a program using an operator or application project, you need to configure the compilation environment to build and run the project.

Prerequisites

  • The version of Ascend-CANN-Toolkit on the MindStudio installation server must be the same as that of the CANN software package in the operating environment.
  • The Ascend-CANN-Toolkit of the same architecture as that in the operating environment must be installed in the MindStudio installation server environment.
  • The GCC version in the MindStudio installation server environment cannot be later than that in the operating environment. Otherwise, the functions may be affected.

Configuring Permissions for the Installation User

If you install MindStudio as a non-root user, you may need to use the privilege escalation commands. In this case, obtain the required sudo permissions. After the installation is complete, cancel the permissions related to high-risk commands. Otherwise, sudo privilege escalation risks exist.

Installing the Compiler

Install different compilers based on the architectures of the MindStudio installation server and operating environment. For details, see Table 1.

After the compilation environment is configured, restart MindStudio for the configuration to take effect.

Table 1 Compiler commands

MindStudio installation server Architecture

Operating Environment Architecture

Compiler

x86_64

x86_64

Run the g++ --version command on the MindStudio installation server as the MindStudio installation user to check whether the compiler has been installed. If not, run the following installation command to install the compiler:

  • For CentOS and openEuler:
    sudo yum install -y g++
  • For Ubuntu OSs:
    sudo apt-get install -y g++

AArch64

Run the aarch64-linux-gnu-g++ --version command on the MindStudio installation server as the MindStudio installation user to check whether the compiler has been installed. If not, run the following command to install the compiler:

  • For CentOS and openEuler:
    sudo yum install -y g++-aarch64-linux-gnu
  • For Ubuntu OSs:
    sudo apt-get install -y g++-aarch64-linux-gnu

If there are multiple cross compilers on the MindStudio installation server, create a soft link between the used cross compiler and the required cross compiler version. The command is as follows:

sudo ln -s Cross compiler of another version Required version

Note: If you install dependencies as the root user, delete sudo from the commands in the table.