Building older versions

I have been trying to build older versions (not that old) of arducopter. First, I run:

git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git

At this point, if I configure and then build copter (./waf copter) everything builds fine. I then try to checkout and build an older version, say Copter-4.0.6 using these steps:

git checkout tags/Copter-4.0.6
git submodule update --init --recursive --force
./waf configure --board CubeOrange
./waf copter

I get an almost immediate error:

Waf: Leaving directory `ardupilot/build/CubeOrange'
Build failed
Traceback (most recent call last):
  File "ardupilot/modules/waf/waflib/Task.py", line 338, in process
    ret = self.run()
  File "Tools/ardupilotwaf/mavgen.py", line 62, in run
    if mavgen.mavgen(mavgen_options(), [xml]):
  File "ardupilot/modules/mavlink/pymavlink/generator/mavgen.py", line 143, in mavgen
    xml.append(mavparse.MAVXML(fname, opts.wire_protocol))
  File "ardupilot/modules/mavlink/pymavlink/generator/mavparse.py", line 427, in __init__
    m.crc_extra = message_checksum(m)
  File "ardupilot/modules/mavlink/pymavlink/generator/mavparse.py", line 454, in message_checksum
    crc.accumulate_str(msg.name + ' ')
  File "ardupilot/modules/mavlink/pymavlink/generator/mavcrc.py", line 34, in accumulate_str
    bytes.fromstring(buf)
AttributeError: 'array.array' object has no attribute 'fromstring'

I get a similar error with other older builds. Am I missing something obvious? Is this a submodule issue? Any help would be appreciated.

FYI: Current build env:
MacBook Pro (circa 2018)
macOS 11.2.3

I think you need, git submodule update --init --recursive

git submodule update --init --recursive

1 Like

I guess I should have indicated that I tried that. Yes, the --init doesn’t help. I’ll adjust the original question.

add a “./waf clean” before “./waf configure”

Yep, tried that too.

There’s something else wrong. Either the submodules aren’t updating to the correct versions, or something. I dunno.

Okay, so I think there really is an error in mavlink/pymavlink. The error indicated in my original op is in the mavcrc.py file. Doing a diff of mavcrc.py between the most up-to-date checkout of ardupilot (and hence mavlink/pymavlink) and the version from the commit to mavlink/pymavlink associated with Copter-4.0.7 yields:


(on the left is the latest version, on the right is the version associated with tag Copter-4.0.7). Note that the AttributeError has been addressed.

So now, since I assume Copter-4.0.7 did build upon release, why is this error manifesting? Do I need to build against the latest version of mavlink/pymavlink? Do any of the developers have any idea why this is happening?

it is because of
“git submodule update --init --recursive”

That addresses this issue specifically.

But You already did that. So I guess your git repo is borked. Delete it and start from scratch again.

git submodule --init --recursive

is not a valid git command. Do you mean

git submodule update --init --recursive

? In the original op I indicated I am doing

git submodule update --init --recursive --force

Am I missing something else? I’ve tried

git submodule update --init --recursive

as well. Makes no difference. For reproducibility, on a Mac, running macOS 11.2.3 with python 3.9.1, executing:

git clone --recurse-submodules GitHub - ArduPilot/ardupilot: ArduPlane, ArduCopter, ArduRover, ArduSub source
git checkout Copter-4.0.7
git submodule update --init --recursive
./waf configure --board CubeOrange
./waf copter

yields the error indicated in the original op.

Yeah, I’ve now cloned the repo 3 more times in separate directories and tried various permutations of the suggested commands. None of them work. One observation is that the tags “Copter-4.0.7” and “Copter-4.0.6” (and likely others) are detached from HEAD. I’m not good enough with git to know precisely the implications of that. It doesn’t seem like that would make any difference, but it’s the only anomaly I can see.

haaaa, just try with python2 … that should do it

Thank you!!! Damn python versions…

python gives and python takes away…

I assume that copter v4.0.x works under python3 but you may have a too much recent version. So better use python for the old stable

Ubuntu 20.04 uses Python 3.8. These array methods were removed in Python 3.9. See here. Might be a quick PR to change and test those. Might be interesting to run our python with -Wd to see what else might be deprecated.

I’m stuck with the same issue.
What are the commands to run that if I may ask, thanks in advance!
I have Python 3.9.5 and 2.7.18 on my laptop
I do all these and end up with the error

git checkout Copter-4.0.7
git submodule update --init --recursive
./waf configure --board CubeOrange
./waf copter

IN CONTINUATION
I tried these
python2 ./waf configure --board CubeBlack
python2 ./waf copter


I get this error

pip install future

or

pip3 install future

Tried this, it says
Requirement already satisfied: future in /usr/lib/python3/dist-packages (0.18.2)

1 Like

Not a python expert but you may want to try pip2 install future as sometimes pip or python will just call the python3 version.

It was some issue with my python2 on Ubuntu 21.04. This worked. Thanks!

1 Like