在Docker中安裝Centos6與VCS的踩坑記錄
感謝田佬的若干幫助,while (true) putchar('%');
-
安裝Centos6
-
拉取Centos6鏡像
- 使用下面命令拉取
docker pull centos:6
- 使用下面命令查看是否成功
docker images
- 如果拉取成功,結果如下(IMAGE ID, CREATED, SIZE可能不同)
REPOSITORY TAG IMAGE ID CREATED SIZE centos 6 d0957ffdf8a2 2 years ago 194MB
- 使用下面命令拉取
-
運行一個Centos6容器
- 使用下面的命令運行
docker run -it centos:6
- 出現下面的結果表明成功運行(7fee4585addb為容器ID,可能不同)
[root@7fee4585addb /]#
- 以這種方式運行容器時,hostname和mac地址是不確定的(本地運行兩個容器,hostname和mac地址分別如下)
[root@7fee4585addb /]# hostname 7fee4585addb [root@7fee4585addb /]# cat /sys/class/net/eth0/address 02:42:ac:11:00:02
[root@682672e6af90 /]# hostname 682672e6af90 [root@682672e6af90 /]# cat /sys/class/net/eth0/address 02:42:ac:11:00:03
- 為事先指定hostname和mac地址,可以通過
--hostname
和--mac-address
選項指定,下面的命令可以指定hostname為Tadokoro
,mac地址為02:42:AC:11:45:14
docker run -it --hostname Tadokoro --mac-address 02:42:AC:11:45:14 centos:6
- 查看容器的hostname和mac地址,此時為指定的內容
[root@Tadokoro /]# hostname Tadokoro [root@Tadokoro /]# cat /sys/class/net/eth0/address 02:42:ac:11:45:14
- 需要注意的是,hostname可以隨便寫,但mac地址不能太離譜,否則會出錯
docker run -it --hostname WrongMac --mac-address 11:22:33:44:55:66 centos:6
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: Running hook #0:: error running hook: exit status 1, stdout: , stderr: time="2021-08-05T23:09:08+08:00" level=fatal msg="failed to add interface vethf040ecb to sandbox: error setting interface \"vethf040ecb\" MAC to \"11:22:33:44:55:66\": cannot assign requested address": unknown. ERRO[0000] error waiting for container: context canceled
- 使用下面的命令運行
-
為Centos6容器換源
- 在Centos6中執行下面的命令
yum update
- 得到的結果如下
[root@Tadokoro /]# yum update Loaded plugins: fastestmirror, ovl Setting up Update Process YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. Invalid release/repo/arch combination/ removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
- 這是因為Centos6已經停止維護,相當一部分源都炸了,還有很多存在版本維護問題
- 下面是一個可以正常使用的源,來自此博客,感謝作者
https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-6.10 - Base - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6.10 - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6.10 - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6.10 - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6.10 - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
- 接下來要做的就是用上文的內容覆蓋
etc/yum.repos.d/CentOS-Base.repo
,下面是若干方法- 最蠢的方法,清空CentOS-Base.repo后,使用echo命令逐行追加,
筆者這么干了好久echo > CentOS-Base.repo echo "# CentOS-Base.repo" >> CentOS-Base.repo echo "#" >> CentOS-Base.repo echo "# The mirror system uses the connecting IP address of the client and the" >> CentOS-Base.repo ......
- 清空CentOS-Base.repo后,使用系統自帶的vi編輯,
筆者一度不知道有vi這東西echo > CentOS-Base.repo vi CentOS-Base.repo
- 本地准備好CentOS-Base.repo,拷貝進目標容器,覆蓋舊CentOS-Base.repo
docker cp CentOS-Base.repo [容器ID]:/etc/yum.repos.d/
- 直接curl地址,然后重定向給目標文件CentOS-Base.repo
curl https://www.xmpan.com/Centos-6-Vault-Aliyun.repo > CentOS-Base.repo
- 最蠢的方法,清空CentOS-Base.repo后,使用echo命令逐行追加,
- 再次執行
yum update
,結果正確Loaded plugins: fastestmirror, ovl Setting up Update Process Determining fastest mirrors base | 3.7 kB 00:00 base/primary_db | 4.7 MB 00:00 extras | 3.4 kB 00:00 extras/primary_db | 29 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 12 MB 00:01 Resolving Dependencies --> Running transaction check ---> Package bind-libs.x86_64 32:9.8.2-0.68.rc1.el6_10.1 will be updated ---> Package bind-libs.x86_64 32:9.8.2-0.68.rc1.el6_10.8 will be an update ---> Package bind-utils.x86_64 32:9.8.2-0.68.rc1.el6_10.1 will be updated ---> Package bind-utils.x86_64 32:9.8.2-0.68.rc1.el6_10.8 will be an update ---> Package binutils.x86_64 0:2.20.51.0.2-5.48.el6 will be updated ---> Package binutils.x86_64 0:2.20.51.0.2-5.48.el6_10.1 will be an update ---> Package ca-certificates.noarch 0:2018.2.22-65.1.el6 will be updated ---> Package ca-certificates.noarch 0:2020.2.41-65.1.el6_10 will be an update ---> Package curl.x86_64 0:7.19.7-53.el6_9 will be updated ---> Package curl.x86_64 0:7.19.7-54.el6_10 will be an update ---> Package dbus-libs.x86_64 1:1.2.24-9.el6 will be updated ......
- 在Centos6中執行下面的命令
-
安裝必須的包
- 執行
yum install gcc
- 在使用VCS編譯時,需要用到
- 在給snpslmd打補丁的時候,需要用到
- 執行
yum install gcc-c++
- 在使用VCS編譯時,需要用到
- 執行
yum install redhat-lsb
- 在使用lmgrd時,需要用到
- 執行
-
-
安裝與激活VCS
-
准備VCS安裝包
- 安裝包文件樹如下,其中scl_v2018.06_windows.exe和scl_keygen.zip無需拷貝進Docker
. ├── scl │ ├── scl_v2018.06_common.spf │ ├── scl_v2018.06_linux64.spf │ └── scl_v2018.06_windows.exe ├── scl_keygen.zip ├── synopsyinstaller │ ├── checksum_info.txt │ ├── installer_INSTALL_README.txt │ ├── snps_container_INSTALL_README.txt │ ├── snps_container_v1.0_common.spf │ └── SynopsysInstaller_v5.0.run ├── vcs │ ├── checksum_info.txt │ ├── vcs_INSTALL_README.txt │ ├── vcs_vO-2018.09-SP2_common.spf │ └── vcs_vO-2018.09-SP2_linux64.spf └── verdi ├── verdi_vVerdi_O-2018.09-SP2_common.spf └── verdi_vVerdi_O-2018.09-SP2_linux64.spf
- 計划安裝目錄為
/home/synopsys
,方便起見,將上述文件也置於home下,Docker內文件樹如下[root@Tadokoro home]# tree . ├── scl │ ├── scl_v2018.06_common.spf │ └── scl_v2018.06_linux64.spf ├── synopsyinstaller │ ├── checksum_info.txt │ ├── installer_INSTALL_README.txt │ ├── snps_container_INSTALL_README.txt │ ├── snps_container_v1.0_common.spf │ └── SynopsysInstaller_v5.0.run ├── synopsys ├── vcs │ ├── checksum_info.txt │ ├── vcs_INSTALL_README.txt │ ├── vcs_vO-2018.09-SP2_common.spf │ └── vcs_vO-2018.09-SP2_linux64.spf └── verdi ├── verdi_vVerdi_O-2018.09-SP2_common.spf └── verdi_vVerdi_O-2018.09-SP2_linux64.spf 5 directories, 13 files
- 安裝包文件樹如下,其中scl_v2018.06_windows.exe和scl_keygen.zip無需拷貝進Docker
-
安裝SynopsysInstaller
- 在
/home/synopsysInstaller
中,為SynopsysInstaller_v5.0.run添加權限[root@Tadokoro home]# cd synopsyinstaller/ [root@Tadokoro synopsyinstaller]# ls checksum_info.txt installer_INSTALL_README.txt snps_container_INSTALL_README.txt snps_container_v1.0_common.spf SynopsysInstaller_v5.0.run [root@Tadokoro synopsyinstaller]# chmod 777 SynopsysInstaller_v5.0.run
- 執行
SynopsysInstaller_v5.0.run
,地址填寫/home/synopsys
[root@Tadokoro synopsyinstaller]# ./SynopsysInstaller_v5.0.run #****************************************************************** # # Synopsys Installer Self-Extracting Executable # # This script extracts and installs Synopsys Installer 5.0 into # the given directory # # For help type: # # SynopsysInstaller_v5.0.run -help # #****************************************************************** Please specify installation directory [.]: /home/synopsys Installing Synopsys Installer 5.0 into the directory '/home/synopsys'... Unpacking: SynopsysInstaller.tgz ... Unpacking: singularity.tar.gz ... Installation complete.
- 在
-
安裝SCL, VCS, Verdi
- 在
/home/synopsys
中,執行installer,發現在root模式下使用-install_as_root
選項也無法正常啟動[root@Tadokoro home]# cd synopsys [root@Tadokoro synopsys]# ls batch_installer container container_setup.sh doc install_bin installer setup.sh [root@Tadokoro synopsys]# ./installer WARNING: The Installer must not be run from a root user account. Instead, Installer must be run from a regular user account. Installing tools from a root account is not supported; in certain cases this may cause a tool to fail to run properly for some or all users To run installer as root [not recommended];, please re-invoke installer with the -install_as_root switch. [root@Tadokoro synopsys]# ./installer -install_as_root invalid command name "id" while executing "id -un" (procedure "getUserName" line 5) invoked from within "getUserName" (procedure "SI_CORE::init" line 23) invoked from within "SI_CORE::init" (procedure "SI_CONFIG::init" line 2) invoked from within "SI_CONFIG::init" (procedure "SI_INSTALL::init" line 2) invoked from within "SI_INSTALL::init" (file "/home/synopsys/install_bin/pinstaller.tcl" line 9)
- 為此,需要創建一個用戶並切換到此用戶
[root@Tadokoro synopsyinstaller]# useradd usr [root@Tadokoro synopsys]# su usr [usr@Tadokoro synopsys]$ ls batch_installer container container_setup.sh doc install_bin installer setup.sh
- 在此用戶下執行installer,安裝SCL,發現權限不足
[usr@Tadokoro synopsys]$ ./installer Synopsys (R) Installer Version 5.0.0 Copyright (c) 2005 - 2021 Synopsys, Inc. This software and the associated documentation are proprietary to Synopsys, Inc. This software may only be used in accordance with the terms and conditions of a written license agreement with Synopsys, Inc. All other use, reproduction, or distribution of this software is strictly prohibited. Enter the path to the source directory containing the downloaded EFT file(s) [/home/synopsys]: /home/scl Enter the full path to the directory where you want to install Synopsys products. If the directory does not exist, it will be created. [/usr/synopsys]: /home/synopsys ERROR: Can't install product to destination /home/synopsys. Destination directory is not writable. use -target <target dir> to specify a different target directory
- 切換到root用戶,為synopsys文件夾添加權限
[usr@Tadokoro synopsys]$ exit exit [root@Tadokoro synopsys]# cd ../ [root@Tadokoro home]# chmod 777 synopsys [root@Tadokoro home]# cd synopsys [root@Tadokoro synopsys]# su usr
- 執行installer,安裝SCL,Site ID number無關緊要
[usr@Tadokoro synopsys]$ ./installer Synopsys (R) Installer Version 5.0.0 Copyright (c) 2005 - 2021 Synopsys, Inc. This software and the associated documentation are proprietary to Synopsys, Inc. This software may only be used in accordance with the terms and conditions of a written license agreement with Synopsys, Inc. All other use, reproduction, or distribution of this software is strictly prohibited. Enter the path to the source directory containing the downloaded EFT file(s) [/home/synopsys]: /home/scl Enter the full path to the directory where you want to install Synopsys products. If the directory does not exist, it will be created. [/usr/synopsys]: /home/synopsys Extracting release information from scl_v2018.06_linux64.spf Extracting release information from scl_v2018.06_linux64.spf successfully Extracting release information from scl_v2018.06_common.spf Extracting release information from scl_v2018.06_common.spf successfully Your site ID number is in the upper-right corner of your Synopsys license key certificate. If you have trouble locating it, contact your Synopsys representative. Site ID number [000]: 27000 ##################################################### ############### Installation Summary ################ Product: SCL (Synopsys Common Licensing) (scl) Release: 2018.06 Platforms: linux64 common Disk Space: 103 MB Target Dir: /home/synopsys/scl/2018.06 Licensed Products communicate with Synopsys servers for the purpose of providing software updates, detecting software piracy and verifying that customers are using Licensed Products in conformity with the applicable License Key for such Licensed Products. Synopsys will use information gathered in connection with this process to deliver software updates and pursue software pirates and infringers. ##################################################### If the information is correct, continue with the installation. Accept, Install? [yes]: yes INFO: Prepare for installing 2018.06 release of product scl ... INFO: Extracting linux64 package from scl_v2018.06_linux64.spf ... INFO: Extracting common package from scl_v2018.06_common.spf ... INFO: Verify SHA256 sum for scl.taz .... INFO: Verify SHA256 sum for linux64/scl.taz .... INFO: Installing 2018.06 release of product scl to /home/synopsys/scl/2018.06 .... INFO: Installing common package for 2018.06 release of product scl ... INFO: Installing linux64 package for 2018.06 release of product scl ... INFO: Installation for 2018.06 release of product scl has finished successfully. Synopsys tools require that a supported version of Synopsys Common Licensing (SCL) be installed and serving the necessary licenses. For information on how to obtain SCL, or your license key file, see http://www.synopsys.com/licensing For any postinstallation setup requirements, see the product-specific chapters in the Installation Guide at http://www.synopsys.com/install INFO: See installer log file /home/synopsys/installer.log
- 執行installer,安裝VCS,Site ID number同樣無關緊要
[usr@Tadokoro synopsys]$ ./installer Synopsys (R) Installer Version 5.0.0 Copyright (c) 2005 - 2021 Synopsys, Inc. This software and the associated documentation are proprietary to Synopsys, Inc. This software may only be used in accordance with the terms and conditions of a written license agreement with Synopsys, Inc. All other use, reproduction, or distribution of this software is strictly prohibited. Enter the path to the source directory containing the downloaded EFT file(s) [/home/synopsys]: /home/vcs Enter the full path to the directory where you want to install Synopsys products. If the directory does not exist, it will be created. [/usr/synopsys]: /home/synopsys Extracting release information from vcs_vO-2018.09-SP2_linux64.spf Extracting release information from vcs_vO-2018.09-SP2_linux64.spf successfully Extracting release information from vcs_vO-2018.09-SP2_common.spf Extracting release information from vcs_vO-2018.09-SP2_common.spf successfully Your site ID number is in the upper-right corner of your Synopsys license key certificate. If you have trouble locating it, contact your Synopsys representative. Site ID number [000]: 27000 Post installation setup for VCS - The high-performance, high-capacity Verilog® simulator: To use SmartSearch ,it is mandatory to download the Python package from SolvNet(Documentation --> VG SmartSearch). Enter the full path to the source directory: If Yes, please enter the full path to the source directory containing the VCS/VCS-MX Docs+SmartSearch tarball: Enter the full path where you want to install python [default location will be <VCS_HOME>/doc/UserGuide]: Do you wish to install the Docs+SmartSearch for VCS/VCS-MX ? : [yes]: no ##################################################### ############### Installation Summary ################ Product: VCS - The high-performance, high-capacity Verilog® simulator (vcs) Release: O-2018.09-SP2 Platforms: linux64 common Disk Space: 4431 MB Target Dir: /home/synopsys/vcs/O-2018.09-SP2 Licensed Products communicate with Synopsys servers for the purpose of providing software updates, detecting software piracy and verifying that customers are using Licensed Products in conformity with the applicable License Key for such Licensed Products. Synopsys will use information gathered in connection with this process to deliver software updates and pursue software pirates and infringers. ##################################################### If the information is correct, continue with the installation. Accept, Install? [yes]: yes INFO: Prepare for installing O-2018.09-SP2 release of product vcs ... INFO: Extracting linux64 package from vcs_vO-2018.09-SP2_linux64.spf ... INFO: Extracting common package from vcs_vO-2018.09-SP2_common.spf ... INFO: Verify SHA256 sum for vcs.bz2 .... INFO: Verify SHA256 sum for linux64/vcs.bz2 .... INFO: Installing O-2018.09-SP2 release of product vcs to /home/synopsys/vcs/O-2018.09-SP2 .... INFO: Installing common package for O-2018.09-SP2 release of product vcs ... INFO: Installing linux64 package for O-2018.09-SP2 release of product vcs ... INFO: Running post-installation script: /home/synopsys/vcs/O-2018.09-SP2/etc/post_install.sh -r /home/synopsys/vcs/O-2018.09-SP2 -plat "linux64" -pythonVersion "" -docSourcePath "" -pythonDestinationPath "default location will be <VCS_HOME>/doc/UserGuide" -installDoc "no" INFO: Installation for O-2018.09-SP2 release of product vcs has finished successfully. Synopsys tools require that a supported version of Synopsys Common Licensing (SCL) be installed and serving the necessary licenses. For information on how to obtain SCL, or your license key file, see http://www.synopsys.com/licensing For any postinstallation setup requirements, see the product-specific chapters in the Installation Guide at http://www.synopsys.com/install INFO: See installer log file /home/synopsys/installer.log
- 需要說明的是,安裝過程中會額外詢問是否需要Docs+SmartSearch,如果不需要,目錄可以隨便寫,Do you wish to install的時候不寫yes即可
To use SmartSearch ,it is mandatory to download the Python package from SolvNet(Documentation --> VG SmartSearch). Enter the full path to the source directory: If Yes, please enter the full path to the source directory containing the VCS/VCS-MX Docs+SmartSearch tarball: Enter the full path where you want to install python [default location will be <VCS_HOME>/doc/UserGuide]: Do you wish to install the Docs+SmartSearch for VCS/VCS-MX ? : [yes]: no
- 執行installer,安裝Verdi,Site ID number同樣無關緊要
[usr@Tadokoro synopsys]$ ./installer Synopsys (R) Installer Version 5.0.0 Copyright (c) 2005 - 2021 Synopsys, Inc. This software and the associated documentation are proprietary to Synopsys, Inc. This software may only be used in accordance with the terms and conditions of a written license agreement with Synopsys, Inc. All other use, reproduction, or distribution of this software is strictly prohibited. Enter the path to the source directory containing the downloaded EFT file(s) [/home/synopsys]: /home/verdi Enter the full path to the directory where you want to install Synopsys products. If the directory does not exist, it will be created. [/usr/synopsys]: /home/synopsys Extracting release information from verdi_vVerdi_O-2018.09-SP2_common.spf Extracting release information from verdi_vVerdi_O-2018.09-SP2_common.spf successfully Extracting release information from verdi_vVerdi_O-2018.09-SP2_linux64.spf Extracting release information from verdi_vVerdi_O-2018.09-SP2_linux64.spf successfully Your site ID number is in the upper-right corner of your Synopsys license key certificate. If you have trouble locating it, contact your Synopsys representative. Site ID number [000]: 27000 ##################################################### ############### Installation Summary ################ Product: VERDI - The Industry's Open Debug Platform (verdi) Release: Verdi_O-2018.09-SP2 Platforms: common linux64 Disk Space: 7535 MB Target Dir: /home/synopsys/verdi/Verdi_O-2018.09-SP2 Licensed Products communicate with Synopsys servers for the purpose of providing software updates, detecting software piracy and verifying that customers are using Licensed Products in conformity with the applicable License Key for such Licensed Products. Synopsys will use information gathered in connection with this process to deliver software updates and pursue software pirates and infringers. ##################################################### If the information is correct, continue with the installation. Accept, Install? [yes]: yes INFO: Prepare for installing Verdi_O-2018.09-SP2 release of product verdi ... INFO: Extracting common package from verdi_vVerdi_O-2018.09-SP2_common.spf ... INFO: Extracting linux64 package from verdi_vVerdi_O-2018.09-SP2_linux64.spf ... INFO: Verify SHA256 sum for verdi.bz2 .... INFO: Verify SHA256 sum for linux64/verdi.bz2 .... INFO: Installing Verdi_O-2018.09-SP2 release of product verdi to /home/synopsys/verdi/Verdi_O-2018.09-SP2 .... INFO: Installing common package for Verdi_O-2018.09-SP2 release of product verdi ... INFO: Installing linux64 package for Verdi_O-2018.09-SP2 release of product verdi ... INFO: Installation for Verdi_O-2018.09-SP2 release of product verdi has finished successfully. Synopsys tools require that a supported version of Synopsys Common Licensing (SCL) be installed and serving the necessary licenses. For information on how to obtain SCL, or your license key file, see http://www.synopsys.com/licensing For any postinstallation setup requirements, see the product-specific chapters in the Installation Guide at http://www.synopsys.com/install INFO: See installer log file /home/synopsys/installer.log
- 最后回到root用戶,把沒用的安裝文件清理一下,此外,之后沒有usr用戶什么事了
[usr@Tadokoro synopsys]$ exit exit [root@Tadokoro synopsys]# ls batch_installer container container_setup.sh doc install_bin installer installer.log scl setup.sh vcs verdi [root@Tadokoro synopsys]# rm installer.log rm: remove regular file `installer.log'? y [root@Tadokoro synopsys]# cd ../ [root@Tadokoro home]# ls scl synopsyinstaller synopsys usr vcs verdi [root@Tadokoro home]# rm -rf scl [root@Tadokoro home]# rm -rf synopsyinstaller/ [root@Tadokoro home]# rm -rf vcs [root@Tadokoro home]# rm -rf verdi [root@Tadokoro home]# chmod 755 synopsys/
- 在
-
准備證書文件
- 在Windows下啟動scl_keygen.exe並填寫內容,再點擊Generate生成Synopsys.dat
- HOST ID Daemon:填寫去掉冒號的mac地址
- HOST ID Feature:填寫去掉冒號的mac地址
- HOST Name:填寫hostname
- Port:填寫一個大一點的數防撞
-
- 修改Synopsys.dat第二行,添加SCL的目錄
DAEMON snpslmd ↓ DAEMON snpslmd /home/synopsys/scl/2018.06/linux64/bin/snpslmd
- 將證書文件分別放到
/home/synopsys/vcs/license
和/home/synopsys/verdi/license
[root@Tadokoro license]# ls Synopsys.dat [root@Tadokoro license]# pwd /home/synopsys/vcs/license
[root@Tadokoro license]# ls Synopsys.dat [root@Tadokoro license]# pwd /home/synopsys/verdi/license
- 在Windows下啟動scl_keygen.exe並填寫內容,再點擊Generate生成Synopsys.dat
-
激活證書文件
- 切換到
/home/synopsys/scl/2018.06/linux64/bin
,執行下面的指令./lmgrd -c /home/synopsys/vcs/license/Synopsys.dat
- 在筆者使用的Ubuntu20.04中,這樣可以成功激活證書,結果如下(結果較長,只需關注結尾部分)
...... 2:59:30 (snpslmd) (@snpslmd-SLOG@) =============================================== 2:59:30 (snpslmd) (@snpslmd-SLOG@) === Vendor Daemon === 2:59:30 (snpslmd) (@snpslmd-SLOG@) Vendor daemon: snpslmd 2:59:30 (snpslmd) (@snpslmd-SLOG@) Start-Date: Fri Aug 06 2021 02:59:30 UTC 2:59:30 (snpslmd) (@snpslmd-SLOG@) PID: 83 2:59:30 (snpslmd) (@snpslmd-SLOG@) VD Version: v11.14.1.3 build 212549 x64_lsb ( build 212549 (ipv6)) 2:59:30 (snpslmd) (@snpslmd-SLOG@) 2:59:30 (snpslmd) (@snpslmd-SLOG@) === Startup/Restart Info === 2:59:30 (snpslmd) (@snpslmd-SLOG@) Options file used: None 2:59:30 (snpslmd) (@snpslmd-SLOG@) Is vendor daemon a CVD: Yes 2:59:30 (snpslmd) (@snpslmd-SLOG@) Is TS accessed: No 2:59:30 (snpslmd) (@snpslmd-SLOG@) TS accessed for feature load: -NA- 2:59:30 (snpslmd) (@snpslmd-SLOG@) Number of VD restarts since LS startup: 0 2:59:30 (snpslmd) (@snpslmd-SLOG@) 2:59:30 (snpslmd) (@snpslmd-SLOG@) === Network Info === 2:59:30 (snpslmd) (@snpslmd-SLOG@) Listening port: 35911 2:59:30 (snpslmd) (@snpslmd-SLOG@) Daemon select timeout (in seconds): 1 2:59:30 (snpslmd) (@snpslmd-SLOG@) 2:59:30 (snpslmd) (@snpslmd-SLOG@) === Host Info === 2:59:30 (snpslmd) (@snpslmd-SLOG@) Host used in license file: Tadokoro 2:59:30 (snpslmd) (@snpslmd-SLOG@) Running on Hypervisor: Not determined - treat as Physical 2:59:30 (snpslmd) (@snpslmd-SLOG@) ===============================================
- 在Docker環境下,這樣往往會失敗,失敗時結果如下(結果較長,只需關注結尾部分)
...... 2:44:03 (snpslmd) Feature sparallel superseded by sparallel 2:44:03 (snpslmd) Cannot open daemon lock file 2:44:03 (snpslmd) EXITING DUE TO SIGNAL 41 Exit reason 9 2:44:03 (lmgrd) snpslmd exited with status 41 (Exited because another server was running) 2:44:03 (lmgrd) MULTIPLE "snpslmd" license server systems running. 2:44:03 (lmgrd) Please kill, and run lmreread 2:44:03 (lmgrd) 2:44:03 (lmgrd) This error probably results from either: 2:44:03 (lmgrd) 1. Another copy of the license server manager (lmgrd) is running. 2:44:03 (lmgrd) 2. A prior license server manager (lmgrd) was killed with "kill -9" 2:44:03 (lmgrd) (which would leave the vendor daemon running). 2:44:03 (lmgrd) To correct this, do a "ps -ax | grep snpslmd" 2:44:03 (lmgrd) (or equivalent "ps" command) 2:44:03 (lmgrd) and kill the "snpslmd" process.
- 對上述問題,可創建gen-snpslmd-hack.c處理(文件名無所謂),內容如下
#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <dlfcn.h> #include <string.h> static int is_root = 0; static int d_ino = -1; static DIR *(*orig_opendir)(const char *name); static int (*orig_closedir)(DIR *dirp); static struct dirent *(*orig_readdir)(DIR *dirp); DIR *opendir(const char *name) { if (strcmp(name, "/") == 0) is_root = 1; return orig_opendir(name); } int closedir(DIR *dirp) { is_root = 0; return orig_closedir(dirp); } struct dirent *readdir(DIR *dirp) { struct dirent *r = orig_readdir(dirp); if (is_root && r) { if (strcmp(r->d_name, ".") == 0) r->d_ino = d_ino; else if (strcmp(r->d_name, "..") == 0) r->d_ino = d_ino; } return r; } static __attribute__((constructor)) void init_methods() { orig_opendir = dlsym(RTLD_NEXT, "opendir"); orig_closedir = dlsym(RTLD_NEXT, "closedir"); orig_readdir = dlsym(RTLD_NEXT, "readdir"); DIR *d = orig_opendir("/"); struct dirent *e = orig_readdir(d); while (e) { if (strcmp(e->d_name, ".") == 0) { d_ino = e->d_ino; break; } e = orig_readdir(d); } orig_closedir(d); if (d_ino == -1) { puts("Failed to determine root directory inode number"); exit(EXIT_FAILURE); } }
- 使用下面的命令編譯上面的文件,完成后的目錄如下
[root@Tadokoro bin]# gcc -ldl -shared -fPIC gen-snpslmd-hack.c -o snpslmd-hack.so
[root@Tadokoro bin]# ls config.xml install_fnp.sh lmgrd lmstat README.TXT server_debug_conf.xml ssdm_admin sssverify watchlog.conf FNPLicensingService lmdiag lmhostid lmutil sclsh snpslmd ssdm_collect sssverify-trl whatscl gen-snpslmd-hack.c lmdown lmreread lmver sclsort snpslmd-hack.so sshostid watchlog [root@Tadokoro bin]# pwd /home/synopsys/scl/2018.06/linux64/bin
- 查看一下之前的打開的lmgrd是否已經關閉,如果沒有關閉使用lmdown關閉
[root@Tadokoro bin]# ps -a PID TTY TIME CMD 65 pts/1 00:00:00 lmgrd 78 pts/1 00:00:00 ps [root@Tadokoro bin]# ./lmdown lmdown - Copyright (c) 1989-2017 Flexera Software LLC. All Rights Reserved. Port@Host Vendors 1) 27000@Tadokoro snpslmd Are you sure (y/n)? y 2:57:07 (lmgrd) SHUTDOWN request from root at node Tadokoro 2:57:07 (lmgrd) lmgrd will now shut down all the vendor daemons 2:57:07 (lmgrd) EXITING DUE TO SIGNAL 15 1 FlexNet License Server shut down [root@Tadokoro bin]# ps -a PID TTY TIME CMD 80 pts/1 00:00:00 ps
- 再使用下面的命令重新激活證書,結果如下(結果較長,只需關注結尾部分),出現如下結果表明激活成功(對於這個問題的解決參考了此貼,感謝作者)
LD_PRELOAD=./snpslmd-hack.so ./lmgrd -c /home/synopsys/vcs/license/Synopsys.dat
...... 2:59:30 (snpslmd) (@snpslmd-SLOG@) =============================================== 2:59:30 (snpslmd) (@snpslmd-SLOG@) === Vendor Daemon === 2:59:30 (snpslmd) (@snpslmd-SLOG@) Vendor daemon: snpslmd 2:59:30 (snpslmd) (@snpslmd-SLOG@) Start-Date: Fri Aug 06 2021 02:59:30 UTC 2:59:30 (snpslmd) (@snpslmd-SLOG@) PID: 83 2:59:30 (snpslmd) (@snpslmd-SLOG@) VD Version: v11.14.1.3 build 212549 x64_lsb ( build 212549 (ipv6)) 2:59:30 (snpslmd) (@snpslmd-SLOG@) 2:59:30 (snpslmd) (@snpslmd-SLOG@) === Startup/Restart Info === 2:59:30 (snpslmd) (@snpslmd-SLOG@) Options file used: None 2:59:30 (snpslmd) (@snpslmd-SLOG@) Is vendor daemon a CVD: Yes 2:59:30 (snpslmd) (@snpslmd-SLOG@) Is TS accessed: No 2:59:30 (snpslmd) (@snpslmd-SLOG@) TS accessed for feature load: -NA- 2:59:30 (snpslmd) (@snpslmd-SLOG@) Number of VD restarts since LS startup: 0 2:59:30 (snpslmd) (@snpslmd-SLOG@) 2:59:30 (snpslmd) (@snpslmd-SLOG@) === Network Info === 2:59:30 (snpslmd) (@snpslmd-SLOG@) Listening port: 35911 2:59:30 (snpslmd) (@snpslmd-SLOG@) Daemon select timeout (in seconds): 1 2:59:30 (snpslmd) (@snpslmd-SLOG@) 2:59:30 (snpslmd) (@snpslmd-SLOG@) === Host Info === 2:59:30 (snpslmd) (@snpslmd-SLOG@) Host used in license file: Tadokoro 2:59:30 (snpslmd) (@snpslmd-SLOG@) Running on Hypervisor: Not determined - treat as Physical 2:59:30 (snpslmd) (@snpslmd-SLOG@) ===============================================
- 切換到
-
設置環境變量
- 將下面的內容追加到
/root/.bashrc
文件中即可,如采用了不同的安裝路徑,則需修改下文中的路徑,如采用了不同的hostname,則需修改下文中的LM_LICENSE_FILE#SCL export PATH=$PATH:/home/synopsys/scl/2018.06/linux64/bin export VCS_ARCH_OVERRIDE=linux #DVE export PATH=$PATH:/home/synopsys/vcs/O-2018.09-SP2/gui/dve/bin alias dve='dve -full64' #VCS export PATH=$PATH:/home/synopsys/vcs/O-2018.09-SP2/bin alias vcs='vcs -full64 -cpp g++ -cc gcc -LDFLAGS -Wl,--no-as-needed' #VERDI export PATH=$PATH:/home/synopsys/verdi/Verdi_O-2018.09-SP2/bin export VCS_HOME=/home/synopsys/vcs/O-2018.09-SP2 export VERDI_HOME=/home/synopsys/verdi/Verdi_O-2018.09-SP2 export NOVAS_HOME=/home/synopsys/verdi/Verdi_O-2018.09-SP2 alias verdi='verdi' #LICENCE export LM_LICENSE_FILE=27000@Tadokoro export LD_PRELOAD='/home/synopsys/scl/2018.06/linux64/bin/snpslmd-hack.so' alias lmg_vcs='/home/synopsys/scl/2018.06/linux64/bin/lmgrd -c /home/synopsys/vcs/license/Synopsys.dat'
- 使用下面的命令使新增的環境變量生效
source /root/.bashrc
- 此后再次需要激活證書時(如重啟容器后),只要使用下面的命令即可,此外,可根據需要制作鏡像,從鏡像運行容器時只要保證hostname和mac地址不發生變化,就可直接使用此命令激活證書並使用
[root@Tadokoro /]# lmg_vcs 3:10:27 (lmgrd) ----------------------------------------------- 3:10:27 (lmgrd) Please Note: 3:10:27 (lmgrd) 3:10:27 (lmgrd) This log is intended for debug purposes only. 3:10:27 (lmgrd) In order to capture accurate license 3:10:27 (lmgrd) usage data into an organized repository, 3:10:27 (lmgrd) please enable report logging. Use Flexera Software LLC's ......
- 將下面的內容追加到
-
檢查安裝是否成功
- 使用下面的文件進行測試,測試目錄如下
module tb(); initial begin $display("hello world"); $finish; end endmodule
[root@Tadokoro test]# ls tb.v [root@Tadokoro test]# pwd /home/test
- 使用下面的命令編譯文件,結果如下(結果較長,只需關注結尾部分)
vcs tb.v -full64 -cpp g++ -cc gcc +lint=TFIPC-L -override_timescale=1ns/1ps
...... rm -f _csrc*.so pre_vcsobj_*.so share_vcsobj_*.so if [ -x ../simv ]; then chmod -x ../simv; fi g++ -o ../simv -Wl,-rpath-link=./ -Wl,-rpath='$ORIGIN'/simv.daidir/ -Wl,-rpath=./simv.daidir/ -Wl,-rpath='$ORIGIN'/simv.daidir//scsim.db.dir -Wl,--no-as-needed -rdynamic -Wl,-rpath=/home/synopsys/vcs/O-2018.09-SP2/linux64/lib -L/home/synopsys/vcs/O-2018.09-SP2/linux64/lib objs/amcQw_d.o _485_archive_1.so SIM_l.o rmapats_mop.o rmapats.o rmar.o rmar_nd.o rmar_llvm_0_1.o rmar_llvm_0_0.o -lzerosoft_rt_stubs -lvirsim -lerrorinf -lsnpsmalloc -lvfs -lvcsnew -lsimprofile -luclinative /home/synopsys/vcs/O-2018.09-SP2/linux64/lib/vcs_tls.o -Wl,-whole-archive -lvcsucli -Wl,-no-whole-archive /home/synopsys/vcs/O-2018.09-SP2/linux64/lib/vcs_save_restore_new.o -ldl -lc -lm -lpthread -ldl ../simv up to date CPU time: .206 seconds to compile + .302 seconds to elab + .203 seconds to link
- 使用下面的命令執行文件,結果如下表明成功
./simv
4:03:57 (snpslmd) OUT: "VCSRuntime_Net" root@Tadokoro [snps_checkout_1628222637] Chronologic VCS simulator copyright 1991-2018 Contains Synopsys proprietary information. Compiler version O-2018.09-SP2_Full64; Runtime version O-2018.09-SP2_Full64; Aug 6 04:03 2021 hello world $finish called from file "tb.v", line 5. $finish at simulation time 0 V C S S i m u l a t i o n R e p o r t Time: 0 ps CPU Time: 0.370 seconds; Data structure size: 0.0Mb Fri Aug 6 04:03:57 2021 4:03:57 (snpslmd) IN: "VCSRuntime_Net" root@Tadokoro [snps_checkout_1628222637]
- 使用下面的文件進行測試,測試目錄如下
-