Building CERN ROOT on Arch Linux ARM

Mostly want to document how I’m building ROOT on ARM64 Arch Linux. The process it quite trivial but in case I forgot how to do it in the future.

My ARM server runs Arch Linux. Which should come with ROOT in the official repository. But as you guessed, it didn’t. Which indicates somehow ROOT builds correctly on x86 but not on ARM. At least without modifying the official PKGBUILD. Well, let’s investigate.

PKGBUILD and Ports

Arch Linux’s PKGBUILD is a BSD ports like system. Where you can mass download an entire repository of build scripts. And those scripts will eventually generate an install-able package for you; if you invoke the correct command. (For Arch, running makepkg). So the first step is to figure out which repository ROOT lives in:

It’s written in the package description!

So it’s in the community repo. Good. After some DuckDuckGo-ing, found the community repo is hosted on svntogit/community.git. Get your self some tea as git clone ... will take a while to complete. After that you should see a ton to directories in the cloned folder.

The folder is massive!

Building ROOT

Now copy the directory containing root to somewhere else – You can build root right here. But it’s wise to keep the directories clean. It’s some patches have to be applied later to get ROOT building. That’s why ROOT is not in the official repositories in the first place.

cp -r root/ /some/place/to/build/root/
cd /some/place/to/build/root/

Now, let’s modify trunk/PKGBUILD :

Edit the line arch=('x86_64') and turn it into arch=('x86_64' 'aarch64'). So the build process won’t complain about we are not on x86. Then comment or remove everything related to CUDA (including dependencies). NVIDIA doesn’t support CUDA on any ARM processors except their own. Finally add the -j flag to make so it builds in parallel.

Running makepkg at this point will result in errors stating that xrootd, vc and python-pythia8 isn’t available. Copy their build scripts from the downloaded repository and build them.

cd /path/to/downloaded/repo/community
cp -r xrootd vc python-pythia8 /some/place/to/build
cd /some/place/to/build/xrootd/trunk
makepkg -siA
# And do it for all the other packages

Note that set -DTARGET_ARCHICTURE=generic for vc‘s build. Otherwise it targets SSE and that won’t work on a ARM.

Finally go back to ROOT’s directory. Now it’s time to patch root manually. I don’t know why. But ROOT always complains about not linking to dl when also linking to sqlite3. Run makepkg, wait for it to download the source tar file. Ctrl-C out of it. And vim root_vx.yy.zz.tar.gz. Vim supports changing files in tars directly. Navigate yourself to tree/dataframe/CMakeLists.txt. Find the line target_link_libraries(ROOTDataFrame PRIVATE ${SQLITE_LIBRARIES}) and add dl to it. Then do the same to sql/sqlite/CMakeLists.txt

Tell ROOT to link against dl with SQLite

Run makepkg --skipinteg and wait. ROOT should built in a few hours (or a day if on a embedded board).

It builds!

That’s it. Use sudo pacman -U to install the package.

I hope this post can help someone in the future. Feel free to send me a mail or comment if you got any questions.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Website Powered by

Up ↑

%d bloggers like this: