0

I'm working on cygwin. Most Unix commands work just fine. Also I can compile with g++ and gcc, but I get the error below when I execute make:

/cygdrive/b/tpm/src
$ make -f makefile.mak
"c:/program files/mingw/bin/gcc.exe" -Wall -Wnested-externs -ggdb -O0 -c - 
DTPM_WINDOWS -I"c:/program files/MinGW/include" -I"c:/program 
files/openssl/include" -I../utils -I. -DNO_BIT_FIELD_STRUCTURES AlgorithmCap.c -o AlgorithmCap.o
make: *** [makefile.mak:85: AlgorithmCap.o] Error 1

Note that I have the make package downloaded and added the bin to the path.

Blackwood
  • 3,184

1 Answers1

0

The main error is shown in this line:

$ make -f makefile.mak "c:/program files/mingw/bin/gcc.exe" -Wall -Wnested-externs -ggdb -O0 -c -

This error shows that the cygwin make finds the C compiler path i.e. $(CC) in C:\Program Files\mingw\bin\gcc.exe. Here OP installed mingw and cygwin both in same machine. When the corresponding installer installs cygwin and mingw it adds the /bin folder in %PATH% system environment variable. Hence at compile time, the cygwin make grabs the first gcc.exe path which is in mingw directory and the error shows up.

To remove the path confusion, the %PATH% environment variable is to be configured properly. Find more details on how to edit environment variables in below links. Here I give a simple outline. Open Run dialog box with Win + R. Type control.exe in it and hit enter. Go to System and Security > System > Advanced System Settings > Environment Variables > System Variables > Path.

System_Variables

Double click on the "Path" variable. You can see a window "Edit environment variable". Delete the two paths C:\cygwin and C:\Program Files\mingw\bin with Delete key.

Edit_Path_Variable

Now make two batch files one cygwin.bat and mingw.bat. It can be done in one file, I just make it simple. Copy the following lines in those corresponding batch files. The commands will configure the environment to compile.

  • For cygwin:
@echo off
C:
chdir C:\cygwin\bin
C:\cygwin\bin\bash.exe --login -i
  • For mingw:
@echo off
set PATH=C:\Program Files\mingw\bin;%PATH%
cmd /k

Similar Q&A:

Biswapriyo
  • 11,584