Skip to content

scripts: Take only first line of clang version. #789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
scripts: Take only first line of clang version.
Using the line below to compile with Clang:
    ```
    $make ARCH=x86_64 CC=clang -j9
    ```

Emits the following warning:
    ```
    *** libclang (used by the Rust bindings generator 'bindgen') version does not match Clang's. This may be a problem.
    ***   libclang version: 13.0.0
13.0.0                                                                                                                                                        ***   Clang version:    13.0.0
    ***
    ```

This is a result of `$LC_ALL=C bindgen
scripts/rust-is-available-bindgen-libclang.h`, which gets called from
`scripts/rust-is-available.sh`, producing two matches against the
grep'ed pattern "[0-9]+\.[0-9]+\.[0-9]+":
    ```
    scripts/rust-is-available-bindgen-libclang.h:2:9: warning: clang version 13.0.0 (Fedora 13.0.0-3.fc35) [-W#pragma-messages], err: false
    ```
This fixes the issue by pipe'ing the matching result to a `head` call,
getting the first result one.

Signed-off-by: Tiago Lam <[email protected]>
  • Loading branch information
tiagolam committed Jun 14, 2022
commit d84bdb64b7e2df41cf11403c5358767fa4c0921c
1 change: 1 addition & 0 deletions scripts/rust-is-available.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ bindgen_libclang_version=$( \
LC_ALL=C "$BINDGEN" $(dirname $0)/rust-is-available-bindgen-libclang.h 2>&1 >/dev/null \
| grep -F 'clang version ' \
| grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \
| head -n 1 \
)
bindgen_libclang_min_version=$($min_tool_version llvm)
bindgen_libclang_cversion=$(get_canonical_version $bindgen_libclang_version)
Expand Down