Why does fresh clone work, while current up to date code base fails?

Hello People. I’m new here. I’m a software engineer (mainly Python/php/Golang/Java but not much C/C++ experience yet) and I want to get started with the ArduPilot code base, specifically for planes. I’ve been reading the documentation, running simulations and today I wrote some code for a simple new flight mode. I ran into compilation errors though, so I removed everything I wrote and tried running a simulation (and thereby compiling) again. I seem to have trouble with the submodules though. So I think I’ve got that all cleaned up and this is the current status:

kramer65@xps:~/repos/ardupilot$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
kramer65@xps:~/repos/ardupilot$ git pull
Already up to date.
kramer65@xps:~/repos/ardupilot$ git submodule update --init --recursive
kramer65@xps:~/repos/ardupilot$

I then tried running the simulation again:

kramer65@xps:~/repos/ardupilot$ cd Tools/autotest/
kramer65@xps:~/repos/ardupilot/Tools/autotest$ ./sim_vehicle.py --console --map -v ArduPlane

This creates a LOT of output, but it ends with this error:

Waf: Leaving directory `/home/kramer65/repos/ardupilot/build/sitl'
Build failed
Traceback (most recent call last):
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/Node.py", line 960, in get_bld_sig
    ret = cache[self]
KeyError: /home/kramer65/repos/ardupilot/libraries/AP_HAL/QSPIDevice.h

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/Runner.py", line 395, in task_status
    return tsk.runnable_status()
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/extras/clang_compilation_database.py", line 76, in runnable_status
    run_status = self.old_runnable_status()
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/Task.py", line 679, in runnable_status
    new_sig = self.signature()
  File "/home/kramer65/repos/ardupilot/Tools/ardupilotwaf/ap_persistent.py", line 32, in _signature
    s = _original_signature(self)
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/Task.py", line 651, in signature
    self.sig_implicit_deps()
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/extras/gccdeps.py", line 167, in sig_implicit_deps
    return Task.Task.sig_implicit_deps(self)
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/Task.py", line 853, in sig_implicit_deps
    bld.imp_sigs[key] = self.compute_sig_implicit_deps()
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/Task.py", line 875, in compute_sig_implicit_deps
    upd(k.get_bld_sig())
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/Node.py", line 964, in get_bld_sig
    ret = cache[self] = self.h_file()
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/Node.py", line 944, in h_file
    return Utils.h_file(self.abspath())
  File "/home/kramer65/repos/ardupilot/modules/waf/waflib/Utils.py", line 278, in h_file
    with open(fname, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/kramer65/repos/ardupilot/libraries/AP_HAL/QSPIDevice.h'

SIM_VEHICLE: Build failed
SIM_VEHICLE: Killing tasks

I can confirm that libraries/AP_HAL/QSPIDevice.h does indeed not exist. I’m unsure why though.

So I then cloned the ardupilot repo again in another folder, and tried the simulation/compilation in there, and to my surprise there it works fine.

I then found this commit which has “renamed QSPIDevice to WSPIDevice” a couple days ago.

Ok, fair enough. Things change on master. But why does the fresh clone work fine, while the initial place where I cloned the repo doesn’t work anymore? I did a git pull on master, so that should be the same as a fresh clone right?

I can of course ditch the first clone and use the new clone I pulled in, but I want to understand why it isn’t working anymore. Does anybody understand what is going on here? All tips are welcome!

I found a solution, so if other people in the future find this question (including myself). I did the following:

I simply removed all the contents of the modules folder and rebuilt the submodules:

cd modules/
rm -r *
cd ..
git submodule update --init --recursive
git checkout modules/COLCON_IGNORE  # checkout this file because it got removed by my command above

After this everything worked fine again.

Thanks for your attention anyway!

2 Likes