2

I'm trying to recompile an application already having a windows port (so it's supposed to work)

Of course, you still need to run ./configure so you need MSYS or MSYS2.

The configure part worked well. Now when I run make -n (so it shows which rules are executed) I get:

$ make -n
if test ! -f config.h; then \
  rm -f stamp-h1; \
  make stamp-h1; \
else :; fi
! was unexpected
make: *** [config.h] Error 255

! was unexpected is the approximate translation of a french message (so it may be slightly different) but reminded me very much of the cryptic Windows batch file messages. So I suppose that make runs its command lines using windows native shell (which isn't an issue for most simple commands, but not when it relies on a bash-like shell), assumption which was confirmed by using make debug mode:

$ make -d
GNU Make 3.82
Built for i686-pc-mingw32
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
<I'll spare you that boring part then:>
Invoking recipe from Makefile:164 to update target `config.h'.
Creating temporary batch file C:\msys64\tmp\make11752-1.bat
Batch file contents:
        @echo off
        if test ! -f config.h; then   rm -f stamp-h1;   make stamp-h1; else :; fi

From the make documentation, make takes the SHELL env. variable into account.

SHELL is set to a unix-style path, but I've tried to change it with $ export SHELL="C:/msys64/usr/bin/bash.exe" to reflect native windows path (make may not be MSYS2 aware) but to no avail)

So how to tell make to use bash shell instead of the Windows shell ?

2
  • If exported variables don't work, try make SHELL=bash - you don't need the full path if it can be found on $PATH.
    – o11c
    Aug 26, 2017 at 2:24
  • @o11c already tried that. David answer nailed it. I was using MinGW (native) version of make, whereas I should have used MSYS make, MSYS & bash aware. Aug 26, 2017 at 7:33

1 Answer 1

2

Built for i686-pc-mingw32

That line means you are using the wrong version of GNU Make. You are using one that is built for the MinGW runtime instead of one built for the MSYS2 runtime (a fork of Cygwin).

Make sure you run pacman -S make to install the proper version of GNU Make, and then run which make and make sure it returns /usr/bin/make. The new make should identify itself as something like "Built for x86_64-pc-msys".

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.