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

GitLab CI构建报错:mpif90与make命令未找到,求解决方案

问题解决:GitLab CI中mpif90和make命令找不到

能否自行解决?需要联系管理员吗?

完全可以自行解决,不需要联系管理员。问题核心是你使用的gcc:latest镜像默认未安装MPI编译工具(mpif90属于OpenMPI工具链)和make工具,只需修改CI配置文件补充依赖安装即可。

具体解决步骤

1. 临时安装依赖(快速验证)

gcc:latest基于Debian/Ubuntu系统,可在构建脚本开头通过apt安装所需工具:

stages:          
  - build
  - test
  - deploy

build-job:       
  stage: build
  image: gcc:latest
  script:
    # 安装MPI编译工具和make
    - apt update && apt install -y openmpi-bin openmpi-common libopenmpi-dev make
    - echo "Compiling the code..."
    - mpif90 -c dt_data_mod.F90
    - echo "Compile complete."

2. 使用预装依赖的镜像(更高效)

若不想每次构建重复安装依赖,可直接选用已预装gcc、MPI和make的镜像,比如OpenMPI官方提供的Ubuntu镜像:

build-job:       
  stage: build
  # 示例为OpenMPI 4.1.5基于Ubuntu 22.04的镜像
  image: openmpi/ubuntu:4.1.5
  script:
    - echo "Compiling the code..."
    - mpif90 -c dt_data_mod.F90
    - echo "Compile complete."

能否通过Makefile执行make命令?

完全可以实现。确保make工具已安装(参考上述步骤)后,直接在脚本中调用make命令即可:

build-job:       
  stage: build
  image: gcc:latest
  script:
    - apt update && apt install -y openmpi-bin openmpi-common libopenmpi-dev make
    # 执行Makefile默认目标
    - make
    # 若需指定目标,比如安装操作:
    # - make install

内容的提问来源于stack exchange,提问作者bob.sacamento

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 17:53:12