3

After running the ./make.exe command (By using GNUWin32), I get the following error:

mkdir -p obj   
mkdir -p backup   
A subdirectory or file -p already exists.  
Error occurred while processing: -p. make: *** [backup] Error 1

After rerunning the command, I get a different error:

mkdir -p results
A subdirectory or file -p already exists.
Error occurred while processing: -p.
make: *** [results] Error 1

Then I get the same error no matter how many times I repeat the make command:

gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o
process_begin: CreateProcess(NULL, gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/gemm.o] Error 2

As I am a beginner, can you please provide detailed instructions on how I can fix the problem?

RedGod
  • 31
  • 2

2 Answers2

3

These problems:

mkdir -p obj   
mkdir -p backup   
A subdirectory or file -p already exists.  
Error occurred while processing: -p. make: *** [backup] Error 1

are caused by the fact that you have asked Make to execute, on Windows, a makefile that was written to work on Linux or some other Unix-like operating system.

In Unix-like operating systems, the command:

mkdir -p obj

means: Create a directory called obj with no error if it already exists. In Windows it means: Create a directory called -p and then a directory called obj.

So when mkdir -p obj has created the directories -p and obj, the command:

mkdir -p backup

fails because:

A subdirectory or file -p already exists.

The Unix/Linux makefile has no intention of creating a directory called -p, but on Windows that is what it does.

There is little point in your attempting to fix this specific error. It is just the first of indefinitely many errors that will result from attempting to execute a Unix/Linux makefile on Windows. You need a makefile that was written to run on Windows, or to write one yourself, or to find a way of building the software on Windows that does not use Make.

This problem:

gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o
process_begin: CreateProcess(NULL, gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/gemm.o] Error 2

is caused by the fact that you have not installed the GCC C compiler gcc on your computer, or if you have, the directory where it resides is not in your PATH. So Make cannot find it to perform the essential business of compiling and linking your software.

Here is a popular Windows port of GCC

Mike Kinghan
  • 55,740
  • 12
  • 153
  • 182
0

Your makefile has been written for Linux and is not directly portable to Windows. The issue is that ‘mkdir’ is conflicting with CMD’s built-in function that doesn’t support the same command line options (as explained by Mike Kinghan).

A simple workaround is to replace any occurrence of mkdir in your makefile with $(MKDIR) and to add at the very beginning:

MKDIR := “$(shell which mkdir)”

Of course this requires that you install which and CoreUtils (that provides mkdir). Note the double quotes to avoid any issues with white space on the path to mkdir.

Last but not least you will also need gcc which you can get here or there for example.

DaveC
  • 115
  • 8