• [鲲鹏编译器] 毕昇编译器是否可以取代鲲鹏Gcc?
    鲲鹏Gcc和毕昇编译器,都是编译器。有啥区别,既然毕昇编译器性能更好,如果鲲鹏Gcc能够编译和使用的场景它都可以,那是否可以完全取代鲲鹏GCC?能帮助解答下吗?
  • [技术干货] Ubuntu如何通过本地源安装GCC
    Ubuntu如何通过本地源安装GCC1、按需选择场景(1)挂载光驱方式(设备支持光驱或虚拟光驱)(2)ISO源文件方式(需要上传至Ubuntu系统任一目录)2、登录Ubuntu 16.04.4操作系统命令行3、将Ubuntu16.04.4安装源挂载至/media/cdrom,如无/media/cdrom则需要手动创建:(1)挂载光驱方式(设备支持光驱或虚拟光驱)sudo mount -o loop -t iso9660 /dev/cdrom /media/cdrom  #/dev/cdrom为光驱设备或sudo mount /dev/cdrom /media/cdrom(2)ISO源文件方式(需要上传至Ubuntu系统任一目录)sudo mount -o loop -t iso9660 xxxxxxxx.iso /media/cdrom  #xxxxxxxx.iso为安装源ISO文件绝对路径4、手动添加安装源光驱或ISO镜像至软件源列表sudo apt-cdrom -m -d=/media/cdrom add5、更新软件源:sudo apt-get update6、安装所需要的软件,如make、gcc等编译环境,可执行sudo apt-get install build-essential(安装单一软件时,将build-essential替换为对应软件名即可),遇到安装提示时输入y,然后回车,安装完成后执行gcc -v查看gcc版本信息。
  • [GCC for op...] 请问可以提供鲲鹏GCC8.3.0版本
    请问是否可以提供鲲鹏GCC8.3.0的版本下载链接,当前业务有特定的版本要求。
  • [技术干货] OpenEuler Gcc7.3.0 降级 4.8.5
    背景:   在迁移电信某系统,伙伴需要使用openEuler,伙伴工程较旧,使用操作系统自带gcc 7.3.0 编译工程报错,遂决定对gcc降级,以下为gcc降级操作记录操作系统:openEuler 20.03  gcc 7.3.0一、查看原有系统版本二、下载升级所需安装包wget https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.gztar xvf gcc-4.8.5.tar.gz cd gcc-4.8.5执行下面脚本下载依赖包./contrib/download_prerequisites如上述脚本执行失败手动下载安装包到根目录wget https://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2wget https://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gzwget https://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2三、编译gccmkdir buildcd build/../configure --enable-checking=release --enable-language=c,c++ --disable-multilib --prefix=/usr/gcc4.8.5make  -j64由于版本差别较大,正常降级是无法编译通过的四、常见问题处理1、报错“const char* libc_name_p(const char*, unsigned int)’”问题截图解决方法:  其中红色的是旧代码,绿色的是修改后的代码a、修改 gcc-4.8.5/gcc/cp/Make-lang.in--- a/gcc/cp/Make-lang.in+++ b/gcc/cp/Make-lang.in # deleting the $(srcdir)/cp/cfns.h file. $(srcdir)/cp/cfns.h: endif-       gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \+       gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \                $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h  #\f如下图:b、修改gcc-4.8.5/gcc/cp/cfns.gperf--- a/gcc/cp/cfns.gperf+++ b/gcc/cp/cfns.gperf+%language=C+++%define class-name libc_name %{ /* Copyright (C) 2000-2016 Free Software Foundation, Inc. @@ -16,14 +18,6 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3.  If not see <http://www.gnu.org/licenses/>.  */-#ifdef __GNUC__-__inline-#endif-static unsigned int hash (const char *, unsigned int);-#ifdef __GNUC__-__inline-#endif-const char * libc_name_p (const char *, unsigned int); %} %% # The standard C library functions, for feeding to gperf; the result is used如下图:c、修改gcc-4.8.5/gcc/cp/cfns.h--- a/gcc/cp/cfns.h+++ b/gcc/cp/cfns.h-/* ANSI-C code produced by gperf version 3.0.3 */-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf  */+/* C++ code produced by gperf version 3.0.4 */+/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf  */  #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \@@ -28,7 +28,7 @@ #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." #endif -#line 1 "cfns.gperf"+#line 3 "cfns.gperf"  /* Copyright (C) 2000-2016 Free Software Foundation, Inc. @@ -47,25 +47,18 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3.  If not see <http://www.gnu.org/licenses/>.  */-#ifdef __GNUC__-__inline-#endif-static unsigned int hash (const char *, unsigned int);-#ifdef __GNUC__-__inline-#endif-const char * libc_name_p (const char *, unsigned int); /* maximum key range = 391, duplicates = 0 */ -#ifdef __GNUC__-__inline-#else-#ifdef __cplusplus-inline-#endif-#endif-static unsigned int-hash (register const char *str, register unsigned int len)+class libc_name+{+private:+  static inline unsigned int hash (const char *str, unsigned int len);+public:+  static const char *libc_name_p (const char *str, unsigned int len);+};++inline unsigned int+libc_name::hash (register const char *str, register unsigned int len) {   static const unsigned short asso_values[] =     {   return hval + asso_values[(unsigned char)str[len - 1]]; } -#ifdef __GNUC__-__inline-#ifdef __GNUC_STDC_INLINE__-__attribute__ ((__gnu_inline__))-#endif-#endif const char *-libc_name_p (register const char *str, register unsigned int len)+libc_name::libc_name_p (register const char *str, register unsigned int len) {   enum     {如下图:d、修改gcc-4.8.5/gcc/cp/except.c--- a/gcc/cp/except.c+++ b/gcc/cp/except.c      unless the system headers are playing rename tricks, and if      they are, we don't want to be confused by them.  */   id = DECL_NAME (fn);-  return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));+  return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),+                                  IDENTIFIER_LENGTH (id)); 重新编译查看结果make -j641、报错“error: field ‘uc’ has incomplete type”问题截图解决方法:查找文件  md-unwind-support.h,修改 struct ucontext uc; 为 ucontext_t uc;重新编译 make -j64,编译成功make install
  • [问题求助] 【Atlas】【环境部署】安装Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run
    【功能模块】要用华为Atlas 200,现在在环境部署步骤    【操作步骤&问题现象】1、在安装Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run的时候,出现了The operating system is x86_64 ubuntu, but the run package is for x86_64 centos而我是在昇腾社区下载的,为什么会出现这种问题呢?【截图信息】【日志信息】(可选,上传日志内容或者附件)
  • [经验案例] Centos7 gcc4.8.5升级到gcc7.3.0以及安装失败解决方案
    背景训练环境部署环境OS:centos7.6 x86 64位gcc: 4.8.5目的gcc 4.8.5 升级到gcc 7.3.0依赖安装yum -y install libmpc-devel yum -y install gmp-develyum -y install mpfr-devel yum -y install bzip2升级gcc7.3.01、下载源码http://ftp.gnu.org/gnu/gcc/ 2、gcc源码编译tar xvf gcc-7.3.0.tar.gzchmod -R 777 gcc-7.3.0cd gcc-7.3.0./configure --enable-checking=release --enable-languages=c,c++ --disable-multilibmake -j4 #编译非常耗时间make install安装完之后检查 gcc  --version  发现 还是gcc 4.8.5 gcc 7.3.0  的版本在     /usr/local/bin 可以删除、/usr/bin 下面的 gcc 然后软连接ln  -s  /usr/local/bin/gcc  /usr/bin/gccFAQ1、make  情况下一直才做下图循环操作,无法编译成功解决方案       由于make需要了解计算机时间和它检查的文件的时间。它比较这两个时间,并根据结果确定某个目标是否标记过。某些时间问题可能会导致make不停的编译(或不停地递归编译某个子目录)。在这种情况下,touch(其作用是把有问题的文件设置为当前时间)通常会解决该问题。 touch * 或者  find . | xargs touch(本人操作)2、编译过程出现如下问题解决方法
  • [安装] gcc7.5.0编译mindspore报错,是只能gcc7.3.0编译?
    gcc7.5.0编译mindspore报错,是只能gcc7.3.0编译?
  • [新手课堂] gcc -O的区别
    O1优化会消耗少多的编译时间,它主要对代码的分支,常量以及表达式等进行优化。 O2会尝试更多的寄存器级的优化以及指令级的优化,它会在编译期间占用更多的内存和编译时间。 O3在O2的基础上进行更多的优化,例如使用伪寄存器网络,普通函数的内联,以及针对循环的更多优化。 Os主要是对代码大小的优化,我们基本不用做更多的关心。 通常各种优化都会打乱程序的结构,让调试工作变得无从着手。并且会打乱执行顺序,依赖内存操作顺序的程序需要做相关处理才能确保程序的正确性加-O优化后可能带来的问题1.调试问题:正如上面所提到的,任何级别的优化都将带来代码结构的改变。例如:对分支的合并和消除,对公用子表达式的消除,对循环内load/store操作的替换和更改等,都将会使目标代码的执行顺序变得面目全非,导致调试信息严重不足。 2.内存操作顺序改变所带来的问题:在O2优化后,编译器会对影响内存操作的执行顺序。例如:-fschedule-insns允许数据处理时先完成其他的指令;-fforce-mem有可能导致内存与寄存器之间的数据产生类似脏数据的不一致等。对于某些依赖内存操作顺序而进行的逻辑,需要做严格的处理后才能进行优化。例如,采用volatile关键字限制变量的操作方式,或者利用barrier迫使cpu严格按照指令序执行的。
  • [问题求助] 鲲鹏GCC与毕昇编译器有哪些优化参数,有文档说明吗
    鲲鹏GCC与毕昇编译器有哪些优化参数,有文档说明吗
  • [技术讨论] 鲲鹏(ARM64)升级GCC-7.3.0【CentOS-7.6 GCC升级(网络环境+脱机环境)】
                            介绍                CentOS-7系统默认GCC版本为4.8+,很多情境下,编译安装部分软件时,需要高版本的GCC,如GCC-7.3.0、GCC-9+等版本。                本文以GCC-7.3.0为例,概括总结有网络的环境下以及脱机环境下编译安装GCC的升级过程。        网络环境下,编译升级GCC-7.3.0            操作步骤:            1.获取源码,获取“gcc-7.3.0”源码包。                # wget https://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz            2.编译安装                2.1 解压软件包                 # tar -zxvf gcc-7.3.0.tar.gz                2.2 进入gcc安装目录                # cd gcc-7.3.0/                2.3 下载isl、gmp、mpc、mpfr                [Tips:在contrib目录下,执行download_prerequisties文件,可自动下载安装依赖。如果其中某个依赖包下载失败,可根据下文离线方式单独编译安装依赖。]                 # ./contrib/download_prerequisites                安装成功后如下图:                                2.4 生成Makefile文件 (prefix后为安装路径,自定义安装路径,安装成功后要添加环境变量)                # ./configure --prefix=/usr/local/gcc-7.3.0                 2.5 编译安装gcc                # make -j 64        [Tips: "-j" 参数可利用多核CPU并行编译加快编译速度,可通过  lscpu 命令查看 cpu 核数。本次使用64核处理器,所以参数为 "-j 64"]                # make install                2.6 添加环境变量                # vim /etc/profile                   进入文件后,按快捷键"shift + G" 快速定位到文件末尾,按 "i" 进入插入编辑模式[Insert] ,定位到文件末尾末行最后,新起一行,输入:                export PATH=/usr/local/gcc-7.3.0/bin:$PATH    [Tips:此处要写实际安装路径,指定到bin目录下,最后的 :$PATH 请勿删除,如下图所示]                                编辑完成后按 ESC 键退出编辑模式,然后按 ":" 进入命令模式,输入 wq 后回车,保存并退出。如下图所示:                                使环境变量生效,执行如下命令                # source /etc/profile                   执行如下命令,看环境变量是否生效,检查是否书写正确,执行后如图所示即为正确。                # echo $PATH                             3. 运行和验证                查询gcc版本                # gcc --version                            -------------以上,网络环境编译安装GCC-7.3.0完成。            脱机环境下,编译升级GCC-7.3.0                说明:                        gcc编译依赖gmp、mpfr、mpc、isl四个库,mpfr依赖gmp,isl依赖gmp,而mpc依赖gmp和mpfr。                        因此安装gcc-7.3.0之前首先根据依赖关系依次安装四个库(软件版本:gmp-6.1.2,mpfr-3.1.5,isl-0.18,mpc-1.0.3,gcc-7.3.0)                            gmp下载链接:https://ftp.gnu.org/gnu/gmp/                            mpfr下载链接:https://ftp.gnu.org/gnu/mpfr/                            mpc下载链接:https://ftp.gnu.org/gnu/mpc/                            isl下载链接:http://isl.gforge.inria.fr/                        首先将安装文件上传到本地服务器/home目录下(可自定义路径),然后按照如下步骤进行编译安装。               操作步骤:                1. 安装 gmp                # cd /home                # bzip2 -d  /home/gmp-6.1.2.tar.bz2                # tar -xvf /home/gmp-6.1.2.tar                # cd /home/gmp-6.1.2                # ./configure --prefix=/usr/local/gmp-6.1.2                # make                # make install                2. 安装 mpfr          [Tips:./configure 后 --with-gmp后为前一步骤的实际安装路径,后续操作中也都为实际安装路径]                # cd /home                # tar -zxvf mpfr-3.1.5.tar.gz                # cd /home/mpfr-3.1.5                # ./configure --prefix=/usr/local/mpfr-3.1.5 --with-gmp=/usr/local/gmp-6.1.2                # make                # make install                3. 安装 mpc                # cd /home                # tar -zxvf mpc-1.0.3.tar.gz                # cd /home/mpc-1.0.3                # ./configure -prefix=/usr/local/mpc-1.0.3 --with-gmp=/usr/local/gmp-6.1.2 --with-mpfr=/usr/local/mpfr-3.1.5                # make                # make install                4. 安装 isl                # cd /home                # bzip2 -d /home/isl-0.18.tar.bz2                # tar -xvf /home/isl-0.18.tar                # cd /home/isl-0.18                # ./configure --prefix=/usr/local/isl-0.18 --with-gmp=/usr/local/gmp-6.1.2                # make                # make install                    [Tips:安装isl过程中可能会出现找不到 gmp.h 报错,此时需要安装gmp-devel,可以下载后上传安装]                5. 安装 gcc-7.3.0                # cd /home                # tar -zxvf gcc-7.3.0.tar.gz                # cd /home/gcc-7.3.0                # ./configure --prefix=/usr/local/gcc-7.3.0 --enable-languages=c,c++,fortran --enable-shared --enable-linker-build-id --without-included-gettext --enable-threads=posix --disable-multilib --disable-nls --disable-libsanitizer --disable-browser-plugin --enable-checking=release --build=aarch64-linux --with-gmp=/usr/local/gmp-6.1.2 --with-mpfr=/usr/local/mpfr-3.1.5 --with-mpc=/usr/local/mpc-1.0.3 --with-isl=/usr/local/isl-0.18                [Tips:对于x86服务器,将红色部分相应修改为:--build=x86_64-linux-gnu ]                # make -j 64                #使用64个线程进行编译,可根据具体硬件配置自行调整                # make install                6. 添加环境变量                # vim /etc/profile                   进入文件后,按快捷键"shift + G" 快速定位到文件末尾,按 "i" 进入插入编辑模式[Insert] ,定位到文件末尾末行最后,新起一行,输入:                export PATH=/usr/local/gcc-7.3.0/bin:$PATH    [Tips:此处要写实际安装路径,指定到bin目录下,最后的 :$PATH 请勿删除,如下图所示]                                 编辑完成后按 ESC 键退出编辑模式,然后按 ":" 进入命令模式,输入 wq 后回车,保存并退出。如下图所示:                                                                使环境变量生效,执行如下命令                # source /etc/profile                   执行如下命令,看环境变量是否生效,检查是否书写正确,执行后如图所示即为正确。                # echo $PATH                                 7. 运行和验证                查询gcc版本                # gcc --version                            -------------以上,脱机环境编译安装GCC-7.3.0完成。
  • [问题求助] Iot link 导入GCC工程或者创建Iot 工程出现问题
  • [安装经验] Windows上体验源码编译安装MindSpore
    # 体验在Windows上进行源码编译安装MindSpore 笔者一直使用MindSpore提供的whl包安装MindSpore,但是最近新版本一直还未出来,也看到了一位楼主在论坛反馈的问题[BiggestFanMindSpore 多平台编译踩坑与用户初体验](https://bbs.huaweicloud.com/forum/thread-93032-1-1.html),于是也尝试按照MindSpore官网提供的另一种安装方式--源码编译安装MindSpore。 整个过程顺利的话差不多需要100分钟(笔者遇到大坑,多花了2个多小时,整个填坑之旅花费接近4个小时),其中下载安装依赖软件上大约花了10多分钟,编译MindSpore安装包耗时最长,需要80分钟左右,安装MindSpore需要1分钟左右。当然如果机器的配置好,网速棒,多开些线程应该可以节省一点时间。 整个编译安装流程笔者将其总结如下文。 ## 下载依赖软件 首先是下载相关的依赖软件,笔者建议在此步操作使用下载工具(如迅雷)进行,可以大幅提升下载效率。 ### 下载安装Git 下载安装git:https://github.com/git-for-windows/git/releases/download/v2.29.2.windows.2/Git-2.29.2.2-64-bit.exe ,下载后双击进入安装,过程如下图。 ![git01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173123fxoqa8kkinezr6re.png) ![git02.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173144h3ma0donvsxgbnb4.png) ![git03.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173156hxrchoozjbcgzdym.png) 默认安装路径为:C:\Program Files\Git 可以找到相关文件。 ### 下载安装Python 下载安装Python 3.7.5版本:https://www.python.org/ftp/python/3.7.5/python-3.7.5-amd64.exe ,下载后双击进入安装,过程如下图。 ![python01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173256s72eeiipielmbt0r.png) ![python02.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173314knus0grzehu4cph7.png) ![python03.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173323i6fr9xykxpnzgepi.png) ![python04.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/1733297hd0frko6cdeppcu.png) 默认安装路径为: C:\Users\Administrator\AppData\Local\Programs\Python 可以找到相关文件。 ### 下载安装ActivePerl 下载ActivePerl 5.28.1.2801版本:https://downloads.activestate.com/ActivePerl/releases/5.28.1.2801/ActivePerl-5.28.1.2801-MSWin32-x64-24563874.exe 文件,并双击安装,过程如下图: ![activeperl01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173407azzglih3qmhtqv1m.png) ![activeperl02.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173417hfzungk0veryyd7y.png) ![activeperl03.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173424rjn9wk1nglwbrr7d.png) ### 下载解压GCC文件 下载MinGW-W64 GCC-7.3.0:https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.3.0/threads-posix/seh/x86_64-7.3.0-release-posix-seh-rt_v5-rev0.7z ,并解压,笔者将`mingw64`文件夹整体移到`D:/a_tool/gcc`文件夹,后续操作需要将gcc的路径添加到系统环境变量。当然也可以放置在其他路径中,但需注意:存放路径不能存在中文和日文。 ![gcc01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173501fougwdj413df1wmw.png) ![gcc02.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173512nxffvjmsfxbjbpbm.png) ![gcc03.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173523d9zngttuiyhf6nr7.png) ### 下载解压CMake文件 下载后解压缩并存放到指定位置, 下载CMake 3.18.3版本:https://github.com/Kitware/Cmake/releases/tag/v3.18.3 ,笔者使用Windows 10 64位系统,选择下载`cmake-3.18.3-win64-x64.zip`将此文件夹解压在`D:/a_tool`文件夹,后续需要将cmake的路径添加到系统环境变量。当然也可以放置在其他路径中,但需注意:存放路径不能存在中文和日文。 ![cmake01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/17355421qtsxl1ect0mhel.png) ### 下载Visual C++ 下载Visual C++ Redistributable for Visual Studio 2015:https://www.microsoft.com/zh-CN/download/details.aspx?id=48145 ,笔者使用Windows 10 64位系统,如果与笔者环境一致也可直接从这下载:https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe ,下载后双击安装,过程如下图: ![vc01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173630ld0stxwbqafulfhg.png) ![vc02.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/1736404lwlfciddozm24j9.png) ### 安装wheel 打开cmd命令行,输入命令,安装对应的依赖: ```bash pip install wheel -i https://pypi.tuna.tsinghua.edu.cn/simple ``` ## 添加系统环境变量 通过下述过程进入系统环境变量编辑界面: 控制面板->系统->高级系统设置 ![env01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173713zzekj0ux3ej5n6jq.png) ->环境变量->系统环境变量->Path->编辑,最后出现下图界面。 ![env02.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173739lblfgsvzu6gdtgdl.png) 点击新建添加新的环境变量: 添加方法: 如果跟笔者的安装步骤一致,则直接将下述路径复制添加到系统环境变量中即可: 添加Python路径到系统环境变量:`C:\Users\Administrator\AppData\Local\Programs\Python\Python37`。 添加pip路径到系统环境变量:`C:\Users\Administrator\AppData\Local\Programs\Python\Python37\Scripts`。 添加GCC-7.3.0路径到系统环境变量:`D:\a_tool\gcc\mingw64\bin`。 添加Cmake路径到系统环境变量:`D:\a_tool\cmake-3.18.3-win64-x64\bin`。 添加完成后,所有的界面点击确定即完成添加。 ## 下载编译MindSpore ### 通过git下载MindSpore仓 在`D:/atestwarehouse`文件夹中空白处右击,选择`Git Bash Here`。 输入命令,即可自动下载MindSpore仓的所有文件: ```bash git clone https://gitee.com/mindspore/mindspore.git ``` ![mindspore01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173831i1ijqjczwnoswfwq.png) ### 编译MindSpore 下载完成后,打开win+r,打开运行,输入cmd回车进入命令行: ![win_run.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173905x9v8vmv0vtadv6vg.png) 进入git下载下来的MindSpore文件夹目录,并输入编译命令: ```bash call build.bat 12 ``` 其中`12`为线程数量,配置好的机器可以调整更高的数值,加快编译速度,如果不设置数值,文件默认启动8线程编译。 ![build01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173939cjhtlxtwqj0d2uzq.png) 自动进入编译状态,整个编译过程大约80分钟。 第一阶段:下载各种相关的依赖包,然后检查编译: ![build02.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/173958mdm0k4ubkfscu5gb.png) ![build03.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/174003stp4ghdhsq426qa9.png) 第二阶段:核心编译,相关算子的编译: ![build04.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/1740249alr8edbobtxpsug.png) ![build05.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/174031rj9r4qme0o1sz6m6.png) 第三阶段:添加MindSpore的py文件到安装包文件: ![build06.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/1740505r6s2wzvc6gel1m9.png) ![build07.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/174057lbbwedriyrzgyibl.png) ![build08.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/174110edjh8mnpkwtmickg.png) 最后提示:`D:/atestwarehouse/mindspore/build/mindspore/mindspore_generated.`编译完毕。 可以在目录`D:/atestwarehouse/mindspore/build/package`找到编译完成的MindSpore安装文件,`mindspore-{version}-cp37-cp37m-win_amd64.whl`,verison为版本号,此例中{version}为1.1.0。 ![build09.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/174139kezsgzr2z8yq9vcz.png) 同时也可以在目录`./mindspore/output`找到编译好的文件及相关的校验文件: ![build10.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/1741541epz0m7cqb2daqzd.png) > 安装过程出现光标长时间闪烁不动的情况,可以通过Ctrl+C终止编译过程,然后在MindSpore中重新输入编译命令。 如果系统安装过Anaconda软件,可能在编译过程中出现依赖软件的路径指向问题,需要到注册表中调整指向,具体问题实在不能解决时,可以到[昇腾论坛MindSpore专区](https://bbs.huaweicloud.com/forum/forum-1076-1.html)将报错信息和截图进行发帖咨询,论坛有专人快速响应帮助解决。 笔者就在这两个大坑里面转悠了许久。 ## 安装MindSpore 进入到安装文件的文件夹,输入以下命令进行安装: ```bash pip install mindspore-{version}-cp37-cp37m-win_amd64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple ``` ![install_mindspore01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/26/1439215e6gnjr2hf9ezifu.png) 其中: - 在联网状态下,安装whl包时会自动下载MindSpore安装包的依赖项(依赖项详情参见[requirements.txt](https://gitee.com/mindspore/mindspore/blob/master/requirements.txt)),其余情况需自行安装。 - `{version}`表示MindSpore版本号,例如安装1.1.0版本MindSpore时,`{version}`应写为1.1.0。 ## 验证是否安装成功 ```bash python -c "import mindspore;print(mindspore.__version__)" ``` 下图中的验证方法等效于上面的命令: ![check_install01.PNG](https://bbs-img-cbc-cn.obs.cn-north-1.myhuaweicloud.com/data/attachment/forum/202012/25/174335vxqwouqpx1vnpkmt.png) 以上就是笔者在Windows 10上编译安装MindSpore的全部体验。 参考文档: [BiggestFanMindSpore 多平台编译踩坑与用户初体验](https://bbs.huaweicloud.com/forum/thread-93032-1-1.html) [MindSpore的安装](https://www.mindspore.cn/install)
  • [FAQ] centos7.6的gcc升级至7.3.0以后atc转换失败
    在搭建A800-3000环境是,遇到gcc升级后atc转换om报错系统自带gcc4.8.5,在安装完成python及其依赖以后,开始升级gcc至7.3.0接下来开始安装Drive、mcu、ascend-toolkit,过程中无报错在开始进行atc转换的时候报错,一下是命令和报错日志请问,此项错误是否是由于升级gcc造成,该如何纠错...
  • [技术干货] 如何安全的升级gcc
    很多同学在升级gcc的时候,因为直接覆盖/usr路径,导致出现很多问题,今天给大家带来一个脚本,该脚本一键升级(redhat软件栈,debain软件栈的暂时还未测试)我的目录结构如上使用redhat软件栈的任何系统,包括x86平台,aarch64平台PS:所有压缩吧选择.gz格式,因为脚本里写死了tar来解压,后续再做优化里面的附件,任何版本都适用,但必须齐全。gcc  cloog gmp isl mpc mpfr脚本如下:#!/bin/bashNow_pwd=`pwd`ld_file='/etc/ld.so.conf.d/build_gcc_env.conf'configure_cmdf='configure'core_num=`cat /proc/cpuinfo |grep "processor" |wc -l`build_tmp_dir="$Now_pwd/build_tmp"declare -A ready_pathdeclare -A softvssdeclare -A install_pathwhich apt 2> /dev/nullif [ $? -eq 0 ];thenapp_install_cmd='apt'app_search_cmd='apt list --installed|grep 'elseapp_install_cmd='yum'app_search_cmd='rpm -aq|grep 'fiif [ -d "$build_tmp_dir" ];thenecho ${build_tmp_dir}" is exsit!will remove!"rm -rf ${build_tmp_dir}fimkdir ${build_tmp_dir}function checkmake(){yls=('autoconf' 'bzip2' 'automake' 'm4' 'zlib-devel')for sn in ${yls[@]}doeval ${app_search_cmd} ${sn} if [ $? -ge 0 ];thenecho ${sn}" is exsit!"elseeval $app_install_cmd install -y ${sn}echo "install "${sn}" sucess!"fidoneif [ ! -f $ld_file ];thentouch $ld_filefi}function check_version(){cd $Now_pwdi=0if [ -f "tt.txt" ];thenrm -rf tt.txtfitouch tt.txtdeclare -a tmp_dirls | while read snamedo        nme=`echo $sname | grep -Eo "([A-Za-z]+\-)" | sed -n 's/-//p'`        if [ ! -n "$nme" ];then                continue                echo "nme:"$nme        fi        vs=`echo $sname | grep -Eo "([0-9]+\.)+tar" | sed -n 's/.tar//p'`        tmp_dir[${#tmp_dir[@]}]="$build_tmp_dir/$nme-$vs"        echo $nme" "${tmp_dir[$i]}" "$vs>> tt.txt        tar -xf $sname -C ${build_tmp_dir}        let i++donewhile read linedo    dict=`echo "$line" |awk '{print$1}'`    ready_path[${dict}]=`echo "$line" |awk '{print$2}'`    softvss[${dict}]=`echo "$line" |awk '{print$3}'`done < tt.txtrm -rf tt.txt}function make_gmp(){cd $1install_path['gmp']="/usr/local/gmp-$2"if [ ! -f "$configure_cmdf" ]; thenecho "floder "$(pwd)" have no configure file!will exit..."exit 1elsechmod +x $configure_cmdfecho "============================begin build gmp=================================="eval ./$configure_cmdf  --prefix=${install_path['gmp']} > /dev/null eval make -j $core_num > /dev/null && make install > /dev/nullif [ $? -eq 0 ];thenwrite_ldconf=`cat ${ld_file}|grep gmp`if [ ! $write_ldconf ];thenecho ${install_path['gmp']}"/lib" >> $ld_fileldconfigfiecho "============================end build gmp=================================="elseecho "============================end build gmp(error)=================================="exit 0fifi}function make_mpfr(){cd $1install_path['mpfr']="/usr/local/mpfr-$2"if [ ! -f "$configure_cmdf" ]; thenecho "floder "$(pwd)" have no configure file!will exit..."exit 1elsechmod +x $configure_cmdfecho "============================begin build mpfr=================================="eval ./$configure_cmdf  --prefix=${install_path['mpfr']}  --with-gmp=${install_path['gmp']} > /dev/nulleval make -j $core_num > /dev/null && make install > /dev/nullif [ $? -eq 0 ];thenwrite_ldconf=`cat ${ld_file}|grep mpfr`if [ ! $write_ldconf ];thenecho ${install_path['mpfr']}"/lib" >> $ld_fileldconfigfiecho "============================end build mpfr=================================="elseecho "============================end build mpfr(error)=================================="exit 1fifi}function make_mpc(){cd $1install_path['mpc']="/usr/local/mpc-$2"if [ ! -f "$configure_cmdf" ]; thenecho "floder "$(pwd)" have no configure file!will exit..."exit 1elsechmod +x $configure_cmdfecho "============================begin build mpc=================================="eval ./$configure_cmdf  --prefix=${install_path['mpc']}  --with-gmp=${install_path['gmp']}  --with-mpfr=${install_path['mpfr']} > /dev/nulleval make -j $core_num > /dev/null && make install > /dev/nullif [ $? -eq 0 ];thenwrite_ldconf=`cat ${ld_file}|grep mpc`if [ ! $write_ldconf ];thenecho ${install_path['mpc']}"/lib" >> $ld_fileldconfigfiecho "============================end build mpc=================================="elseecho "============================end build mpc(error)=================================="exit 1fifi}function make_isl(){cd $1install_path['isl']="/usr/local/isl-$2"if [ ! -f "$configure_cmdf" ];thenecho "floder "$(pwd)" have no configure file!will exit..."exit 1elsechmod +x $configure_cmdfecho "============================begin build isl=================================="eval ./$configure_cmdf  --prefix=${install_path['isl']}  --with-gmp-prefix=${install_path['gmp']}  > /dev/null eval make -j $core_num > /dev/null && make install > /dev/nullif [ $? -eq 0 ];thenwrite_ldconf=`cat ${ld_file}|grep isl`if [ ! $write_ldconf ];thenecho ${install_path['isl']}"/lib" >> $ld_fileldconfigfiecho "============================end build isl=================================="elseecho "============================end build isl(error)=================================="exit 1fifi}function make_cloog(){cd $1install_path['cloog']="/usr/local/cloog-$2"if [ ! -f "$configure_cmdf" ];thenecho "floder "$(pwd)" have no configure file!will exit..."exit 1elsechmod +x $configure_cmdfecho "============================begin build cloog=================================="eval ./$configure_cmdf  --prefix=${install_path['cloog']}  --with-gmp-prefix=${install_path['gmp']}  > /dev/null eval make -j $core_num > /dev/null && make install > /dev/nullif [ $? -eq 0 ];thenwrite_ldconf=`cat ${ld_file}|grep cloog`if [ ! $write_ldconf ];thenecho ${install_path['cloog']}"/lib" >> $ld_fileldconfigfiecho "============================end build cloog=================================="elseecho "============================end build cloog(error)=================================="exit 1fifi}function make_gcc(){cd $1install_path['gcc']="/usr/local/gcc-$2"had_env=$(cat /etc/profile|grep BUILD_GCC_ENV)mkdir build && cd buildsource /etc/profileecho "============================begin build gcc=================================="build_flag=" --prefix=${install_path['gcc']} --mandir=/usr/share/man --infodir=/usr/share/info \--with-bugurl=http://bugzilla.redhat.com/bugzilla \--enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib \--enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id \--with-linker-hash-style=gnu --enable-languages=c,c++,fortran --enable-plugin \--enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-cloog=${install_path['cloog']} \--with-isl=${install_path['isl']}  --with-gmp=${install_path['gmp']} \--with-mpc=${install_path['mpc']} --with-mpfr=${install_path['mpfr']}"eval ../$configure_cmdf $build_flageval make -j $core_num > /dev/null && make install > /dev/nullif [ $? -eq 0 ];thenecho "============================end build gcc=================================="if [ ! $had_env ];thenecho "########################################gcc "$2" env########################################" >> /etc/profileecho "BUILD_GCC_ENV="${install_path['isl']}"/lib:"${install_path['gmp']}"/lib:"${install_path['mpfr']}"/lib:" >>${install_path['cloog']}"/lib" /etc/profileecho "export BUILD_GCC_ENV" >> /etc/profileecho "LD_LIBRARY_PATH=\$BUILD_GCC_ENV:\$LD_LIBRARY_PATH" >> /etc/profileecho "export LD_LIBRARY_PATH" >> /etc/profileecho "PATH="${install_path['gcc']}"/bin:\${PATH}" >> /etc/profileecho "export PATH" >> /etc/profileecho "LD_LIBRARY_PATH="${install_path['gcc']}"/lib64:\${LD_LIBRARY_PATH}" >> /etc/profileecho "export LD_LIBRARY_PATH" >> /etc/profileecho "export INCLUDE="${install_path['gcc']}"/include:$INCLUDE" >> /etc/profileecho "########################################gcc "$2" env########################################" >> /etc/profilefielseecho "============================end build gcc(error)=================================="exit 1fi}function build_gcc(){checkmakecheck_versionmake_gmp ${ready_path['gmp']} ${softvss['gmp']}make_cloog ${ready_path['cloog']} ${softvss['cloog']}make_isl ${ready_path['isl']} ${softvss['isl']}make_mpfr ${ready_path['mpfr']} ${softvss['mpfr']}make_mpc ${ready_path['mpc']} ${softvss['mpc']}make_gcc ${ready_path['gcc']} ${softvss['gcc']}}build_gcc脚本运行完毕后,在当前环境需要立即生效,则使用命令  source /etc/profile或者重新打开一个新的会话===============================2021年7月6日16:30:38=================================先已经更新最新版本:1.多次安装问题解决2.支持x86cpu架构和aarch64架构3.修正系统build标签unknown字段4.支持任意版本的gcc和gcc依赖(tar压缩包,暂时不对zip压缩包提供支持),您可以通过替换相关的tar压缩包来达到更换gcc或者其依赖包的版本ps:解压,将z01-z08的后缀(.zip)删掉即可解压,安装完成后,执行命令 source /usr/local/gcc-版本号/enable 即可生效===============================2021年7月6日16:30:38=================================
  • [问题求助] 【GCC产品】【升级7.3.0功能】一句话描述问题
    【操作步骤&问题现象】1、配置后无法make,报错make: *** No targets specified and no makefile found.  Stop.2、因为是离线环境,无法yum 下载环境,有其他办法么【截图信息】
总条数:130 到第
上滑加载中