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

Github Actions编译报错:找不到Makefile.in,本地编译正常

问题解决方法

解决「cannot find input file: Makefile.in」错误

  • 先检查代码仓库里是否存在Makefile.in、configure.ac、Makefile.am这些autotools相关文件。你本地能正常编译,大概率是已经用autotools生成过这些文件,但没把生成所需的源文件提交到仓库,导致GitHub Actions环境里无法生成Makefile.in。
  • 在Workflow中添加autotools工具安装和文件生成步骤:
    - name: 安装autotools工具
      run: brew install autoconf automake libtool
    - run: autoreconf -i
    
    因为你使用的是macos-latest环境,所以用brew安装工具。执行autoreconf -i会自动生成configure脚本和Makefile.in等必要文件。
  • 确保在执行./configure前,上述步骤已完成并生成所需文件。

解决「无法创建/进入文件夹」问题

  • GitHub Actions的每个run步骤都是独立的shell会话,前一个步骤的目录操作不会保留到下一个步骤。比如单独执行mkdir build后,下一个步骤的shell仍处于仓库根目录,无法直接cd build。有两种解决方式:
    1. 在同一个run步骤里用&&串联命令:
      - run: mkdir build && cd build && ./configure CC="gcc"
      
    2. 使用working-directory参数指定步骤的工作目录:
      - run: mkdir build
      - name: Configure
        run: ./configure CC="gcc"
        working-directory: ./build
      

修改后的完整Workflow示例

name: C/C++ CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v3
    - name: 安装autotools工具
      run: brew install autoconf automake libtool
    - run: autoreconf -i
    - run: chmod +x ./configure
    - name: Configure
      run: ./configure CC="gcc"
    - name: make
      run: make

内容的提问来源于stack exchange,提问作者Andereoo

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.31 15:05:43