Bug 2240402 - Compilation fails when compiling Linux using LLVM with rust support enabled
Summary: Compilation fails when compiling Linux using LLVM with rust support enabled
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rust-bindgen-cli
Version: 38
Hardware: aarch64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Rust SIG
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-09-23 21:30 UTC by kazukih0205
Modified: 2023-10-10 01:35 UTC (History)
2 users (show)

Fixed In Version: rust-bindgen-cli-0.68.1-2.fc39 rust-bindgen-cli-0.68.1-2.el9 rust-bindgen-cli-0.68.1-2.fc37 rust-bindgen-cli-0.68.1-2.fc38
Clone Of:
Environment:
Last Closed: 2023-10-03 00:19:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description kazukih0205 2023-09-23 21:30:29 UTC
Description of problem:
rust-bindgen-cli is currently using LLVM 15 as a backend even though Fedora 38 and newer use LLVM 16. This breaks compilation of Linux when building with LLVM and spits about this error:

***
*** libclang (used by the Rust bindings generator 'bindgen')
*** version does not match Clang's. This may be a problem.
***   libclang version: 15.0.7
***   Clang version:    16.0.6
***
  RUSTC L rust/core.o
  BINDGEN rust/bindings/bindings_generated.rs
  BINDGEN rust/bindings/bindings_helpers_generated.rs
  BINDGEN rust/uapi/uapi_generated.rs
error: unknown warning option '-Wno-cast-function-type-strict'; did you mean '-Wno-cast-function-type'? [-Wunknown-warning-option]
panicked at 'Unable to generate bindings: ClangDiagnostic("error: unknown warning option '-Wno-cast-function-type-strict'; did you mean '-Wno-cast-function-type'? [-Wunknown-warning-option]\n")', main.rs:52:36
make[2]: *** [rust/Makefile:317: rust/uapi/uapi_generated.rs] Error 101
make[2]: *** Deleting file 'rust/uapi/uapi_generated.rs'
make[2]: *** Waiting for unfinished jobs....
error: unknown warning option '-Wno-cast-function-type-strict'; did you mean '-Wno-cast-function-type'? [-Wunknown-warning-option]
panicked at 'Unable to generate bindings: ClangDiagnostic("error: unknown warning option '-Wno-cast-function-type-strict'; did you mean '-Wno-cast-function-type'? [-Wunknown-warning-option]\n")', main.rs:52:36
make[2]: *** [rust/Makefile:311: rust/bindings/bindings_generated.rs] Error 101
make[2]: *** Deleting file 'rust/bindings/bindings_generated.rs'
error: unknown warning option '-Wno-cast-function-type-strict'; did you mean '-Wno-cast-function-type'? [-Wunknown-warning-option]
panicked at 'Unable to generate bindings: ClangDiagnostic("error: unknown warning option '-Wno-cast-function-type-strict'; did you mean '-Wno-cast-function-type'? [-Wunknown-warning-option]\n")', main.rs:52:36
make[2]: *** [rust/Makefile:331: rust/bindings/bindings_helpers_generated.rs] Error 101
make[2]: *** Deleting file 'rust/bindings/bindings_helpers_generated.rs'
warning: unknown feature specified for `-Ctarget-feature`: `fp-armv8`
  |
  = note: it is still passed through to the codegen backend
  = help: consider filing a feature request

warning: 1 warning emitted

make[1]: *** [/builddir/build/BUILD/linux-asahi-wip/Makefile:1287: prepare] Error 2
make: *** [Makefile:234: __sub-make] Error 2

I was able to fix this by using the testing version of the package (0.68.1) since that was built recently and uses LLVM 16 as a backend.

Version-Release number of selected component (if applicable):
0.63.0-4.fc38

How reproducible:
Can always be reproduced.

Steps to Reproduce:
1. Enable CONFIG_RUST in the defconfig.
2. Set "export LLVM=1" to build with LLVM.
3. make

How to fix:
Rebuild the package.

Comment 1 Fabio Valentini 2023-09-24 10:19:59 UTC
Thanks for the report.
I think I'll just build bindgen in the mode where it dlopen's libclang.so at runtime instead of linking with it ... which should make it no longer necessary to rebuilt it for new LLVM / Clang versions.

Comment 2 Fedora Update System 2023-10-01 16:40:43 UTC
FEDORA-2023-044574a2c9 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-044574a2c9

Comment 3 Fedora Update System 2023-10-01 16:40:44 UTC
FEDORA-EPEL-2023-8f24d6e8d2 has been submitted as an update to Fedora EPEL 9. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-8f24d6e8d2

Comment 4 Fedora Update System 2023-10-01 16:40:44 UTC
FEDORA-2023-fb4e622939 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-fb4e622939

Comment 5 Fedora Update System 2023-10-02 01:04:08 UTC
FEDORA-EPEL-2023-8f24d6e8d2 has been pushed to the Fedora EPEL 9 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-8f24d6e8d2

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2023-10-02 01:36:13 UTC
FEDORA-2023-fb4e622939 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-fb4e622939`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-fb4e622939

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2023-10-02 02:50:56 UTC
FEDORA-2023-044574a2c9 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-044574a2c9`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-044574a2c9

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2023-10-02 03:34:23 UTC
FEDORA-2023-c90f49436f has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-c90f49436f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-c90f49436f

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2023-10-03 00:19:22 UTC
FEDORA-2023-044574a2c9 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2023-10-10 00:34:41 UTC
FEDORA-EPEL-2023-8f24d6e8d2 has been pushed to the Fedora EPEL 9 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Fedora Update System 2023-10-10 01:32:59 UTC
FEDORA-2023-fb4e622939 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Fedora Update System 2023-10-10 01:35:53 UTC
FEDORA-2023-c90f49436f has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.