Waf configure fails

Hey there,
the last two days I tried setting up the build environment with cygwin but I can’t get it to work…
These is the message I get:

$ ./waf configure --board CubeBlack
Setting top to : C:\cygwin64\home\Valentin\ardupilot
Setting out to : C:\cygwin64\home\Valentin\ardupilot\b
uild
Autoconfiguration : enabled
Setting board to : CubeBlack
Using toolchain : arm-none-eabi
Checking for ‘g++’ (C++ compiler) : Traceback (most recent call last):
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Scripting.py”, li
ne 158, in waf_entry_point
run_commands()
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Scripting.py”, li
ne 251, in run_commands
ctx = run_command(cmd_name)
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Scripting.py”, li
ne 235, in run_command
ctx.execute()
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Configure.py”, li
ne 159, in execute
super(ConfigurationContext, self).execute()
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Context.py”, line
204, in execute
self.recurse([os.path.dirname(g_module.root_path)])
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Context.py”, line
286, in recurse
user_function(self)
File “C:\cygwin64\home\Valentin\ardupilot\wscript”, line 264, in configure
cfg.get_board().configure(cfg)
File “Tools/ardupilotwaf\boards.py”, line 40, in configure
cfg.load(‘toolchain’)
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Configure.py”, li
ne 270, in load
func(self)
File “Tools/ardupilotwaf\toolchain.py”, line 146, in configure
cfg.load(‘compiler_cxx compiler_c’)
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Configure.py”, li
ne 270, in load
func(self)
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Tools\compiler_cx
x.py”, line 80, in configure
conf.load(compiler)
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Configure.py”, li
ne 270, in load
func(self)
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Tools\gxx.py”, li
ne 152, in configure
conf.find_gxx()
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Configure.py”, li
ne 316, in fun
return f(*k, **kw)
File “Tools/ardupilotwaf\toolchain.py”, line 31, in find_gxx
conf.get_cc_version(cxx, gcc=True)
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Configure.py”, li
ne 316, in fun
return f(*k, **kw)
File "C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Tools\c_config.py
", line 1014, in get_cc_version
out, err = conf.cmd_and_log(cmd, output=0, stdin=open(‘/dev/null’,‘r’), env=
env)
FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/null’

Maybe this happens because I got this message during install of cygwin:

Package: _/libfontconfig-common fontconfig_dtd.sh exit code 2

But it said that it might still work and to check the log, and there was nothing, so I just decided to give it a try…

Any ideas?
I followed those instructions: Setting up the waf Build Environment on Windows using Cygwin — Dev documentation

Thanks in advance

post a bug request on github

Had the same problem. Here’s what fixed it for me:

1: Be sure Windows null service is enabled:

Run the Command Prompt as an administrator.

  1. Copy the commands below, paste them into the command window and press ENTER:

sc config Null start= system
sc start Null

  1. Close the command window and restart the computer.

On Line 1014 in c_config.py change /dev/null to /dev/nul. Windows want’s nul instead of null.

I tried that but it still doesn’t work…

Sorry to hear that. I’m running Windows 10 with all updates (Auto) and Python 3.8. I installed the Ardupilot build environment as described here: https://ardupilot.org/dev/docs/building-setup-windows-cygwin.html#building-setup-windows-cygwin
I Installed Python before installing cygwin et. al.

To troubleshoot you can try:
From a dos window enter:
sc interrogate “NULL”

To see if the service exists or not. If it does not, try Google.

From the Python command line enter:
stdin=open(’/dev/nul’,‘r’)
to see if the problem is resolved.

Good luck.
Dave

Thank you for your help.
I’ve checked the service, it is running.
The problem is that even if I check manually for the file, it isn’t there.

Okay, I managed to achieve some progress:
I’ve changed /dev/null in c_config.py to NUL, based on this: Is there a /dev/null on Windows? - Stack Overflow

Now I can configure for sitl, but the build fails with:

Waf: Entering directory

C:\cygwin64\home\Valentin\ardupilot\build\sitl’
Waf: Leaving directory C:\cygwin64\home\Valentin\ardupilot\build\sitl’
Build failed
Traceback (most recent call last):
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Runner.py”, line
395, in task_status
return tsk.runnable_status()
File “Tools/ardupilotwaf\git_submodule.py”, line 75, in runnable_status
out = self.generator.bld.cmd_and_log(cmd, quiet=Context.BOTH, cwd=self.cwd)
File “C:\cygwin64\home\Valentin\ardupilot\modules\waf\waflib\Context.py”, line
461, in cmd_and_log
raise e
waflib.Errors.WafError: Command (‘C:\cygwin64\bin\git.exe’, ‘submodule’, ‘sta
tus’, ‘–recursive’, ‘–’, ‘C:\cygwin64\home\Valentin\ardupilot\modules\gt
est’) returned 128`

Configure also fails for cube black:

C:\Users\Valentin\AppData\Local\Programs\Python\Python38-32\python.exe: can’t op
en file ‘‘C:\cygwin64\home\Valentin\ardupilot\libraries/AP_HAL_ChibiOS/hwdef/scr
ipts/chibios_hwdef.py’’: [Errno 22] Invalid argument
Failed to process hwdef.dat ret=2
(complete log in C:\cygwin64\home\Valentin\ardupilot\build\config.log)

This seems to be an error using absolute paths (see https://discuss.ardupilot.org/t/error-while-trying-to-start-sitl-from-cygwin/55627 )

Thanks, now the error message changed:

Build failed
→ task in ‘objs/AC_AttitudeControl’ failed (exit status 1):
{task 67963168: cxx AC_AttitudeControl_Heli.cpp → AC_AttitudeControl_He
li.cpp.0.o}
(run with -v to display more information)
→ task in ‘objs/AC_AttitudeControl’ failed (exit status 1):
{task 67963448: cxx AC_AttitudeControl_Multi.cpp → AC_AttitudeControl_M
ulti.cpp.0.o}
(run with -v to display more information)
→ task in ‘objs/AC_AttitudeControl’ failed (exit status 1):
{task 67963056: cxx AC_AttitudeControl_Sub.cpp → AC_AttitudeControl_Sub
.cpp.0.o}
(run with -v to display more information)
→ task in ‘objs/AC_AttitudeControl’ failed (exit status 1):
{task 67962776: cxx AC_PosControl_Sub.cpp → AC_PosControl_Sub.cpp.0.o}
(run with -v to display more information)

This is when trying to build copter for sitl, configure works

I think this is the same issue and fix as reported here: Build problem in cygwin: /usr/bin/env: ‘python’

It works!

I just had to revert this change

I can’t get rid of the error.
/ardupilot$ ./waf configure --board Pixhawk1
/usr/bin/env: ‘python’: No such file or directory

It sounds like you have a modern Ubuntu install.

By default calls to python go no where.

See pythonispython3

I also encountered the same problem, how should I solve it?