惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
WordPress大学
WordPress大学
B
Blog RSS Feed
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
C
Check Point Blog
P
Proofpoint News Feed
H
Help Net Security
月光博客
月光博客
博客园_首页
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理
U
Unit 42
美团技术团队
I
InfoQ
A
About on SuperTechFans

Arch Linux Forums

Gnome desktop mouse cursor zoom issues / Newbie Corner Avidemux crashes without strace / Applications & Desktop Environments how to apply patches with non-linux linends / Newbie Corner Replicating CachyOS on vanilla Arch (or at least getting close) / Arch Discussion What's arch linux GUI package manager ? / Newbie Corner Hibernation failing due to insufficient memory / System Administration profiledef.sh editting question / Installation trying to script kde plasma wallpaper settings / Programming & Scripting Looking for new Audacious package maintainer / Creating & Modifying Packages issues installing arch with LUKS2 encryption / Newbie Corner QEMU PXE booting does not work with OVMF.4m.fd / Applications & Desktop Environments Wired lan regular disconnect / Newbie Corner Need Help setting up ARCH in my G16 G634JZR iwlwifi started failing consistently, trying to determine root cause Windows randomly jumping between monitors after GNOME 50 update No display via DP or HDMI after boot. / Kernel & Hardware how to change acpi platform_profile? / Newbie Corner Linux denied all kernel modules which not loaded right now Use iPhone as Webcam for Arch Linux Video Output Failure on nvidia-580xx-dkms on TTY --> Desktop switch (Page 2) / Kernel & Hardware I was going to rant ..WINE32 Sabotage compliments of Arvind Krishna / Arch Discussion [SOLVED] LUKS drive auto unlocked by TPM when expected not to / Networking, Server, and Protection Hibernate/suspend from X = dark panel; from TTY = works (ASUS G14, hyb (Page 2) / Laptop Issues Headphone jack noise/buzz / Newbie Corner segmentation fault in cc1plus when building CLK / AUR Issues, Discussion & PKGBUILD Requests Console alternative to meld / GNU/Linux Discussion Problem with paru git clone / Newbie Corner XKB questions / Applications & Desktop Environments gnome-keyring-daemon is not working correctly / Applications & Desktop Environments [SOLVED] Steam opens and immediately closes constantly / Newbie Corner
Possible solution for mesa-amber build failure with glibc...
V1del · 2026-06-02 · via Arch Linux Forums

With glibc-2.43 the build fails with

threads_posix.h: error: conflicting types for once_flag; have pthread_once_t {aka int}

See https://bugs.gentoo.org/show_bug.cgi?id=969493

I managed a reduced build (x11 only and i965 only, otherwise why would you want to use amber) with the following patch:

diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 45cb6075e6e..1e0ca3bc556 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -51,7 +51,6 @@ Configuration macro:
 #include <pthread.h>
 
 /*---------------------------- macros ----------------------------*/
-#define ONCE_FLAG_INIT PTHREAD_ONCE_INIT
 #ifdef INIT_ONCE_STATIC_INIT
 #define TSS_DTOR_ITERATIONS PTHREAD_DESTRUCTOR_ITERATIONS
 #else
@@ -66,7 +65,6 @@ typedef pthread_cond_t  cnd_t;
 typedef pthread_t       thrd_t;
 typedef pthread_key_t   tss_t;
 typedef pthread_mutex_t mtx_t;
-typedef pthread_once_t  once_flag;
 
 
 /*
@@ -90,12 +88,6 @@ impl_thrd_routine(void *p)
 
 /*--------------- 7.25.2 Initialization functions ---------------*/
 // 7.25.2.1
-static inline void
-call_once(once_flag *flag, void (*func)(void))
-{
-    pthread_once(flag, func);
-}
-
 
 /*------------- 7.25.3 Condition variable functions -------------*/
 // 7.25.3.1
diff --git a/meson.build b/meson.build
index 9b0ca5c8384..a51aec3ecb9 100644
--- a/meson.build
+++ b/meson.build
@@ -1014,10 +1014,13 @@ prog_python = import('python').find_installation('python3')
 has_mako = run_command(
   prog_python, '-c',
   '''
-from distutils.version import StrictVersion
+try:
+  from packaging.version import Version
+except:
+  from distutils.version import StrictVersion as Version
 import mako
-assert StrictVersion(mako.__version__) > StrictVersion("0.8.0")
-  ''')
+assert Version(mako.__version__) >= Version("0.8.0")
+  ''', check: false)
 if has_mako.returncode() != 0
   error('Python (3.x) mako module >= 0.8.0 required to build mesa.')
 endif
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index ffc7c3c7687..5656e52d61f 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -67,7 +67,6 @@ struct glx_context dummyContext = {
 
 _X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
 
-# if defined( USE_ELF_TLS )
 
 /**
  * Per-thread GLX context pointer.
@@ -84,54 +83,6 @@ __glXSetCurrentContext(struct glx_context * c)
    __glX_tls_Context = (c != NULL) ? c : &dummyContext;
 }
 
-# else
-
-static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-
-/**
- * Per-thread data key.
- *
- * Once \c init_thread_data has been called, the per-thread data key will
- * take a value of \c NULL.  As each new thread is created the default
- * value, in that thread, will be \c NULL.
- */
-static pthread_key_t ContextTSD;
-
-/**
- * Initialize the per-thread data key.
- *
- * This function is called \b exactly once per-process (not per-thread!) to
- * initialize the per-thread data key.  This is ideally done using the
- * \c pthread_once mechanism.
- */
-static void
-init_thread_data(void)
-{
-   if (pthread_key_create(&ContextTSD, NULL) != 0) {
-      perror("pthread_key_create");
-      exit(-1);
-   }
-}
-
-_X_HIDDEN void
-__glXSetCurrentContext(struct glx_context * c)
-{
-   pthread_once(&once_control, init_thread_data);
-   pthread_setspecific(ContextTSD, c);
-}
-
-_X_HIDDEN struct glx_context *
-__glXGetCurrentContext(void)
-{
-   void *v;
-
-   pthread_once(&once_control, init_thread_data);
-
-   v = pthread_getspecific(ContextTSD);
-   return (v == NULL) ? &dummyContext : (struct glx_context *) v;
-}
-
-# endif /* defined( USE_ELF_TLS ) */
 
 
 _X_HIDDEN void

This is the full git diff which contains the python-3.13 patch for meson.build.

I used the following PKGBUILD:

# Maintainer: Laurent Carlier <lordheavym@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Andreas Radke <andyrtr@archlinux.org>

pkgname=mesa-amber-git
pkgdesc="classic OpenGL (non-Gallium3D) drivers"
pkgver=21.3.9
pkgrel=13
arch=('x86_64')
makedepends=('python-mako' 'libxml2' 'libx11' 'libxshmfence' 'meson-python'
             'libxxf86vm' 'libxdamage' 'zstd' 'lm_sensors'
			 'libxrandr' 'glslang' 'meson' 'git')
       # 'elfutils'
url="https://www.mesa3d.org/"
license=('custom')

groups=(modified)

source=('mesa::git+https://gitlab.freedesktop.org/mesa/mesa.git#branch=amber'
        'LICENSE')
sha256sums=(
            'SKIP'
            '7052ba73bb07ea78873a2431ee4e828f4e72bda7d176d07f770fa48373dec537')
#validpgpkeys=('57551DE15B968F6341C248F68D8E31AFC32428A6') # Eric Engestrom <eric@engestrom.ch>
validpgpkeys=('71C4B75620BC75708B4BDB254C95FAAB3EB073EC') # Dylan Baker <dylan@pnwbakers.com>

prepare() {
  cd mesa
  # patch for python 3.13, derived from mesa-24:
  #patch -Np1 < ../../mako.patch
  patch -Np1 < ../../once_flag.patch
}

build() {
  # Build only minimal debug info to reduce size
  CFLAGS+=' -g1 -Wno-error=incompatible-pointer-types'
  CXXFLAGS+=' -g1'
  meson setup mesa build -Dprefix=/usr \
    -D b_lto=true \
    -D b_ndebug=true \
    -D amber=true \
    -D platforms=x11 \
    -D shader-cache-default=true \
    -D dri-drivers='i965' \
    -D gallium-drivers='' \
    -D vulkan-drivers='' \
    -D dri3=enabled \
    -D gallium-nine=false \
    -D gallium-omx=disabled \
    -D gallium-opencl=disabled \
    -D gallium-va=disabled \
    -D gallium-vdpau=disabled \
    -D gallium-xa=disabled \
    -D gallium-xvmc=disabled \
    -D gles1=disabled \
    -D gles2=disabled \
    -D glvnd=false \
    -D glx=dri \
    -D libunwind=disabled \
    -D llvm=disabled \
    -D lmsensors=enabled \
    -D osmesa=false \
    -D shared-glapi=enabled \
    -D microsoft-clc=disabled \
    -D valgrind=disabled \
    -D zstd=enabled \
    -D datasources=''

  ninja -C build
  meson compile -C build
}

package() {
  depends=('libdrm' 'libxxf86vm' 'libxshmfence' 'libelf'
           'zstd')
  conflicts=('mesa' 'mesa-git')
  provides=("mesa" 'libgl' 'mesa-libgl' 'libglvnd' 'opengl-driver')

  DESTDIR="${pkgdir}" meson install -C build

  install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}

The output of "pacman -Qi mesa-amber-git":

Name            : mesa-amber-git
Version         : 21.3.9-13
Description     : classic OpenGL (non-Gallium3D) drivers
Architecture    : x86_64
URL             : https://www.mesa3d.org/
Licenses        : custom
Groups          : modified
Provides        : mesa  libgl  mesa-libgl  libglvnd  opengl-driver
Depends On      : libdrm  libxxf86vm  libxshmfence  libelf  zstd
Optional Deps   : None
Required By     : libva-git  picom-git  xorg-server-devel-git
Optional For    : None
Conflicts With  : mesa  mesa-git
Replaces        : None
Installed Size  : 16.51 MiB
Packager        : nokangaroo <nokangaroo@NOSPAM.aon.at>
Build Date      : Mon 01 Jun 2026 02:35:25 PM CEST
Install Date    : Mon 01 Jun 2026 02:41:39 PM CEST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None

This is unbeatable for size, and works perfectly on my Skylake box. The last
mesa version that worked properly for me was 23.3.6 (which would need a similar
patch). Mesa 24 caused choppy rendering with Golly (which I no longer use,
but it is proof that I can do without the huge software bloat of the current
version). I once built a mesa-less system (in the time of the i915 kernel
crash, to find out if mesa was responsible, which it wasn't). It was a hack
that involved building Xorg without glx and using the intel driver, but it
turns out that 2D acceleration is perfectly good for video playback. I use
mesa-amber for simplicity, as the minimum to meet depencencies. The packaged
libglvnd didn't work with mesa-amber, but mesa's internal libgl will do, at
least for intel. Incidentally, the intel driver is maintained again, see
https://github.com/X11Libre/xf86-video-intel.

uname -r:  7.0.10-1-git
Processor: Intel® Core™ i3-6100 CPU @ 3.70GHz × 4
Graphics:  Mesa DRI Intel® HD Graphics 530 (SKL GT2)