Package: bindgen
Version: 0.72.1-1+b3
Followup-For: Bug #1152834
X-Debbugs-Cc: [email protected]
Dear Maintainer,
I think I found why this might be broken.
The issue only appears to be happening when both clang-21 and clang-22
are installed.
I also have a smaller reproducer.
// === cat example.h ===
#if defined( __SSE__ )
#include <xmmintrin.h>
#endif
//
bindgen example.h -- -x c++ -std=c++17
/usr/lib/llvm-21/lib/clang/21/include/xmmintrin.h:245:18: error: use of
undeclared identifier '__builtin_ia32_sqrtss'
/usr/lib/llvm-21/lib/clang/21/include/xmmintrin.h:262:10: error: use of
undeclared identifier '__builtin_ia32_sqrtps'
/usr/lib/llvm-21/lib/clang/21/include/emmintrin.h:253:17: error: use of
undeclared identifier '__builtin_ia32_sqrtsd'
/usr/lib/llvm-21/lib/clang/21/include/emmintrin.h:269:10: error: use of
undeclared identifier '__builtin_ia32_sqrtpd'
Unable to generate bindings: clang diagnosed error:
/usr/lib/llvm-21/lib/clang/21/include/xmmintrin.h:245:18: error: use of
undeclared identifier '__builtin_ia32_sqrtss'
/usr/lib/llvm-21/lib/clang/21/include/xmmintrin.h:262:10: error: use of
undeclared identifier '__builtin_ia32_sqrtps'
/usr/lib/llvm-21/lib/clang/21/include/emmintrin.h:253:17: error: use of
undeclared identifier '__builtin_ia32_sqrtsd'
/usr/lib/llvm-21/lib/clang/21/include/emmintrin.h:269:10: error: use of
undeclared identifier '__builtin_ia32_sqrtpd'
Note, that this is on amd64, which should have sse and sse2 enabled by
default. Passing `-msse -msse2` and/or `-D__SSE__=1 -D__SSE__=2` does
not do anything (`-msse -msse2` might still be recommended when
cross-compiling for i386, but that is orthogonal and does not really
affect bingen generated bindings probably).
Uninstalling clang-21 (`apt purge -q -y clang-21`), and then running
same bindgen command - no issues.
Full list of packages when problem shows up:
$ dpkg -l | grep -E 'bingen|clang|llvm'
ii clang-22 1:22.1.8-4
amd64 C, C++ and Objective-C compiler
ii clang-format:amd64 1:21.1.8-74
amd64 Tool to format C/C++/Obj-C code
ii clang-format-21 1:21.1.8-13
amd64 Tool to format C/C++/Obj-C code
ii clang-tools-22 1:22.1.8-4
amd64 clang-based tools for C/C++
developments
ii libclang-21-dev 1:21.1.8-13
amd64 Clang library - Development package
ii libclang-common-21-dev:amd64 1:21.1.8-13
amd64 Clang library - Common development
package
ii libclang-common-22-dev:amd64 1:22.1.8-4
amd64 Clang library - Common development
package
ii libclang-cpp-dev 1:21.1.8-74
amd64 C++ interface to the clang library
ii libclang-cpp21 1:21.1.8-13
amd64 C++ interface to the Clang library
ii libclang-cpp21-dev 1:21.1.8-13
amd64 C++ interface to the Clang library
ii libclang-cpp22 1:22.1.8-4
amd64 C++ interface to the Clang library
ii libclang-dev 1:21.1.8-74
amd64 clang library - Development package
ii libclang-rt-21-dev 1:21.1.8-13
amd64 Compiler-rt - development package
ii libclang-rt-22-dev 1:22.1.8-4
amd64 Compiler-rt - development package
ii libclang1-21 1:21.1.8-13
amd64 C interface to the Clang library
ii libclang1-22 1:22.1.8-4
amd64 C interface to the Clang library
ii libllvm21:amd64 1:21.1.8-13
amd64 Modular compiler and toolchain
technologies, runtime library
ii libllvm21:i386 1:21.1.8-13
i386 Modular compiler and toolchain
technologies, runtime library
ii libllvm21-dbgsym:amd64 1:21.1.8-13
amd64 debug symbols for libllvm21
ii libllvm21-dbgsym:i386 1:21.1.8-13
i386 debug symbols for libllvm21
ii libllvm22:amd64 1:22.1.8-4
amd64 Modular compiler and toolchain
technologies, runtime library
ii libllvmspirvlib-21-dev:amd64 21.1.5-1
amd64 bi-directional translator for
LLVM/SPIRV -- development files
ii libllvmspirvlib-21-dev:i386 21.1.5-1
i386 bi-directional translator for
LLVM/SPIRV -- development files
ii libllvmspirvlib21.1:amd64 21.1.5-1
amd64 bi-directional translator for
LLVM/SPIRV -- shared library
ii libllvmspirvlib21.1:i386 21.1.5-1
i386 bi-directional translator for
LLVM/SPIRV -- shared library
ii llvm 1:21.1.8-74
amd64 Modular compiler and toolchain
technologies
ii llvm-21 1:21.1.8-13
amd64 Modular compiler and toolchain
technologies
ii llvm-21-dev 1:21.1.8-13
amd64 Modular compiler and toolchain
technologies, libraries and headers
ii llvm-21-linker-tools 1:21.1.8-13
amd64 Modular compiler and toolchain
technologies - Plugins
ii llvm-21-runtime 1:21.1.8-13
amd64 Modular compiler and toolchain
technologies, IR interpreter
ii llvm-21-tools 1:21.1.8-13
amd64 Modular compiler and toolchain
technologies, tools
ii llvm-22 1:22.1.8-4
amd64 Modular compiler and toolchain
technologies
ii llvm-22-dev 1:22.1.8-4
amd64 Modular compiler and toolchain
technologies, libraries and headers
ii llvm-22-linker-tools 1:22.1.8-4
amd64 Modular compiler and toolchain
technologies - Plugins
ii llvm-22-runtime 1:22.1.8-4
amd64 Modular compiler and toolchain
technologies, IR interpreter
ii llvm-22-tools 1:22.1.8-4
amd64 Modular compiler and toolchain
technologies, tools
ii llvm-runtime:amd64 1:21.1.8-74
amd64 Modular compiler and toolchain
technologies, bytecode interpreter
ii llvm-spirv-21 21.1.5-1
amd64 bi-directional translator for
LLVM/SPIRV
ii llvmlite-doc 0.50.0-0.2
all LLVM Python binding for writing JIT
compilers (docs)
ii python3-llvmlite 0.50.0-0.2
amd64 LLVM Python 3 binding for writing JIT
compilers
ii rust-llvm 1.98.1+dfsg1-1
amd64 Rust LLVM integration
$
And bindgen diagnostic and strace:
$ RUST_LOG=bindgen strace -e execve -f /usr/bin/bindgen example.h -- -x c++
-std=c++17
execve("/usr/bin/bindgen", ["/usr/bin/bindgen", "example.h", "--", "-x", "c++",
"-std=c++17"], 0x7fff18fa7690 /* 69 vars */) = 0
strace: Process 3014340 attached
[pid 3014340] execve("/usr/local/bin/llvm-config", ["llvm-config", "--prefix"],
0x7ffc8c7d2810 /* 69 vars */) = -1 ENOENT (No such file or directory)
[pid 3014340] execve("/usr/bin/llvm-config", ["llvm-config", "--prefix"],
0x7ffc8c7d2810 /* 69 vars */) = 0
[pid 3014340] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3014340, si_uid=1000,
si_status=0, si_utime=0, si_stime=0} ---
[2026-11-28T14:18:15Z INFO bindgen] Clang Version: Debian clang version 22.1.8
(4), parsed: Some((22, 1))
[2026-11-28T14:18:15Z DEBUG bindgen] Generating bindings, libclang at
/usr/lib/llvm-22/lib/libclang-22.so.1
[2026-11-28T14:18:15Z DEBUG bindgen] Trying to find clang with flags: ["-x",
"c++", "-std=c++17"]
strace: Process 3014386 attached
[pid 3014386] execve("/usr/local/bin/llvm-config", ["llvm-config", "--bindir"],
0x7ffc8c7d2810 /* 69 vars */) = -1 ENOENT (No such file or directory)
[pid 3014386] execve("/usr/bin/llvm-config", ["llvm-config", "--bindir"],
0x7ffc8c7d2810 /* 69 vars */) = 0
[pid 3014386] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3014386, si_uid=1000,
si_status=0, si_utime=0, si_stime=0} ---
strace: Process 3014387 attached
[pid 3014387] execve("/usr/lib/llvm-21/bin/clang",
["/usr/lib/llvm-21/bin/clang", "--version"], 0x7ffc8c7d2810 /* 69 vars */) = 0
[pid 3014387] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3014387, si_uid=1000,
si_status=0, si_utime=1 /* 0.01 s */, si_stime=2 /* 0.02 s */} ---
strace: Process 3014388 attached
[pid 3014388] execve("/usr/lib/llvm-21/bin/clang",
["/usr/lib/llvm-21/bin/clang", "-E", "-x", "c", "-", "-v", "-x", "c++",
"-std=c++17"], 0x7ffc8c7d2810 /* 69 vars */) = 0
[pid 3014388] +++ exited with 1 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3014388, si_uid=1000,
si_status=1, si_utime=0, si_stime=2 /* 0.02 s */} ---
strace: Process 3014389 attached
[pid 3014389] execve("/usr/lib/llvm-21/bin/clang",
["/usr/lib/llvm-21/bin/clang", "-E", "-x", "c++", "-", "-v", "-x", "c++",
"-std=c++17"], 0x7ffc8c7d2810 /* 69 vars */) = 0
[pid 3014389] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3014389, si_uid=1000,
si_status=0, si_utime=2 /* 0.02 s */, si_stime=2 /* 0.02 s */} ---
[2026-11-28T14:18:16Z DEBUG bindgen] Found clang: Clang { path:
"/usr/lib/llvm-21/bin/clang", version: Some(CXVersion { Major: 21, Minor: 1,
Subminor: 8 }), c_search_paths: None, cpp_search_paths:
Some(["/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16",
"/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/x86_64-linux-gnu/c++/16",
"/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/backward",
"/usr/lib/llvm-21/lib/clang/21/include", "/usr/local/include",
"/usr/include/x86_64-linux-gnu", "/usr/include"]) }
[2026-11-28T14:18:16Z DEBUG bindgen] Fixed-up options: BindgenOptions {
use_specific_virtual_function_receiver: false, use_distinct_char16_t: false,
represent_cxx_operators: false, blocklisted_types: RegexSet { items: [],
matched: [], set: Some(RegexSet([])), record_matches: true },
blocklisted_functions: RegexSet { items: [], matched: [], set:
Some(RegexSet([])), record_matches: true }, blocklisted_items: RegexSet {
items: [], matched: [], set: Some(RegexSet([])), record_matches: true },
blocklisted_files: RegexSet { items: [], matched: [], set: Some(RegexSet([])),
record_matches: true }, blocklisted_vars: RegexSet { items: [], matched: [],
set: Some(RegexSet([])), record_matches: true }, opaque_types: RegexSet {
items: [], matched: [], set: Some(RegexSet([])), record_matches: true },
rustfmt_path: None, depfile: None, allowlisted_types: RegexSet { items: [],
matched: [], set: Some(RegexSet([])), record_matches: true },
allowlisted_functions: RegexSet { items: [], matched: [], set:
Some(RegexSet([])), record_matches: true }, allowlisted_vars: RegexSet { items:
[], matched: [], set: Some(RegexSet([])), record_matches: true },
allowlisted_files: RegexSet { items: [], matched: [], set: Some(RegexSet([])),
record_matches: true }, allowlisted_items: RegexSet { items: [], matched: [],
set: Some(RegexSet([])), record_matches: true }, default_enum_style: Consts,
bitfield_enums: RegexSet { items: [], matched: [], set: Some(RegexSet([])),
record_matches: true }, newtype_enums: RegexSet { items: [], matched: [], set:
Some(RegexSet([])), record_matches: true }, newtype_global_enums: RegexSet {
items: [], matched: [], set: Some(RegexSet([])), record_matches: true },
rustified_enums: RegexSet { items: [], matched: [], set: Some(RegexSet([])),
record_matches: true }, rustified_non_exhaustive_enums: RegexSet { items: [],
matched: [], set: Some(RegexSet([])), record_matches: true },
constified_enum_modules: RegexSet { items: [], matched: [], set:
Some(RegexSet([])), record_matches: true }, constified_enums: RegexSet { items:
[], matched: [], set: Some(RegexSet([])), record_matches: true },
default_macro_constant_type: Unsigned, default_alias_style: TypeAlias,
type_alias: RegexSet { items: [], matched: [], set: Some(RegexSet([])),
record_matches: true }, new_type_alias: RegexSet { items: [], matched: [], set:
Some(RegexSet([])), record_matches: true }, new_type_alias_deref: RegexSet {
items: [], matched: [], set: Some(RegexSet([])), record_matches: true },
default_non_copy_union_style: BindgenWrapper, bindgen_wrapper_union: RegexSet {
items: [], matched: [], set: Some(RegexSet([])), record_matches: true },
manually_drop_union: RegexSet { items: [], matched: [], set:
Some(RegexSet([])), record_matches: true }, builtins: false, emit_ast: false,
emit_ir: false, emit_ir_graphviz: None, enable_cxx_namespaces: false,
enable_function_attribute_detection: false, disable_name_namespacing: false,
disable_nested_struct_naming: false, disable_header_comment: false,
layout_tests: true, impl_debug: false, impl_partialeq: false, derive_copy:
true, derive_debug: true, derive_default: false, derive_hash: false,
derive_partialord: false, derive_ord: false, derive_partialeq: false,
derive_eq: false, use_core: false, ctypes_prefix: None, anon_fields_prefix:
"__bindgen_anon_", time_phases: false, convert_floats: true, raw_lines: [],
module_lines: {}, input_headers: ["example.h"], clang_args: ["-x", "c++",
"-std=c++17", "-isystem",
"/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16", "-isystem",
"/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/x86_64-linux-gnu/c++/16",
"-isystem",
"/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/backward",
"-isystem", "/usr/lib/llvm-21/lib/clang/21/include", "-isystem",
"/usr/local/include", "-isystem", "/usr/include/x86_64-linux-gnu", "-isystem",
"/usr/include", "example.h"], fallback_clang_args: ["-x", "c++", "-std=c++17"],
input_header_contents: [], parse_callbacks: [], codegen_config:
CodegenConfig(FUNCTIONS | TYPES | VARS | METHODS | CONSTRUCTORS | DESTRUCTORS),
conservative_inline_namespaces: false, generate_comments: true,
generate_inline_functions: false, allowlist_recursively: true,
objc_extern_crate: false, generate_block: false, generate_cstr: false,
block_extern_crate: false, enable_mangling: true, detect_include_paths: true,
fit_macro_constants: false, prepend_enum_name: true, rust_target:
RustTarget(Stable(82, 0)), rust_edition: None, rust_features: RustFeatures {
unsafe_extern_blocks: true, offset_of: true, literal_cstr: true, thiscall_abi:
true, c_unwind_abi: true, abi_efiapi: true, core_ffi_c: true, raw_ref_macros:
true, min_const_generics: true, const_cstr: true, larger_arrays: true,
associated_constants: true, non_exhaustive: true, maybe_uninit: true,
repr_packed_n: true, vectorcall_abi: false, ptr_metadata: false,
layout_for_ptr: false }, untagged_union: true, record_matches: true,
size_t_is_usize: true, formatter: Rustfmt, rustfmt_configuration_file: None,
no_partialeq_types: RegexSet { items: [], matched: [], set: Some(RegexSet([])),
record_matches: true }, no_copy_types: RegexSet { items: [], matched: [], set:
Some(RegexSet([])), record_matches: true }, no_debug_types: RegexSet { items:
[], matched: [], set: Some(RegexSet([])), record_matches: true },
no_default_types: RegexSet { items: [], matched: [], set: Some(RegexSet([])),
record_matches: true }, no_hash_types: RegexSet { items: [], matched: [], set:
Some(RegexSet([])), record_matches: true }, must_use_types: RegexSet { items:
[], matched: [], set: Some(RegexSet([])), record_matches: true },
array_pointers_in_arguments: false, wasm_import_module_name: None,
dynamic_library_name: None, dynamic_link_require_all: false,
respect_cxx_access_specs: false, translate_enum_integer_types: false, c_naming:
false, force_explicit_padding: false, vtable_generation: false,
sort_semantically: false, merge_extern_blocks: false, wrap_unsafe_ops: false,
flexarray_dst: false, abi_overrides: {}, wrap_static_fns: false,
wrap_static_fns_suffix: None, wrap_static_fns_path: None, default_visibility:
Public, emit_diagnostics: false, clang_macro_fallback: false,
clang_macro_fallback_build_dir: None, generate_deleted_functions: false,
generate_pure_virtual_functions: false, generate_private_functions: false }
strace: Process 3014402 attached
/usr/lib/llvm-21/lib/clang/21/include/xmmintrin.h:245:18: error: use of
undeclared identifier '__builtin_ia32_sqrtss'
/usr/lib/llvm-21/lib/clang/21/include/xmmintrin.h:262:10: error: use of
undeclared identifier '__builtin_ia32_sqrtps'
/usr/lib/llvm-21/lib/clang/21/include/emmintrin.h:253:17: error: use of
undeclared identifier '__builtin_ia32_sqrtsd'
/usr/lib/llvm-21/lib/clang/21/include/emmintrin.h:269:10: error: use of
undeclared identifier '__builtin_ia32_sqrtpd'
[pid 3014402] +++ exited with 0 +++
Unable to generate bindings: clang diagnosed error:
/usr/lib/llvm-21/lib/clang/21/include/xmmintrin.h:245:18: error: use of
undeclared identifier '__builtin_ia32_sqrtss'
/usr/lib/llvm-21/lib/clang/21/include/xmmintrin.h:262:10: error: use of
undeclared identifier '__builtin_ia32_sqrtps'
/usr/lib/llvm-21/lib/clang/21/include/emmintrin.h:253:17: error: use of
undeclared identifier '__builtin_ia32_sqrtsd'
/usr/lib/llvm-21/lib/clang/21/include/emmintrin.h:269:10: error: use of
undeclared identifier '__builtin_ia32_sqrtpd'
+++ exited with 1 +++
As you can see bindgen loads libclang-22
[2026-11-28T14:18:15Z DEBUG bindgen] Generating bindings, libclang at
/usr/lib/llvm-22/lib/libclang-22.so.1
but invokes clang-21 -E
Also
$ /usr/bin/llvm-config --prefix
/usr/lib/llvm-21
$ /usr/bin/llvm-config --bindir
/usr/lib/llvm-21/bin
-- System Information:
Debian Release: forky/sid
APT prefers testing-debug
APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 7.3.4+deb14-amd64 (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_CPU_OUT_OF_SPEC
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages bindgen depends on:
ii libc6 2.43-7
ii libclang-dev 1:21.1.8-74
ii libgcc-s1 16.2.0-5
Versions of packages bindgen recommends:
ii rustfmt 1.98.1+dfsg1-1
bindgen suggests no packages.
-- no debconf information