llvm / llvm/llvm-project

[flang-rt][ppc64le] Build fail: FLANG_RUNTIME_F128_MATH_LIB setting requires quadmath.h to be available

Open
#219,995 2 comments 0 reactions 0 assignees View on GitHub
backend:PowerPC build-problem flang:runtime
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

## Description

On ppc64le, `libquadmath-devel` installs `quadmath.h` only to GCC's private include directory (e.g. `/usr/lib/gcc/ppc64le-redhat linux/14/include/quadmath.h`), not to `/usr/include/`. Same thing on Ubuntu. The just-built clang cannot find this header when trying to build `flang-rt`. And AFAIK `libquadmath` is not needed because ppc64le natively supports IBM double-double and IEEE quad.

## Steps to Reproduce

On a ppc64le (POWER10 in my case) system:

```bash
cmake -S llvm -B build -G Ninja \
-DLLVM_ENABLE_PROJECTS="clang;flang" \
-DLLVM_ENABLE_RUNTIMES="flang-rt" \
-DLLVM_TARGETS_TO_BUILD="PowerPC" \
-DCMAKE_BUILD_TYPE=Release
ninja -C build flang-rt

Error

-- Found GCC installation selected by Clang: /usr/lib/gcc/ppc64le-redhat-linux/14
-- Looking for quadmath.h
-- Looking for quadmath.h - not found
CMake Error at flang-rt/lib/quadmath/CMakeLists.txt:84 (message):
FLANG_RUNTIME_F128_MATH_LIB setting requires quadmath.h to be available: libquadmath
```

## Workaround

```
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
set(FLANG_RUNTIME_F128_MATH_LIB "")
else()
set(FLANG_RUNTIME_F128_MATH_LIB "libquadmath")
endif()
```

Environment

- POWER10
- Tested on: AlmaLinux 10.2 (GCC 14), Ubuntu 24.04 (GCC 13)

Contributor guide

Open the contributing guide

Research direction

Start at flang-rt/lib/quadmath/CMakeLists.txt around line 84 and reproduce the failure with the provided CMake and Ninja commands on ppc64le. Inspect how FLANG_RUNTIME_F128_MATH_LIB and quadmath.h availability are handled, including the reported GCC private include path and workaround. Done means flang-rt configures and builds successfully on the reported ppc64le environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.