-
安装毕昇编译器 确认repo源配置正常。 请检查默认的/etc/yum.repos.d/hce.repo配置文件中参数是否正确,正确的配置如下。 [base]
name=HCE $releasever base
baseurl=https://repo.huaweicloud.com/hce/$releasever/os/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/hce/$releasever/os/RPM-GPG-KEY-HCE-2
[updates]
name=HCE $releasever updates
baseurl=https://repo.huaweicloud.com/hce/$releasever/updates/$basearch/
...... 执行yum -y install bisheng-compiler命令安装工具。 执行source /usr/local/bisheng-compiler/env.sh命令,导入环境变量。 如果打开了新的终端,需要在新的终端重新导入环境变量才能正常使用毕昇编译器。 检查工具是否安装成功。 执行clang -v查看工具的版本号。若返回结果包含毕昇编译器版本信息,表示工具安装成功。
-
使用毕昇编译器 以下[command line flags]为命令行选项或参数,可按需替换。 编译运行C/C++程序。 clang [command line flags] hello.c -o hello.o
./hello.o
clang++ [command line flags] hello.cpp -o hello.o
./hello.o 编译运行Fortran程序。 flang [command line flags] hello.f90 -o hello.o
./hello.o 指定链接器。 毕昇编译器指定的链接器是LLVM的lld,若不指定它则使用默认的ld。 clang [command line flags] -fuse-ld=lld hello.c -o hello.o
./hello.o
-
使用毕昇编译器 编译运行C/C++程序。 clang [command line flags] hello.c -o hello.o./hello.oclang++ [command line flags] hello.cpp -o hello.o./hello.o 编译运行Fortran程序。 flang [command line flags] hello.f90 -o hello.o./hello.o 指定链接器。 毕昇编译器指定的链接器是LLVM的lld,若不指定它则使用默认的ld。 clang [command line flags] -fuse-ld=lld hello.c -o hello.o./hello.o