Compiling Mesa with Clang + Polly fails early when Polly is used as external plugin (default on Arch and some other distros)
Describe the issue
I tried to compile Mesa with LLVM/Clang, Polly and LLD 11.1.0, but the compilation fails early while checking the sanity of the compiler.
As I use makepkg on Manjaro, I amend the PKGBUILD from "mesa-git" (AUR) with the following (I get the same error if I modify the makepkg.conf accordingly):
-D c_args="-O3 -march=native -mtune=native -fno-semantic-interposition -falign-functions=32 -flto=thin -Xclang -load -Xclang LLVMPolly.so -mllvm -polly -mllvm -polly-parallel -fopenmp -mllvm -polly-vectorizer=stripmine -mllvm -polly-omp-backend=LLVM -mllvm -polly-num-threads=24 -mllvm -polly-scheduling=dynamic -mllvm -polly-scheduling-chunksize=1" \
-D cpp_args="-O3 -march=native -mtune=native -fno-semantic-interposition -falign-functions=32 -flto=thin -Xclang -load -Xclang LLVMPolly.so -mllvm -polly -mllvm -polly-parallel -fopenmp -mllvm -polly-vectorizer=stripmine -mllvm -polly-omp-backend=LLVM -mllvm -polly-num-threads=24 -mllvm -polly-scheduling=dynamic -mllvm -polly-scheduling-chunksize=1" \
-D c_link_args="-Wl,-O2 -Wl,--as-needed -flto=thin -fuse-ld=lld" \
Here is the modified PKGBUILD: PKGBUILD
With that, I get the following output:
The Meson build system
Version: 0.57.1
Source dir: /home/marcus/Downloads/mesa-git/src/mesa
Build dir: /home/marcus/Downloads/mesa-git/src/_build
Build type: native build
Program python found: YES (/usr/bin/python)
Project name: mesa
Project version: 21.1.0-devel
C compiler for the host machine: clang (clang 11.1.0 "clang version 11.1.0")
C linker for the host machine: clang ld.bfd 2.36.1
C++ compiler for the host machine: clang++ (clang 11.1.0 "clang version 11.1.0")
C++ linker for the host machine: clang++ ld.bfd 2.36.1
Compiler for language c for the build machine not found.
Compiler for language cpp for the build machine not found.
Host machine cpu family: x86_64
Host machine cpu: x86_64
Dependency clang (modules: clangBasic, clangCodeGen, clangDriver, clangFrontend, clangFrontendTool, clangHandleCXX, clangHandleLLVM) skipped: feature microsoft-clc disabled
Program glslangValidator found: YES (/usr/bin/glslangValidator)
Found pkg-config: /usr/bin/pkg-config (1.7.3)
Run-time dependency libomxil-bellagio found: YES 0.9.3
Run-time dependency libva found: YES 1.10.0
Run-time dependency libclc found: YES 0.2.0
Program python3 found: YES (/usr/bin/python3)
mesa/meson.build:911:6: ERROR: Could not get define 'ETIME'
Here is the meson.log: meson-log.txt
Regression
As far as I know, no. I never got Mesa to compile with Clang+Polly before over the last year.
Any extra information would be greatly appreciated
Distribution: Manjaro 21.0-RC1 Mesa: mesa-git 21.1.0_devel.136824.731ea067-1
UPDATE from March 2023: This is still an issue with Clang 15.0.7, Meson 1.0.1 and Mesa-git, albeit the error message is different:
mesa/meson.build:21:0: ERROR: Compiler clang can not compile programs.