Skip to content

regression: Mesa fails to build with meson 1.2.2 #12326

Closed

Description

@DimStar77

Describe the bug

Mesa (up to 23.2.0-rc4) fails to build using meson 1.2.2 (worked with meson 1.2.1). The build error looks like this"

[  640s] FAILED: src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs 
[  640s] /usr/bin/bindgen ../src/gallium/frontends/rusticl/rusticl_opencl_bindings.h --output /home/abuild/rpmbuild/BUILD/mesa-23.2.0-rc4/x86_64-suse-linux/src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs --no-convert-floats --use-array-pointers-in-arguments --default-enum-style rust --with-derive-partialeq --with-derive-eq --with-derive-partialord --with-derive-ord --with-derive-hash --with-derive-default --anon-fields-prefix anon_ --size_t-is-usize --disable-header-comment --ignore-functions --raw-line 'unsafe impl std::marker::Sync for _cl_icd_dispatch {}' --allowlist-type 'cl_.*' --allowlist-var 'CL_.*' --new-type-alias-deref 'cl_(mem|image|pipe)_info' --new-type-alias-deref 'cl_kernel_(arg|work_group)_info' --new-type-alias-deref 'cl_(event|profiling)_info' -- -fno-builtin-malloc -DCL_USE_DEPRECATED_OPENCL_1_0_APIS -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_USE_DEPRECATED_OPENCL_2_0_APIS -DCL_USE_DEPRECATED_OPENCL_2_1_APIS -DCL_USE_DEPRECATED_OPENCL_2_2_APIS -DCL_TARGET_OPENCL_VERSION=300 -I/home/abuild/rpmbuild/BUILD/mesa-23.2.0-rc4/include/. -I/home/abuild/rpmbuild/BUILD/mesa-23.2.0-rc4/x86_64-suse-linux/include/. -DNDEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="23.2.0-rc4"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"' -DHAVE_OPENGL=1 -DHAVE_OPENGL_ES_1=1 -DHAVE_OPENGL_ES_2=1 -DHAVE_R300 -DHAVE_R600 -DHAVE_RADEONSI -DHAVE_NOUVEAU -DHAVE_SWRAST -DHAVE_SVGA -DHAVE_VIRGL -DHAVE_IRIS -DHAVE_CROCUS -DHAVE_I915 -DHAVE_D3D12 -DHAVE_ZINK -DVIDEO_CODEC_VC1DEC=0 -DVIDEO_CODEC_H264DEC=0 -DVIDEO_CODEC_H264ENC=0 -DVIDEO_CODEC_H265DEC=0 -DVIDEO_CODEC_H265ENC=0 -DHAVE_X11_PLATFORM -DHAVE_WAYLAND_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DHAVE_XCB_PLATFORM -DHAVE_ST_VDPAU -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DGLAPI_EXPORT_PROTO_ENTRY_POINTS=0 -DALLOW_KCMP -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE___BUILTIN_TYPES_COMPATIBLE_P -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_UINT128 -DHAVE_REALLOCARRAY -DHAVE_FMEMOPEN -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_64_ASM -DMAJOR_IN_SYSMACROS -DHAS_SCHED_H -DHAS_SCHED_GETAFFINITY -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_SYS_SHM_H -DHAVE_CET_H -DHAVE_SYS_INOTIFY_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_MEMFD_CREATE -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R -DHAVE_GETRANDOM -DHAVE_POSIX_FALLOCATE -DHAVE_GNU_QSORT_R -DHAVE_STRUCT_TIMESPEC -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_ISSIGNALING -DHAVE_POSIX_MEMALIGN -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DSUPPORT_INTEL_INTEGRATED_GPUS -DHAVE_ZLIB -DHAVE_COMPRESSION -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DLLVM_AVAILABLE '-DMESA_LLVM_VERSION_STRING="17.0.1"' -DLLVM_IS_SHARED=1 -DDRAW_LLVM_AVAILABLE -DUSE_LIBELF -DUSE_LIBGLVND=1 -DHAVE_VALGRIND -DWL_HIDE_DEPRECATED -DHAVE_OPENMP -DHAVE_DRI -DHAVE_DRI2 -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -DHAVE_DRISW_KMS -mtls-dialect=gnu2 -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=empty-body -Werror=incompatible-pointer-types -Werror=int-conversion -Wimplicit-fallthrough -Wmisleading-indentation -Wno-missing-field-initializers -Wno-format-truncation -Wno-nonnull-compare -fno-math-errno -fno-trapping-math -fno-common -Wno-unused-function -Werror=format -Wformat-security -ffunction-sections -fdata-sections -Wno-unused-variable -Wno-unused-but-set-variable -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -MD -MQ ../src/gallium/frontends/rusticl/rusticl_opencl_bindings.h -MF src/gallium/frontends/rusticl/rusticl_opencl_bindings.h.d
[  640s] warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
[  640s] warning: unknown warning option '-Wno-nonnull-compare' [-Wunknown-warning-option]
[  640s] error: unknown argument: '-mtls-dialect=gnu2'
[  640s] warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
[  640s] warning: unknown warning option '-Wno-nonnull-compare' [-Wunknown-warning-option]
[  640s] /home/abuild/rpmbuild/BUILD/mesa-23.2.0-rc4/include/./CL/cl_platform.h:362:10: fatal error: 'stddef.h' file not found
[  640s] clang diag: warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
[  640s] clang diag: warning: unknown warning option '-Wno-nonnull-compare' [-Wunknown-warning-option]
[  640s] panicked at 'Unable to generate bindings: ClangDiagnostic("error: unknown argument: '-mtls-dialect=gnu2'\n/home/abuild/rpmbuild/BUILD/mesa-23.2.0-rc4/include/./CL/cl_platform.h:362:10: fatal error: 'stddef.h' file not found\n")', bindgen-cli/main.rs:52:36

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? No
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) openSUSE Tumbleweed
  • what Python version are you using e.g. 3.8.0 3.11.5
  • what meson --version1.2.2
  • what ninja --version if it's a Ninja build 1.11.1

A similar thread was found on linuxquestions: https://www.linuxquestions.org/questions/slackware-14/regression-mesa-failed-to-build-with-newer-meson-1-2-2-a-4175729515/

where it was identified to come from:

This because meson 1.2.2 incorrectly add C compiler options to "bindgen" program.

Reverting the old behavior solves the issue:

diff -ur meson-1.2.2/mesonbuild/modules/rust.py meson-1.2.1/mesonbuild/modules/rust.py
--- meson-1.2.2/mesonbuild/modules/rust.py      2023-09-28 17:25:47.000000000 +0200
+++ meson-1.2.1/mesonbuild/modules/rust.py      2023-08-07 22:40:24.000000000 +0200
@@ -232,12 +232,6 @@
                 elif isinstance(s, CustomTarget):
                     depends.append(s)
 
-        clang_args.extend(state.global_args.get('c', []))
-        clang_args.extend(state.project_args.get('c', []))
-        cargs = state.get_option('args', state.subproject, lang='c')
-        assert isinstance(cargs, list), 'for mypy'
-        clang_args.extend(cargs)
-
         if self._bindgen_bin is None:
             self._bindgen_bin = state.find_program('bindgen')

Activity

  1. eli-schwartz commented on Oct 4, 2023

    @eli-schwartz
    Member

    Indeed, mentioned as a comment to the original ticket asking for this change to be instituted: #12065 (comment)

    As noted in the slackware forum, Gentoo has reverted the commit on my advice. This is probably generally a good idea. There's ongoing discussion about what the solution should be.

  2. eli-schwartz commented on Oct 4, 2023

    @eli-schwartz
    Member

    @karolherbst, @dcbaker IMHO we should probably at least publish an official revert for the stable branch...

  3. karolherbst commented on Oct 4, 2023

    @karolherbst
    Contributor

    @karolherbst, @dcbaker IMHO we should probably at least publish an official revert for the stable branch...

    yeah, fine by me.

  4. added this to the 1.2.3 milestone on Oct 11, 2023
  5. nirbheek commented on Oct 17, 2023

    @nirbheek
    Member

    Fixed by #12380.

  6. nirbheek commented on Oct 18, 2023

    @nirbheek
    Member

    This regression will be fixed in 1.2.3 with a revert of the original patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions