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,123
  • 11
  • 23
  • 32
  • C:\cygwin , the makefile.mak , do you mean by its include option this ? (CRYPTO_SUBSYSTEM = openssl include makefile-common) –  Jun 10 '18 at 08:47
  • 2
    `c:/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 Jun 10 '18 at 10:01
  • how do i fix it ? because i have installed both cygwin and mingw –  Jun 10 '18 at 17:10
  • @Biswapriyo line 85th ` $(CC) $(CCFLAGS) $< -o $@ ` –  Jun 10 '18 at 17:14
  • @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; –  Jun 10 '18 at 18:27
  • appreciate your help mate –  Jun 10 '18 at 18:39

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
  • 10,831
  • 10
  • 47
  • 78
  • @bayern6 Oh, I missed something in mingw. BTW what environment are you using cygwin or mingw? Do you have mingw in 64 bit. – Biswapriyo Jun 10 '18 at 20:38
  • Not that. I mean with `make -f makefile.mak`. also try to make other projects like mintty in GitHub. – Biswapriyo Jun 11 '18 at 08:30
  • /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 –  Jun 11 '18 at 08:33
  • https://imgur.com/a/EAI4ID3 path : C:\ProgramFiles\CommonFiles\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ –  Jun 11 '18 at 17:20
  • Scroll down the system variable section. Did you see any paths with "mingw"? If not then I'm out of any idea. – Biswapriyo Jun 11 '18 at 17:48
  • nope, no path with mingw :/ –  Jun 11 '18 at 18:09