Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. #59750

Closed
liudonghua123 opened this issue Jun 18, 2020 · 7 comments

Comments

@liudonghua123
Copy link

Steps to Reproduce

  1. I used the master channel of flutter
  2. Then I want to build linux binary for upload to release. The releated github action file is below.
name: Linux-CI

on:
  push:
    branches:
      - master
    tags:
      - '*'

jobs:
  build:
    runs-on: ubuntu-latest
    if: contains(github.ref, 'tags')
    steps:
      - uses: actions/checkout@v2
      - name: Branch name
        id: branch_name
        run: |
          echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
          echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
          echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}

      - uses: actions/setup-java@v1
        with:
          java-version: '8.x'
      - uses: subosito/flutter-action@v1
        with:
          channel: 'dev'

      - name: Change flutter channel to master, enable linux support
        run: |
          flutter channel master
          flutter upgrade
          flutter config --enable-linux-desktop
          flutter pub get

      - name: Build linux
        run: |
          flutter build linux

      - name: Debug
        run: |
          sudo npm install tree-node-cli -g
          treee build

      - name: Prepare release files
        run: |
          cp -r build/linux/release python_exercise_builder-linux-${{ steps.branch_name.outputs.SOURCE_NAME }}
          zip python_exercise_builder-linux-${{ steps.branch_name.outputs.SOURCE_NAME }}.zip -r python_exercise_builder-linux-${{ steps.branch_name.outputs.SOURCE_NAME }}

      - name: Upload binaries to release
        uses: svenstaro/upload-release-action@v1-release
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          file: python_exercise_builder-*
          tag: ${{ github.ref }}
          overwrite: true
          file_glob: true
  1. When the ci run, it failed with the following error.

Expected results:
Linux build successfully.

Actual results:
Linux build failed.

Logs
Run flutter build linux
Downloading linux-x64/linux-x64-flutter-gtk tools...                1.5s
Downloading linux-x64-profile/linux-x64-flutter-gtk tools...         0.9s
Downloading linux-x64-release/linux-x64-flutter-gtk tools...         0.8s
Building Linux application...                                   
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Unable to generate build files
##[error]Process completed with exit code 1.
@stuartmorgan
Copy link
Contributor

Building for Linux requires ninja, as indicated by flutter doctor.

@liudonghua123
Copy link
Author

Hi @stuartmorgan, I tried to install ninja via add - uses: seanmiddleditch/gha-setup-ninja@master in my github workflow. Now it have ninja, but it failed with another error.

Run flutter build linux
Downloading linux-x64/linux-x64-flutter-gtk tools...                1.5s
Downloading linux-x64-profile/linux-x64-flutter-gtk tools...         0.9s
Downloading linux-x64-release/linux-x64-flutter-gtk tools...         0.5s
Building Linux application...                                   
CMake Error at /usr/local/share/cmake-3.17/Modules/FindPkgConfig.cmake:467 (message):

  A required package was not found

Call Stack (most recent call first):

  /usr/local/share/cmake-3.17/Modules/FindPkgConfig.cmake:647 (_pkg_check_modules_internal)

  flutter/CMakeLists.txt:24 (pkg_check_modules)




Unable to generate build files
##[error]Process completed with exit code 1.

Any ideas about this problem?

@stuartmorgan
Copy link
Contributor

This is why flutter doctor exists; you need to run it, and install everything it tells you is necessary.

@liudonghua123
Copy link
Author

Finally, I can add a step like the following to make it work for linux package.


      - name: Patch for linux build
        run: |
          flutter doctor
          sudo apt-get update -y
          sudo apt-get install -y ninja-build libgtk-3-dev
          flutter doctor

@oluwatbi
Copy link

oluwatbi commented Jul 9, 2020

Yea I ran into same issue when trying to set up flutter for Linux desktop. Thanks to flutter doctor. The result after running the flutter doctor command shows that some of the building programs are missing

  1. clang++ required sudo apt install clang fixed that
  2. ninja is required sudo apt install ninja-build fixed that
  3. GTK 3.0 required sudo apt install libgtk-3-dev fixed that also

You'd get other similar errors and sudo apt install <package> command should fix the thing 👍👍👍👍👍

Screenshot from 2020-07-09 11-55-20

@VergeDX
Copy link

VergeDX commented May 27, 2021

Always remember apt install xxx -y or it will be stuck in Confirmation.

@github-actions
Copy link

github-actions bot commented Aug 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants