Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

/lib/modules/5.18.14-arch1-1/build/arch/x86/include/asm/ibt.h:67:8: error: 'nocf_check' attribute ignored; use -fcf-protection to enable the attribute [-Wignored-attributes] #339

Open
yasin-cs-ko-ak opened this issue Jul 27, 2022 · 2 comments

Comments

@yasin-cs-ko-ak
Copy link

I was trying to install redbpf from this source.
This was the output I got.

~ cd redbpf                                                                                                                       
➜  redbpf git:(llvm14) git submodule update       
➜  redbpf git:(llvm14) git submodule update --init
➜  redbpf git:(llvm14) cargo build
warning: field is never read: `flags`
   --> redbpf/src/symbols.rs:110:5
    |
110 |     flags: i32,
    |     ^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default
note: `CacheEntry` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
   --> redbpf/src/symbols.rs:106:10
    |
106 | #[derive(Debug)]
    |          ^^^^^
    = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `redbpf` (lib) generated 1 warning
warning: use of deprecated function `llvm_sys::core::LLVMBuildCall`: Use LLVMBuildCall2 instead to support opaque pointers.
   --> cargo-bpf/src/llvm.rs:126:5
    |
126 |     LLVMBuildCall(builder, exit, ptr::null_mut(), 0, c_str.as_ptr());
    |     ^^^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: `cargo-bpf` (lib) generated 1 warning
   Compiling redbpf-tools v0.1.0 (/home/u1tron/redbpf/redbpf-tools)
warning: `#[derive]` can't be used on a `#[repr(packed)]` struct that does not derive Copy (error E0133)
     --> /home/u1tron/redbpf/target/debug/build/redbpf-probes-fc77f5d7250877f6/out/gen_bindings.rs:62472:14
      |
62472 |     #[derive(Debug)]
      |              ^^^^^
      |
      = note: `#[warn(unaligned_references)]` on by default
      = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
      = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
      = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `redbpf-probes` (lib) generated 1 warning
error: failed to run custom build command for `redbpf-tools v0.1.0 (/home/u1tron/redbpf/redbpf-tools)`

Caused by:
  process didn't exit successfully: `/home/u1tron/redbpf/target/debug/build/redbpf-tools-e1476825ba5dede8/build-script-build` (exit status: 101)
  --- stderr
  warning: function is never used: `print_cargo_bpf_llvm_version`
   --> cargo-bpf/build.rs:5:4
    |
  5 | fn print_cargo_bpf_llvm_version() {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

  warning: `cargo-bpf` (build script) generated 1 warning
     Compiling probes v0.1.0 (/home/u1tron/redbpf/redbpf-tools/probes)
     Compiling redbpf-probes v2.3.0 (/home/u1tron/redbpf/redbpf-probes)
  warning: `#[derive]` can't be used on a `#[repr(packed)]` struct that does not derive Copy (error E0133)
       --> /home/u1tron/redbpf/target/debug/build/redbpf-tools-591ce58b7620cbae/out/target/bpf/release/build/redbpf-probes-4f53a51a5490da77/out/gen_bindings.rs:62472:14
        |
  62472 |     #[derive(Debug)]
        |              ^^^^^
        |
        = note: `#[warn(unaligned_references)]` on by default
        = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
        = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
        = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

  error: failed to run custom build command for `probes v0.1.0 (/home/u1tron/redbpf/redbpf-tools/probes)`

  Caused by:
    process didn't exit successfully: `/home/u1tron/redbpf/target/debug/build/redbpf-tools-591ce58b7620cbae/out/target/bpf/release/build/probes-7ee8f9b2b2b95feb/build-script-build` (exit status: 101)
    --- stdout
    cargo:rerun-if-changed=include/
    cargo:rerun-if-changed=include/bindings.h
    Jul 27 16:14:47.244 DEBUG build_script_build: Try generating custom bindings with pre-installed kernel headers

    --- stderr
    /lib/modules/5.18.14-arch1-1/build/arch/x86/include/asm/ibt.h:67:8: error: 'nocf_check' attribute ignored; use -fcf-protection to enable the attribute [-Wignored-attributes]
    /lib/modules/5.18.14-arch1-1/build/arch/x86/include/asm/ibt.h:68:8: error: 'nocf_check' attribute ignored; use -fcf-protection to enable the attribute [-Wignored-attributes]
    /lib/modules/5.18.14-arch1-1/build/arch/x86/include/asm/ibt.h:67:8: error: 'nocf_check' attribute ignored; use -fcf-protection to enable the attribute [-Wignored-attributes], err: true
    /lib/modules/5.18.14-arch1-1/build/arch/x86/include/asm/ibt.h:68:8: error: 'nocf_check' attribute ignored; use -fcf-protection to enable the attribute [-Wignored-attributes], err: true
    thread 'main' panicked at 'failed to generate bindings: ()', redbpf-tools/probes/build.rs:79:10
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  warning: build failed, waiting for other jobs to finish...
  warning: `redbpf-probes` (lib) generated 1 warning
  thread 'main' panicked at 'couldn't compile probes: Compile("iotop", None)', redbpf-tools/build.rs:16:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@yasin-cs-ko-ak
Copy link
Author

The problem still occurs. I could not figure out. The header file is there but still no luck.
If anyone know, kindly comment here.

@jiripospisil
Copy link

Not sure what's the right fix here, the machine I'm testing this on doesn't even support control flow extensions. It seems that the current Arch build is failing for the same reason.

diff --git a/cargo-bpf/src/build_constants.rs b/cargo-bpf/src/build_constants.rs
index 36a68dd..b2890e4 100644
--- a/cargo-bpf/src/build_constants.rs
+++ b/cargo-bpf/src/build_constants.rs
@@ -31,6 +31,7 @@ lazy_static! {
             "-D__KERNEL__",
             "-Wall",
             "-Werror",
+            "-Wno-error=ignored-attributes",
             "-Wunused",
             "-Wno-unknown-warning-option",
             "-Wno-frame-address",

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants