Getting the error “make: [Makefile:2: all] Error 127” when I use the make command

五迷三道 提交于 2020-12-15 06:23:06

问题


I am trying to install this project onto my computer and have been running into issue after issue.

The roadblock I've run into now is error 127. Most of the install works fine, until it gets to the step "make." I get the following output:

mkdir -p build && cd build && cmake .. && make
/bin/sh: cmake: commant not found
make: *** [Makefile:2: all] Error 127

I have tried installing on Git Bash for Windows 10 and using the terminal in CentOS. Both give me the same error. I have tried installing cmake on CentOS, but I'm unsure what to do with it now that it is installed. I also installed MinGW onto the Windows machine, but with no luck.

I'm relatively new to Linux/Unix (and very new to Git) so if the answer is obvious, I apologize.

I have found other questions similar to this, but the answer is always something along the lines of "it is trying to build something and it can't. need more context"

edit: Cmake is installed (as far as I can tell). I used this walk through to install it (updating the file names and stuff to correspond with the current version of cmake). The cmake directory was installed in the Downloads directory until I moved it (details below).

Someone had suggested that the cmake wasn't in a directory accessible to the $PATH variable. I moved it into a directory that I had added to the $PATH variable a while ago, but I am still getting the same error.

Edit 2: Alright, so I installed cmake through the CentOS software app thing. The make command works now, but theres a different problem. Running the make command outputs errors. The CMakerror.log file is filled with this over and over again:

Compilling the CXX compiler identification source file "CMakeCXXComilerID.cpp" failed
Compiler: CMAKE_CXX_COMPILER-NOTFOUND
Build flags:
Id flags: -c

The output was:
No such file or directory

There are a bunhc of different entries like this, the only difference between them is that the Id flags bit sometimes has a "-c" but it also does "--c++" and "--ec++"

Edit 3: Here is the output from using the make command:

mkdir -p build && cd build && cmake .. && make
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.11)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "/home/ellingtonj/wave-gui/CMakeFiles/CMakeOutput.log".
See also "/home/ellingtonj/wave-gui/CMakeFiles/CMakeError.log".
make: *** [Makefile:2: all] Error 1

I checked the CMakeLists.txt file and there is, in fact a cmake_minimum_required line (It specifically says "cmake_minimum_required (VERSION 2.8)").

Edit 4: A user below suggested I may not have gcc/g++ installed. So I used this tutorial to install gcc. Now I get error 2. Progress!! The ouput of the make command is below:

mkdir -p build && cd build && cmake .. && make
-- The CXX compiler identification is GNU 8.3.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Creating program 'wave-gui' with sources:
--    main.cpp
--    app.cpp
--    core.cpp
--    ui.cpp
--    data.cpp
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.11)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/ellingtonj/wave-gui
make[1]: Entering directory '/home/ellingtonj/wave-gui/build'
make[1]: *** No targets specified and no makefile found.  Stop.
make[1]: Leaving directory '/home/ellingtonj/wave-gui/build'
make: *** [Makefile:2: all] Error 2

Before anyone says it, yes, there is a makefile in the directory. Here is the output of ls for the directory I'm working in:

build  CMakeCache.txt  cmake_install.cmake  external  main      README.md
cmake  CMakeFiles      CMakeLists.txt       LICENSE   Makefile  src

Edit 5: I renamed "Makefile" on the off chance that it was looking for "makefile" and it kinda worked. I got a new error message which is good. Kinda. make ouput below:

-- Creating program 'wave-gui' with sources:
--    main.cpp
--    app.cpp
--    core.cpp
--    ui.cpp
--    data.cpp
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.11)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/ellingtonj/wave-gui
Scanning dependencies of target wave-gui
[ 16%] Building CXX object CMakeFiles/wave-gui.dir/main.o
/home/ellingtonj/wave-gui/main/main.cpp:10:10: fatal error: cg_config.h: No such file or directory
 #include "cg_config.h"
          ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/wave-gui.dir/build.make:63: CMakeFiles/wave-gui.dir/main.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/wave-gui.dir/all] Error 2
make: *** [makefile:130: all] Error 2

Edit 6(?): my problem has changed so much that I figured a new thread should be made to more accurately reflect the problem I'm dealing with. This thread is located here.


回答1:


You need to install CMake first and there are several ways to install CMake, depending on your platform. You can grab the binaries from here.



来源:https://stackoverflow.com/questions/64529531/getting-the-error-make-makefile2-all-error-127-when-i-use-the-make-comman

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!