You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编译遇PGI许可证问题且无sudo权限,如何让gmake成功执行?

无sudo权限下解决PGI编译器许可证问题及gmake执行失败

问题场景

执行gmake Makefile时触发PGI编译器许可证错误:

[saicma@me]$ gmake Makefile
mpif90 -I/include   -I/path/to/Par  -I/path/to/mod  -I/path/to/include -c -o /path/to/*.o /path/to/*.f
pgi-f95-lin64: LICENSE MANAGER PROBLEM: Cannot find license file.
 The license files (or license server system network addresses) attempted are 
listed below.  Use LM_LICENSE_FILE to use a different license file,
 or contact your software provider for a license file.
Feature:       pgi-f95-lin64
Filename:      /pkg/pgi/license.dat
License path:  /pkg/pgi/license.dat:
FlexNet Licensing error:-1,359.  System Error: 2 "No such file or directory"
For further information, refer to the FlexNet Licensing documentation,
available at "www.flexerasoftware.com".
gmake: *** [/path/to/*.o] Error 2

尝试运行PGI许可证生成工具/pkg/pgi/linux86-64/14.10/bin/pgi_license_tool时,出现依赖缺失及权限错误:

[saicma@me bin]$ ./pgi_license_tool
./pgi_license_tool: /pkg/pgi/linux86-64/14.10/bin/lmutil: /lib64/ld-lsb-x86-64.so.3: bad ELF interpreter: No such file or directory

The FLEXlm hostid for this computer is empty.  License keys cannot be 
created.  Please go to http://www.pgroup.com/support/faq.htm for more
details on licensing your PGI product.


The PGI license tool can be re-started by running the script located at
/pkg/pgi/linux86-64/14.10/bin/pgi_license_tool.

/bin/rm: cannot remove `/pkg/pgi/license.info': Permission denied
./pgi_license_tool: line 64: /pkg/pgi/license.info: Permission denied

官方给出的解决方案需要sudo权限创建系统级软链接,但当前无sudo权限,以下是可行解决步骤:

解决步骤

1. 绕过LSB库依赖(无sudo权限)

PGI的lmutil工具依赖/lib64/ld-lsb-x86-64.so.3,可以在用户目录创建软链接并通过环境变量让工具识别:

  • 创建用户级lib目录:
    mkdir -p ~/lib64
    
  • 链接系统现有ld库到用户目录(根据系统实际路径选择其中一条):
    # 适用于RHEL/CentOS等系统
    ln -s /lib64/ld-linux-x86-64.so.2 ~/lib64/ld-lsb-x86-64.so.3
    # 适用于Debian/Ubuntu等系统
    ln -s /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ~/lib64/ld-lsb-x86-64.so.3
    
  • 设置临时环境变量,让工具优先加载用户目录的库:
    export LD_LIBRARY_PATH=~/lib64:$LD_LIBRARY_PATH
    

2. 获取主机ID并手动申请许可证

由于无法修改/pkg/pgi目录下的文件,将许可证工具的输出重定向到用户自有目录:

/pkg/pgi/linux86-64/14.10/bin/pgi_license_tool > ~/my_hostid.info

打开~/my_hostid.info提取主机ID信息,之后通过PGI账号手动申请许可证,将获取到的许可证内容保存到用户目录下的文件(比如~/license.dat)。

3. 指定许可证文件路径

设置环境变量让PGI编译器识别自定义许可证文件:

export LM_LICENSE_FILE=~/license.dat

4. 执行gmake

确保上述环境变量生效后,重新执行:

gmake Makefile

备选方案:替换为系统自带编译器

如果系统已安装开源Fortran编译器(如gfortran),可以修改Makefile中的编译器配置:

  • 打开Makefile,找到类似FC=mpif90的行,替换为:
    FC=mpifort  # 对应gfortran的MPI封装版本
    # 无需MPI时可直接使用
    # FC=gfortran
    
  • 保存后执行gmake Makefile即可,无需依赖PGI许可证。

内容的提问来源于stack exchange,提问作者saic-ma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 01:10:54