Make Error 127 [Makefile:136: all] Error 2

Quick disclaimer: I am a novice. Feel free to explain things.

I am attempting to run these scripts to compile a custom build of ffmpeg:

I originally had questions about this project that I posted on Stack Overflow (more details there):

My OS is Windows 11 Pro 64-bit, Version 10.0.22621 Build 22621

To accomplish this, I did the following:

  1. Installed MINGw64 and MINGw32
  2. Ran some pacman commands to install various libraries (gcc, g++, cmake)
  3. Placed the project in C:\01Code\ATW
  4. Started running the commands listed on the github page.
  5. Updated PATH environmental variable to include “C:\msys64\mingw64\bin”

Originally, I had a problem with cmake - it could not locate the compilers. I fixed this by editing the CMakeLists.txt file included with this project and setting explicit paths, then I had to change \ to / in the path and it worked.

The next step is to run “make install”, which looks like this:

make install
[ 25%] Building C object CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj
[ 50%] Linking C static library libAudioToolboxWrapper.a
make[1]: /bin/sh: No such file or directory
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/AudioToolboxWrapper.dir/all] Error 127
make: *** [Makefile:136: all] Error 2

I’ve looked through dozens of topics on here and StackOverflow about this and typically the advice is “edit your PATH variable” and the like. I’ve tried that, no luck.

I have several questions:

  1. The error I was seeing with ‘cmake’ was similar to the one above - I was able to fix that by editing the CMakeLists.txt file. Is there a similar “instruction set” file for ‘make’?
  2. Where can I find the logs or activity for ‘make’? When I was trying to debug the ‘cmake’ script, I opened “CMakeConfigureLog.yaml” to see the activity, output and specific errors that ‘cmake’ was throwing. I do not see a similar file anywhere for ‘make’.
    2a. I tried running the command ‘make install > output.txt’ to address my second question (someone said this would produce output to debug ‘make’) but that just made a blank text document.

Please advise, happy to send whatever logs or syntax that would be helpful to you all - TIA.

It seems like your environment is not set up correctly. Can you run MinGW tooling (including sh) from where you ran make?

I would be happy to! I just don’t know what “run MinGW tooling (including sh)” means.
When I start MinGW, I cd to:
C:\01Code\ATW\build
That’s the directory I ran make from. Are you asking me to move the build to the directory where MinGW is installed? I’m open to any suggestions, I just want to understanding how to implement the advice.

Hmm. Something seems weird here. MinGW is usually in an MSYS environment where paths look like /c/01Code/ATW/build

Oh it does, sorry, I just copied and pasted the windows filepath where I put the build files.
In MinGW, it looks like you have it above (screenshot below)

Hmm. That is still odd. Can you do make VERBOSE=1 to see the actual command that is failing?

Oh nice, that sheds some more light on this. I bolded the section that looks like it gives the most information.
EDIT: Including several blocks of output here.

1. AFTER running make install once (and failing), make install VERBOSE=1 gave the following output:

make install VERBOSE=1
C:/msys64/mingw64/bin/cmake.exe -SC:/01Code/ATW -BC:/01Code/ATW/build --check-build-system CMakeFiles/Makefile.cmake 0
C:/msys64/mingw64/bin/cmake.exe -E cmake_progress_start C:/01Code/ATW/build/CMakeFiles C:/01Code/ATW/build//CMakeFiles/progress.marks
C:/msys64/mingw64/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory ‘/c/01code/atw/build’
/mingw64/bin/make -f CMakeFiles/AudioToolboxWrapper.dir/build.make CMakeFiles/AudioToolboxWrapper.dir/depend
make[2]: Entering directory ‘C:/01code/atw/build’
C:/msys64/mingw64/bin/cmake.exe -E cmake_depends “Unix Makefiles” C:/01Code/ATW C:/01Code/ATW C:/01Code/ATW/build C:/01Code/ATW/build C:/01Code/ATW/build/CMakeFiles/AudioToolboxWrapper.dir/DependInfo.cmake “–color=”
Dependencies file “CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj.d” is newer than depends file “C:/01Code/ATW/build/CMakeFiles/AudioToolboxWrapper.dir/compiler_depend.internal”.
Consolidate compiler generated dependencies of target AudioToolboxWrapper
make[2]: Leaving directory ‘C:/01code/atw/build’
/mingw64/bin/make -f CMakeFiles/AudioToolboxWrapper.dir/build.make CMakeFiles/AudioToolboxWrapper.dir/build
make[2]: Entering directory ‘C:/01code/atw/build’
make[2]: Nothing to be done for ‘CMakeFiles/AudioToolboxWrapper.dir/build’.
make[2]: Leaving directory ‘C:/01code/atw/build’
make[1]: /bin/sh: No such file or directory
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/AudioToolboxWrapper.dir/all] Error 127
make[1]: Leaving directory ‘/c/01code/atw/build’
make: *** [Makefile:136: all] Error 2

2. Cleared out the build folder, ran cmake command again, then ran a “fresh” make install =VERBOSE, with the following output:

make install VERBOSE=1
C:/msys64/mingw64/bin/cmake.exe -SC:/01Code/ATW -BC:/01Code/ATW/build --check-build-system CMakeFiles/Makefile.cmake 0
C:/msys64/mingw64/bin/cmake.exe -E cmake_progress_start C:/01Code/ATW/build/CMakeFiles C:/01Code/ATW/build//CMakeFiles/progress.marks
C:/msys64/mingw64/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory ‘/c/01code/atw/build’
/mingw64/bin/make -f CMakeFiles/AudioToolboxWrapper.dir/build.make CMakeFiles/AudioToolboxWrapper.dir/depend
make[2]: Entering directory ‘C:/01code/atw/build’
C:/msys64/mingw64/bin/cmake.exe -E cmake_depends “Unix Makefiles” C:/01Code/ATW C:/01Code/ATW C:/01Code/ATW/build C:/01Code/ATW/build C:/01Code/ATW/build/CMakeFiles/AudioToolboxWrapper.dir/DependInfo.cmake “–color=”
make[2]: Leaving directory ‘C:/01code/atw/build’
/mingw64/bin/make -f CMakeFiles/AudioToolboxWrapper.dir/build.make CMakeFiles/AudioToolboxWrapper.dir/build
make[2]: Entering directory ‘C:/01code/atw/build’
[ 25%] Building C object CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj
C:/msys64/mingw64/bin/gcc.exe @CMakeFiles/AudioToolboxWrapper.dir/includes_C.rsp -fno-ident -fno-unwind-tables -fno-asynchronous-unwind-tables -nostdlib -nostartfiles -nodefaultlibs -MD -MT CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj -MF CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj.d -o CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj -c C:/01Code/ATW/src/AudioToolboxLoader.c
[ 50%] Linking C static library libAudioToolboxWrapper.a
C:/msys64/mingw64/bin/cmake.exe -P CMakeFiles/AudioToolboxWrapper.dir/cmake_clean_target.cmake
C:/msys64/mingw64/bin/cmake.exe -E cmake_link_script CMakeFiles/AudioToolboxWrapper.dir/link.txt --verbose=1
C:/msys64/mingw64/bin/ar.exe qc libAudioToolboxWrapper.a CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj
C:/msys64/mingw64/bin/ranlib.exe libAudioToolboxWrapper.a
make[2]: Leaving directory ‘C:/01code/atw/build’
make[1]: /bin/sh: No such file or directory
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/AudioToolboxWrapper.dir/all] Error 127
make[1]: Leaving directory ‘/c/01code/atw/build’
make: *** [Makefile:136: all] Error 2

Also I realize I just did make install VERBOSE=1 instead of what you wrote.
EDIT: Including several blocks of output here

3. Cleared out build folder, re-ran cmake command, then a “fresh” make VERBOSE=1 gave the following output:

make VERBOSE=1
C:/msys64/mingw64/bin/cmake.exe -SC:/01Code/ATW -BC:/01Code/ATW/build --check-build-system CMakeFiles/Makefile.cmake 0
C:/msys64/mingw64/bin/cmake.exe -E cmake_progress_start C:/01Code/ATW/build/CMakeFiles C:/01Code/ATW/build//CMakeFiles/progress.marks
C:/msys64/mingw64/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory ‘/c/01code/atw/build’
/mingw64/bin/make -f CMakeFiles/AudioToolboxWrapper.dir/build.make CMakeFiles/AudioToolboxWrapper.dir/depend
make[2]: Entering directory ‘C:/01code/atw/build’
C:/msys64/mingw64/bin/cmake.exe -E cmake_depends “Unix Makefiles” C:/01Code/ATW C:/01Code/ATW C:/01Code/ATW/build C:/01Code/ATW/build C:/01Code/ATW/build/CMakeFiles/AudioToolboxWrapper.dir/DependInfo.cmake “–color=”
make[2]: Leaving directory ‘C:/01code/atw/build’
/mingw64/bin/make -f CMakeFiles/AudioToolboxWrapper.dir/build.make CMakeFiles/AudioToolboxWrapper.dir/build
make[2]: Entering directory ‘C:/01code/atw/build’
[ 25%] Building C object CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj
C:/msys64/mingw64/bin/gcc.exe @CMakeFiles/AudioToolboxWrapper.dir/includes_C.rsp -fno-ident -fno-unwind-tables -fno-asynchronous-unwind-tables -nostdlib -nostartfiles -nodefaultlibs -MD -MT CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj -MF CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj.d -o CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj -c C:/01Code/ATW/src/AudioToolboxLoader.c
[ 50%] Linking C static library libAudioToolboxWrapper.a
C:/msys64/mingw64/bin/cmake.exe -P CMakeFiles/AudioToolboxWrapper.dir/cmake_clean_target.cmake
C:/msys64/mingw64/bin/cmake.exe -E cmake_link_script CMakeFiles/AudioToolboxWrapper.dir/link.txt --verbose=1
C:/msys64/mingw64/bin/ar.exe qc libAudioToolboxWrapper.a CMakeFiles/AudioToolboxWrapper.dir/src/AudioToolboxLoader.c.obj
C:/msys64/mingw64/bin/ranlib.exe libAudioToolboxWrapper.a
make[2]: Leaving directory ‘C:/01code/atw/build’
make[1]: /bin/sh: No such file or directory
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/AudioToolboxWrapper.dir/all] Error 127
make[1]: Leaving directory ‘/c/01code/atw/build’
make: *** [Makefile:136: all] Error 2

4. Here is output for make VERBOSE=1 AFTER a previous run of make install had already failed:

make VERBOSE=1
C:/msys64/mingw64/bin/cmake.exe -SC:/01Code/ATW -BC:/01Code/ATW/build --check-build-system CMakeFiles/Makefile.cmake 0
C:/msys64/mingw64/bin/cmake.exe -E cmake_progress_start C:/01Code/ATW/build/CMakeFiles C:/01Code/ATW/build//CMakeFiles/progress.marks
C:/msys64/mingw64/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory ‘/c/01code/atw/build’
/mingw64/bin/make -f CMakeFiles/AudioToolboxWrapper.dir/build.make CMakeFiles/AudioToolboxWrapper.dir/depend
make[2]: Entering directory ‘C:/01code/atw/build’
C:/msys64/mingw64/bin/cmake.exe -E cmake_depends “Unix Makefiles” C:/01Code/ATW C:/01Code/ATW C:/01Code/ATW/build C:/01Code/ATW/build C:/01Code/ATW/build/CMakeFiles/AudioToolboxWrapper.dir/DependInfo.cmake “–color=”
make[2]: Leaving directory ‘C:/01code/atw/build’
/mingw64/bin/make -f CMakeFiles/AudioToolboxWrapper.dir/build.make CMakeFiles/AudioToolboxWrapper.dir/build
make[2]: Entering directory ‘C:/01code/atw/build’
make[2]: Nothing to be done for ‘CMakeFiles/AudioToolboxWrapper.dir/build’.
make[2]: Leaving directory ‘C:/01code/atw/build’
make[1]: /bin/sh: No such file or directory
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/AudioToolboxWrapper.dir/all] Error 127
make[1]: Leaving directory ‘/c/01code/atw/build’
make: *** [Makefile:136: all] Error 2

Also, here is the text of the Makefile2 referenced in Error 127. It looks like line 86 of this is causing the error?

Okay, I got it to run. I’m not sure which of these things did the trick, but here is what I did:

  1. Uninstalled MSYS2 entirely, rebooted.
  2. Reinstalled MSYS2, rebooted.
  3. Opened MINGW64, ran the following commands:
    pacman -Suy
    pacman -Suy (again x2)
    pacman -S mingw-w64-x86_64-gcc
    pacman -S mingw-w64-x86_64-cmake
    pacman -S make
    pacman -Suy
  4. Closed MINGW64, updated system environmental variable PATH to include the following directories:
    o C:\msys64\mingw64\bin\ (this was already there, just being thorough)
    o C:\msys64\mingw64\lib\
    o C:\msys64\mingw64\
  5. Opened MING64, ran the scripts again, everything went through this time.