compiler-explorer / compiler-explorer/compiler-explorer

[LIB REQUEST]: GMP

Open
#8,557 3 comments 0 reactions 0 assignees View on GitHub
new-libs request
Dominant language
TypeScript
Stars
19.1k
Forks
2.1k
Avg merge
3d 15h
Merged PRs (30d)
67

Description

### Library name

GMP (The GNU Multiple Precision Arithmetic Library)

### Library description

GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating-point numbers with is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on.

### Library repository

https://gmplib.org/repo/

### Motivation

It a dependency of certain parts of Boost.Multiprecision (a library already available on Compiler Explorer)
Currently the following code fails to link due to the dependency on GMP.
```
#include

int main()
{
using namespace boost::multiprecision;

mpz_int i_0 = 23;

return 0;
}
```

Current Output from Compiler Explorer without GMP:

> ASM generation compiler returned: 0
/cefs/80/8014cb6485fd2a75b5bc495b_gcc-trunk-20260313/bin/../lib/gcc/x86_64-linux-gnu/16.0.1/../../../../x86_64-linux-gnu/bin/ld: /tmp/ccbBxyJl.o: in function `_ZN5boost14multiprecision8backends7gmp_intC2El`:
/app/boost/include/boost/multiprecision/gmp.hpp:1435:(.text._ZN5boost14multiprecision8backends7gmp_intC2El[_ZN5boost14multiprecision8backends7gmp_intC5El]+0x1f): undefined reference to `__gmpz_init_set_si`
/cefs/80/8014cb6485fd2a75b5bc495b_gcc-trunk-20260313/bin/../lib/gcc/x86_64-linux-gnu/16.0.1/../../../../x86_64-linux-gnu/bin/ld: /tmp/ccbBxyJl.o: in function `_ZN5boost14multiprecision8backends7gmp_intD2Ev`:
/app/boost/include/boost/multiprecision/gmp.hpp:1722:(.text._ZN5boost14multiprecision8backends7gmp_intD2Ev[_ZN5boost14multiprecision8backends7gmp_intD5Ev]+0x21): undefined reference to `__gmpz_clear`
collect2: error: ld returned 1 exit status
Execution build compiler returned: 1
Build failed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.