Building libudx

UDX.jl is a thin wrapper around the C library libudx. This documentation ships with the Julia package only; it does not include the full UDX source tree. You must obtain the UDX C sources (separate repository), build libudx yourself, and install it next to this package (or adjust paths), unless you use a pre-built binary we provide.

Supported platforms (pre-built)

Currently, only macOS on Apple Silicon (ARM64) is supported for the layout and filenames assumed by default in UDX.jl (bin/libudx.dylib next to your checkout, as documented in Getting started).

If you use Intel macOS, Linux, or Windows, you must build libudx yourself on your machine using the instructions below (and point UDX.jl to the resulting library in __init__, or set library search paths accordingly).


Prerequisites

Build without Maple for use with Julia: you do not need UDX_USE_MAPLE.

Third-party libraries (typical versions used in development):

  • GMP — 6.3.0
  • MPFR — 4.2.0
  • MPFI — 1.5.4

Install development packages on your system or place them under a single prefix and pass that prefix to CMake as 3RD_PARTY_DIR (see below).


Build from the UDX source repository

Clone the UDX repository containing CMakeLists.txt, src/, tests/, build_static.sh, build_dynamic.sh, etc.

Compilation steps

  1. Create a build directory:

    mkdir build
  2. Adjust test sources (if needed). In tests/test_mp.c, tests/test_mpfr.c, and tests/test_mpfi.c, you may need to change the path of the UDX build directory in the following line to match your tree:

    ```c udxinittcpclientnegoc0(channel,"localhost",

		              "path/to/udx/build/directory/",
		              "client_mpfi","",to_1);

```

Point "path/to/udx/build/directory/" at your actual UDX build directory.

  1. Configure and build the project

    Option A: Using build scripts (recommended)

    Important: You need to modify the paths in the build scripts to match your system:

    • Edit build_static.sh and build_dynamic.sh
    • Change 3RD_PARTY_DIR to your GMP/MPFI path
    • If MPFR is in a different location (e.g. version 4.2.0), change MPFR_PATH to your MPFR path
    • Make the scripts executable:
    chmod +x build_static.sh build_dynamic.sh

    For a shared library with static dependencies (self-contained):

    ./build_static.sh

    For a shared library with dynamic dependencies (requires GMP/MPFR/MPFI on the system):

    ./build_dynamic.sh

    Option B: Manual CMake configuration

    Optional flags for third-party libraries:

    • If using MPFR, GMP must also be used
    • If using MPFI, MPFR must also be used

    Add the respective flags

    -DUDX_USE_GMP=1 -DUDX_USE_MPFR=1 -DUDX_USE_MPFI=1

    in the command below:

    cmake -D3RD_PARTY_DIR=/path/to/third-party -B build -DUDX_USE_GMP=1 -DUDX_USE_MPFR=1 -DUDX_USE_MPFI=1

    Optional flags for Maple (only if you need the Maple interface; not required for UDX.jl):

    cmake -D3RD_PARTY_DIR=/path/to/third-party -B build -DUDX_USE_GMP=1 -DUDX_USE_MPFR=1 -DUDX_USE_MPFI=1 -DUDX_USE_MAPLE=1
  2. Build the project (if using manual CMake from option B):

    cd build && make

Running tests

To run a test:

  1. Make sure you have compiled the project first.

  2. From the build directory, execute:

    ./client_udx

    or if you also use MPFR:

    ./client_mpfr

    or if you also use MPFI:

    ./client_mpfi

Confirm that libudx appears under your chosen output directory (e.g. bin/ or build/) as appropriate for your setup.


After building

Place libudx.dylib (macOS), libudx.so (Linux), or the appropriate .dll (Windows) where UDX.jl can find it, or edit src/UDX.jl __init__ to load an absolute path.

Then continue with Getting started to install and load the Julia package.