0

I'm trying to build a project, bootloader for AVR devices provided by LUFA, that uses GNU Make (make), but I am on Windows. While Windows, in and of itself, isn't necessarily the problem, it's clearly throwing a wrench in things.

I've installed make and other ancillary programs (grep, mingw, ...) via Chocolatey. I've also installed Cygwin/MinGW on their at times but believe I'm not using those binaries... but maybe they're not helping...

I'm running make and get an error before even the first make target is executed:

#...

test:
  echo test

#...

Result:

C:\Users\camer\git\Project\bootloader>make
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
echo test
test

make -d seems to show what is causing the The system cannot find the path specified. errors:

PS C:\Users\camer\git\Project\bootloader> make -d
GNU Make 4.3
Built for Windows32
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
CreateProcess(C:\WINDOWS\system32\hostname.exe,hostname,...)
Main thread handle = 00000110
Reading makefile 'local.HOSTNAME.mk' (search path) (don't care) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/LUFA/lufa-sources.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/LUFA/lufa-gcc.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/DMBS/DMBS/core.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/DMBS/DMBS/cppcheck.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/DMBS/DMBS/core.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/DMBS/DMBS/doxygen.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/DMBS/DMBS/core.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/DMBS/DMBS/dfu.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/DMBS/DMBS/core.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/DMBS/DMBS/gcc.mk' (search path) (no ~ expansion)...
Reading makefile 'LUFA/LUFA/Build/DMBS/DMBS/core.mk' (search path) (no ~ expansion)...
Creating temporary batch file C:\Users\camer\AppData\Local\Temp\make14552-1.bat
Batch file contents:
        @echo off
        mkdir -p obj 2> /dev/null
CreateProcess(C:\Users\camer\AppData\Local\Temp\make14552-1.bat,C:\Users\camer\AppData\Local\Temp\make14552-1.bat,...)
The system cannot find the path specified.
Cleaning up temporary batch file C:\Users\camer\AppData\Local\Temp\make14552-1.bat
...

So, it looks like make is trying some workaround on Windows that creates a temporary batch (.bat) file and executes that to get some output. Or maybe that's standard practice and it creates a .sh script on Linux... In any case, that seems to be what's failing for some reason.

Looking into LUFA's included Makefiles (LUFA/LUFA/Build/DMBS/DMBS/*.mk), I can see the instructions that are trying to be run:

#...
# Create the output object file directory if it does not exist and add it to the virtual path list
$(shell mkdir -p $(OBJDIR) 2> /dev/null)
#...

So, something about Make's builtin shell is failing on Windows 10.

Curiously, these errors do not make the build fail. You can see in my example that echo test is still run.

It turns out, this is causing a litany of other issues with LUFA's Makefiles. The shell builtin is used to fill many make vars and many build steps expect those variables to be non-empty. Since the shell call fails without taking down the whole execution, everything breaks.

I'm not quite sure where next to look to solve my issue. Is it that I'm using a bad version of make? I've tried a few make.exe binaries from different places and they all have this error (if memory serves). I'm pretty sure I've had these make files working on a previous Windows installation but that computer is now offline so I cannot compare.

Thanks for the look! Cheers!

2
  • My opinion? (I know you didn't ask for).. use WSL to do this work rather than trying to cross-compile using Cygwin. Also, "Cygwin/MinGW" are two completely separate UNIX emulation layers and suck differently depending on what you are trying do do. It's odd to put them in a single statement as if they are a unit. IMHO, MinGW is the superior of the two but that is a matter of opinion. I myself use WSL(1) to do the kinds of compiles you are trying to do here. Best part is that I can follow the Linux instructions without modifications. Commented Nov 25, 2020 at 1:42
  • I'm about to resort to WSL but that has its own set of complications. I could also just use one of my many linux machines. However, I'd rather get it to work without resorting to other technologies since I know I've gotten it to work without WSL/Linux. Frankly, I'm also interested in understanding what exactly is going on, and that's really my priority, and why I'm posting here. As for Cygwin/MinGW, afaiu, they both fill similar gaps in the Windows system if you just need some basic binaries. I have tried both independently (not trying to use both at once afaik). Commented Nov 25, 2020 at 2:39

1 Answer 1

0

Well, it turns out the problem was not creating new shells. The shells were being created as expected. The problem was the output redirect the /dev/null, which doesn't make sense on Windows.

The intermediate solution here is to not reference /dev/null in the makefile but instead redirect output to nul, the special /dev/null equivalent on Windows.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .