libqalculate: the calculation engine behind qalc and the Qalculate! desktop apps
Qalculate! library and CLI
At a glance
- What is it?
- libqalculate is a C++ library with a command line front end called qalc, built for unit conversion, symbolic maths and uncertainty propagation rather than four-function arithmetic. It is the right tool when an expression mixes units, exact fractions and physical constants, and the wrong tool when you want a small dependency-free evaluator.
- Who is it for?
- Adopt libqalculate if you need unit-aware, arbitrary-precision evaluation and are willing to build from source or take it from a distribution package; the README points to https://qalculate.github.io/downloads.html for installers and binaries. Do not adopt it if you want a tiny embeddable expression parser, since GMP, MPFR and libxml2 come with it and the build uses autotools.
- Can I use it commercially?
- Yes, with conditions. GPL-2.0 is a copyleft licence: if you distribute software that includes it, you must release that software's source code under the same licence. Running it internally without distributing it does not trigger that obligation.
- Is it still maintained?
- Yes. The repository last received commits 1 day ago.
- What is it written in?
- Mainly C++, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.
Editorial analysis
The problem libqalculate solves: expressions where the unit and the uncertainty matter
A plain calculator API returns a number. libqalculate returns a number with a type. The README lists the features that follow from that decision: unit calculations and conversion, symbolic calculations including integrals and equations, arbitrary precision, uncertainty propagation, interval arithmetic and plotting. Those are not cosmetic additions. They change what a valid expression looks like, because units, variables, matrices, vectors and time and dates can appear together in one expression.
The audience is correspondingly narrow and specific. The repository is a library plus a CLI, and the README names qalculate-gtk and qalculate-qt as the main user interfaces built on it. So the direct users are people writing those front ends, people embedding the library in another application, and people who want the calculation behaviour without a GUI. The README also lists KDE Plasma Workspace, Cantor and Step among the software using libqalculate, which tells you the intended integration scale: desktop environments and education tools, not a single-purpose script.
If your requirement is "evaluate 2+2 in a config file", this is the wrong shape of dependency. If your requirement is "convert 5 kg x m/s^2 and show it as newtons, then carry the measurement error through", the README's own examples show that this is the layer where that work happens.
How the library and the qalc CLI relate
The repository layout makes the split visible. libqalculate/ holds the library, src/ holds the CLI, data/ holds the definitions, man/ holds the man page, tests/ holds the test code, and docs/ holds documentation. The README states that the API documentation is generated when running autogen.sh and installed under $docdir/libqalculate/html, usually /usr/share/doc/libqalculate/html, with an online copy at http://qalculate.github.io/reference/index.html. That is the boundary: the library exposes the API, and qalc is one consumer of it.
The feature list describes where the intelligence lives. Functions, units, variables and constants are data the library loads and interprets, which is why the README can say functions and units are "easily created and edited from the user interfaces" and that variables support CSV import and export. Parsing is described as fault-tolerant and flexible, with verbose error and warning messages. Evaluation supports both exact and approximate output, so the same input can produce an exact form and a decimal form.
The CLI adds two modes rather than new mathematics. Non-interactive mode takes an expression as an argument. Interactive mode, started by running qalc with no expression, adds history, completion, result manipulation and settings changes. The README notes that typing help in interactive mode gives more information and that a man page is available through man qalc.
Building libqalculate from source and running a first conversion
The README gives the build sequence directly. The Git version needs ./autogen.sh first; a release source tarball does not. ./configure runs automatically inside autogen.sh, so the explicit configure step is for the case where you run it yourself.
./autogen.sh
./configure
make
make install
ldconfigBefore any of that, the README lists the requirements: GMP and MPFR, libxml2, with libcurl, icu and gettext recommended, and iconv and readline recommended for the CLI. Gnuplot is optional and only matters for plotting. For distributions that split libraries into separate development packages, the README says those packages must be installed for all required libraries before compilation, giving libmpfr-dev as the example.
Once qalc is on the path, a single expression runs in non-interactive mode. The README's example is qalc 5+2, and it also gives the unit conversion ft + yd + m as an example of automatic conversion. A representative first use is a conversion, because that is where the library differs from a shell's arithmetic:
qalc 5+2The README states that this is how you calculate a single expression from the command line in non-interactive mode. If you run qalc with no expression at all, you get the interactive prompt instead, which is the mode to use when you want history and settings rather than a one-shot answer. qalc --help lists the non-interactive options, and the README points to man qalc for the rest.
Where libqalculate gets in the way
The dependency list is the first real cost. GMP, MPFR and libxml2 are required, and the README recommends libcurl, icu and gettext on top of that. Each of those is a separate build and link step in your own project if you ship libqalculate inside an application. That is a deliberate trade: arbitrary precision and a large definition set do not come for free, but it also means libqalculate is not something you drop into a minimal container to add arithmetic.
The build system is autotools, and the README is explicit that automake and autoconf are required for compilation of the Git code. If you consume the Git tree rather than a release tarball, you need that toolchain present, and you need to run autogen.sh. The README also flags a deployment detail that catches people out: if libqalculate is installed in /usr/local, which the README calls the default, the system may need /usr/local/lib added to the library path through a file under /etc/ld.so.conf.d/ followed by ldconfig. A binary that links cleanly at build time can still fail to find the library at runtime until that is done.
There is also a scope mismatch to be honest about. libqalculate is designed around a very large surface: over 400 functions, over 400 units, data sets, plotting through Gnuplot, currency rates updated daily. If you need one deterministic function evaluated in a sandbox with no network and no XML parsing, most of that surface is dead weight, and the recommended libcurl dependency in particular is there for features you will not call.
Alternatives and the difference in approach
The README itself points at the most direct alternative for interactive use: qalculate-gtk and qalculate-qt, which it calls the main user interfaces for libqalculate. They are not competitors to the library, they are consumers of it, so the choice there is about interface, not engine. Picking one of them means you get the same calculation behaviour without writing C++ against the API.
For the library slot, the meaningful comparison is against a general-purpose computer algebra system or a language's own numeric stack. The difference is in what is loaded by default. libqalculate ships units, physical constants with 2022 CODATA values including standard uncertainty and optional units, currency conversion with daily updated exchange rates, and a chemical element data set, all as first-class named objects. A general CAS typically starts from symbols and requires you to define or import that domain knowledge yourself. The trade runs the other way too: a CAS usually offers deeper symbolic machinery for the problems it targets, while libqalculate's symbolic support is described in the README as factorization, simplification, differentiation, integration, and solving most equations and inequalities.
A third option is the ecosystem the README lists around the project. Qalculator is a web app with Android, iOS and Windows builds, and Qalculate for Android exists as a separate repository. Those are relevant when the real requirement is "a calculator on this device" rather than "a calculation library in this program". The README's add-ons section also mentions an Ancient units package, which shows that the definition data is extensible outside the main tree.
Maintenance, licensing and what an upgrade costs you
The repository is not archived, and the last push was on 2026-09-23. Releases are frequent and versioned in lockstep between library and CLI: v5.10.0 on 2026-03-30, v5.11.0 on 2026-05-25 and v5.12.0 on 2026-07-13. For a library you embed, that cadence is the practical upgrade consideration. The release titles cover both the library and the CLI, so a version bump can carry definition data changes as well as code changes. The top-level NEWS and ChangeLog files are where the repository keeps release information; the README does not describe an API stability policy or a deprecation process, so if you build against the C++ API you should read those files per release rather than assume compatibility.
Licensing is GPL-2.0, and the COPYING file sits at the top level of the repository. That is a copyleft licence, which matters most if you link libqalculate into a proprietary application. This is not legal advice; the practical step is to have whoever handles licensing at your organisation read COPYING and decide how your distribution model interacts with it. Using the qalc binary as a separate process is a different question from linking the library, and the answer depends on your own counsel, not on anything the README states.
The upgrade cost also has a data dimension. Units, functions, variables and currency rates live in the data/ directory and are loaded at runtime, so behaviour can change between releases without any code change on your side. The README's note that currency conversion uses daily updated exchange rates is the clearest example: the same expression can return a different number next week.
Editorial conclusion
Adopt libqalculate if you need unit-aware, arbitrary-precision evaluation and are willing to build from source or take it from a distribution package; the README points to https://qalculate.github.io/downloads.html for installers and binaries. Do not adopt it if you want a tiny embeddable expression parser, since GMP, MPFR and libxml2 come with it and the build uses autotools. Before committing, verify that your target platform has development packages for GMP, MPFR and libxml2, and confirm where the library lands, because a /usr/local install may require adding /usr/local/lib to a file under /etc/ld.so.conf.d/ and running ldconfig.
Frequently asked questions
What is libqalculate?
It is the C++ library behind the Qalculate! calculator, distributed with a command line program called qalc. The README describes it as a multi-purpose cross-platform desktop calculator with a large function library, unit conversion, symbolic calculations, arbitrary precision and uncertainty propagation.
How do I install libqalculate on Ubuntu, Fedora, Arch or Gentoo?
The README does not give per-distribution package names. It points to https://qalculate.github.io/downloads.html for installers, binary packages and release source code, and gives the from-source sequence of ./autogen.sh, ./configure, make and make install.
What is the command to use a calculator in Linux?
With libqalculate installed, the CLI program is qalc. The README shows qalc 5+2 for a single non-interactive expression, and running qalc with no expression starts interactive mode with history, completion and settings.
What are the build requirements for libqalculate?
GMP and MPFR plus libxml2 are required; libcurl, icu and gettext are recommended, and iconv and readline are recommended for the CLI. The README notes that automake and autoconf are required when compiling the Git code, and that development packages for the required libraries must be installed first.
Does libqalculate need Gnuplot?
No. The README lists Gnuplot as optional and ties it to the plotting feature, which can plot functions or data and save the result as image files.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/qalculate-libqalculate)