Failed to compile with make command

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.

user910298

Posted 2018-06-09T23:58:32.200

Reputation:

C:\cygwin , the makefile.mak , do you mean by its include option this ? (CRYPTO_SUBSYSTEM = openssl include makefile-common) – None – 2018-06-10T08:47:24.137

2c:/program files/mingw/bin/gcc.exe is not a cygwin compiler or cross compiler. Your are mixing cygwin make with a not cygwin compiler, and the does not work. – matzeri – 2018-06-10T10:01:45.603

how do i fix it ? because i have installed both cygwin and mingw – None – 2018-06-10T17:10:06.203

@Biswapriyo line 85th $(CC) $(CCFLAGS) $< -o $@ – None – 2018-06-10T17:14:22.503

@Biswapriyo C :\Program Files\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Window s;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\ ;c:/program files/mingw/bin, c:/programfiles/mingw/bin/gcc.exe;C:\gnuwin32\bin,C:\ProgramFiles\GnuWin3\bin;C:\Program Files\GnuWin32\bin\make.exe;C:\cygwin\bin; – None – 2018-06-10T18:27:53.643

appreciate your help mate – None – 2018-06-10T18:39:33.220

Answers

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

Posted 2018-06-09T23:58:32.200

Reputation: 6 640

@bayern6 Oh, I missed something in mingw. BTW what environment are you using cygwin or mingw? Do you have mingw in 64 bit. – Biswapriyo – 2018-06-10T20:38:27.620

Not that. I mean with make -f makefile.mak. also try to make other projects like mintty in GitHub. – Biswapriyo – 2018-06-11T08:30:05.950

/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 – None – 2018-06-11T08:33:03.887

https://imgur.com/a/EAI4ID3 path : C:\ProgramFiles\CommonFiles\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ – None – 2018-06-11T17:20:48.450

Scroll down the system variable section. Did you see any paths with "mingw"? If not then I'm out of any idea. – Biswapriyo – 2018-06-11T17:48:20.193

nope, no path with mingw :/ – None – 2018-06-11T18:09:13.497