Gabriel Jacob Perin
← Back to blog

Arkanjo Contribution 1

2026-05-13

Summary

In this post, I describe my first experience installing and building ArKanjo, a command-line tool for detecting function-level code duplication. The tool is particularly interesting in the context of Linux kernel development, since duplicated code in large systems is not always trivial to identify, evaluate, or refactor.

ArKanjo is also described in the paper ArKanjo: a tool for detecting function-level Code Duplication in the Linux Kernel . The paper frames the tool as a way to support kernel maintenance by finding actionable duplicated functions, while also showing that duplication in the kernel must be interpreted carefully: sometimes it is a real maintenance problem, but sometimes it reflects design, readability, or subsystem-specific constraints.

Installation experience

I followed the installation instructions from the official repository. The process was mostly straightforward, but I had to solve a few environment-related issues before completing the build.

I first installed CMake through the Ubuntu package manager:

sudo apt install cmake

However, when running the configuration step with cmake .., I ran into problems related to missing development tools. I installed both clang-tidy and clang-format:

sudo apt install clang-tidy
sudo apt install clang-format

After that, I still had another issue: the CMake version installed through apt was 3.16.3, which was not enough for the project configuration step. I removed the system package and installed a newer version through Python:

sudo apt remove cmake
pip install --upgrade cmake

The shell was still trying to call the old binary path at /usr/bin/cmake. Since the new CMake binary was installed inside my Anaconda environment, I called it directly:

/home/gjperin/anaconda3/bin/cmake ..

With the newer CMake version, the configuration step completed successfully. ArKanjo cloned the required Tree-sitter parsers for C and Rust and generated the build files.

Fixing a missing dependency

The next issue appeared during compilation. The build failed while compiling Tree-sitter because the ICU development headers were missing:

fatal error: unicode/umachine.h: Arquivo ou diretório inexistente

The fix was to install the ICU development package:

sudo apt install libicu-dev

After installing this dependency, I reran the build command and the project compiled successfully:

/home/gjperin/anaconda3/bin/cmake --build .

The build produced the main arkanjo executable, the arkanjo-preprocessor executable, and the test binary. There were some compiler warnings, but they did not prevent the build from completing.

Installing the tool

My first installation attempt failed because CMake tried to copy the binaries into /usr/local/bin, which requires administrator permission:

file INSTALL cannot copy file ".../build/arkanjo"
to "/usr/local/bin/arkanjo": Permission denied.

Running the installation step with sudo solved the problem:

sudo /home/gjperin/anaconda3/bin/cmake --install .

This installed both arkanjo and arkanjo-preprocessor under /usr/local/bin, together with the required third-party files under /usr/local/lib/arkanjo.

Conclusion

This first step was useful mainly as a setup and environment exercise. The practical lessons were: ArKanjo currently benefits from a recent CMake version; the configuration step expects some development tools such as clang-tidy and clang-format; and the Tree-sitter dependency requires ICU development headers to be available in the system.