Skip to content

libclang bindgen version check fails when version is in path #942

Closed
@jordanisaacs

Description

@jordanisaacs

The libclang bindgen version check (here) fails on paths with versions. The grep gets the value from the path rather than the version itself. This is triggered within nix builds of linux and causes the output to not be built with rust enabled. I believe the fix is to use tail rather than head.

$ LC_ALL=c bindgen scripts/rust_is_available_bindgen_libclang.h 
/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/bash: warning: setlocale: LC_ALL: cannot change locale (c)
scripts/rust_is_available_bindgen_libclang.h:2:9: warning: clang version 11.1.0  [-W#pragma-messages], err: false
Failed to run rustfmt: cannot find binary path (non-fatal, continuing)
/* automatically generated by rust-bindgen 0.59.2 */

$ LC_ALL=C bindgen scripts/rust_is_available_bindgen_libclang.h 2>&1 \
 | grep -F 'clang version ' \
 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \
 | head -n 1
11.1.0
$ LC_ALL=c bindgen $(pwd)/scripts/rust_is_available_bindgen_libclang.h 
/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/bash: warning: setlocale: LC_ALL: cannot change locale (c)
/home/jd/Documents/dev/kernel-module-flake/linux-6.1/outputs/dev/lib/modules/6.1.0-development/source/scripts/rust_is_available_bindgen_libclang.h:2:9: warning: clang version 11.1.0  [-W#pragma-messages], err: false
Failed to run rustfmt: cannot find binary path (non-fatal, continuing)
/* automatically generated by rust-bindgen 0.59.2 */

$ LC_ALL=C bindgen $(pwd)/scripts/rust_is_available_bindgen_libclang.h 2>&1 \
 | grep -F 'clang version ' \
 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \
 | head -n 1
6.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    • kbuildRelated to building the kernel, `make`, `Kbuild`, `Kconfig` options...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions