/libmath-finite

A simple library to solve the `__xxx_finite` symbols missed problem due to `glibc` upgrade.

Primary LanguageCMIT LicenseMIT

libmath-finite

libmath-finite intends to solve the __xxx_finite symbols missed problem due to glibc upgrade. It generally happens when distribute your pre-built binray(.a/.so/executable) from glibc<2.31 build enviornment to glibc>=2.31 systems, such as Debian 10 -> Debian 11, or Ubuntu18.04 -> Ubuntu20.04. Math changes in glibc 2.31 also discusses the problem.
It's a very simple library, which only wraps functions of the standard math library libm. Many thanks to Étienne who proposes the idea in Link errors with -ffast-math (-ffinite-math-only) and glibc 2.31.

Why need it

Please read Undefined reference to __xxx_finite - why and how?.

How to use

There're various ways to use it. The simplest way is just copy the sources into your project and compile them together. Alternativesly build static/shared library to and link them. Read Undefined reference to __xxx_finite - why and how? for more details.

  • Build static library
$ gcc -c -o libmath-finite.o libmath-finite.c
$ ar rcs libmath-finite.a libmath-finite.o
  • Build shared library
$ gcc -c -fPIC -o libmath-finite.o libmath-finite.c
$ gcc -shared -fPIC -o libmath-finite.so libmath-finite.o -lm

References