The road to run everywhere: ARM64 (Apple M1)
OpenDroneMap is now compatible with the Apple M1 (no, not with this arm). The community came together to fund this feat. Thanks to everyone that contributed!
What was challenging about this?
Apple M1 speaks a different language than Intel chips (the mainstream chips that most people’s computers have). This language is a dialect of ARM. Apple has added a piece of software to guarantee some compatibility with applications not specifically built for its new chip, but the compatibility layer fails with software such as ODM that has many optimizations and low-level functions.
The steps to a port are always more or less:
- Try to build the software on the new architecture
- Get showered with errors
- Fix a few errors
- Repeat from 1 until success
- Re-test on every other architecture (in case you’ve broken something in the process)
- Automate the build process
Some really strange bugs came up during this process (like this one or this one). We upgraded the base layer of the software to be based on the cutting edge Ubuntu 21.04, since certain packages we depend on aren’t available for ARM. This broke our deployment to Snap. So we had to fix that with some conditional build logic. In the process our Windows build broke. We finally got everything ready for building and deploying, but the build times were now exceeding 6+ hours (up from 2+), which is a limit on GitHub. So we setup our own GitHub builder node, which is faster and enjoys higher time limits.
A challenge was getting PostgreSQL + PostGIS running. To guarantee compatibility with previous releases and a smooth upgrade experience for long-time users, WebODM’s docker images need PostgreSQL 9.5. As we plan for a future database migration / update which will require us to include multiple Postgres installations in the same database image, we opted to build from source both packages (PostgreSQL 9.5 is no longer included in newer Ubuntu releases).
After several days (and lots of coffee), everything came together!
So there you have it! From the command line:
git clone https://github.com/OpenDroneMap/WebODM cd WebODM/ ./webodm.sh start
Will get you up and running on the Apple M1 (and on other ARMv7 devices such as newer Raspberry PIs too)!
What’s next? Maybe a sans-docker port to MacOS? We’ll see. Stay tuned.84