Skip to content
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

Compile command not found #7

Open
Wang-Ling-jie opened this issue Nov 18, 2024 · 3 comments
Open

Compile command not found #7

Wang-Ling-jie opened this issue Nov 18, 2024 · 3 comments

Comments

@Wang-Ling-jie
Copy link

At this step:

./analyze -p /path/to/linux/compile_commands.json

I got the following output which says'Compile command not found' :
image

and the next step will get the following error:
image

Is there anything missing?

@YangChenyuan
Copy link
Member

Hi, thanks for your interest in KernelGPT.

Did you generate the compile_commands.json by using bear -- make? Did the compilation process go well?

By the way, could you show me a snippet of the compile_commands.json file?

@Lelouny
Copy link

Lelouny commented Feb 28, 2025

i also encountered the same issue,i generated the compile_commands.json by using bear make.
my kernel version is Linux 6.7 (d2f51b) ,clang version is 14, firstly i tried compiled it with allyesconfig but failed, so i compiled it with syzbot.config(it worked). Below is a snippet of the compile_commands.json file:

[
    {
        "arguments": [
            "clang",
            "-c",
            "-Wp,-MMD,fs/afs/.main.o.d",
            "-nostdinc",
            "-I./arch/x86/include",
            "-I./arch/x86/include/generated",
            "-I./include",
            "-I./arch/x86/include/uapi",
            "-I./arch/x86/include/generated/uapi",
            "-I./include/uapi",
            "-I./include/generated/uapi",
            "-include",
            "./include/linux/compiler-version.h",
            "-include",
            "./include/linux/kconfig.h",
            "-include",
            "./include/linux/compiler_types.h",
            "-D__KERNEL__",
            "--target=x86_64-linux-gnu",
            "-fintegrated-as",
            "-Werror=unknown-warning-option",
            "-Werror=ignored-optimization-argument",
            "-Werror=option-ignored",
            "-Werror=unused-command-line-argument",
            "-fmacro-prefix-map=./=",
            "-std=gnu11",
            "-fshort-wchar",
            "-funsigned-char",
            "-fno-common",
            "-fno-PIE",
            "-fno-strict-aliasing",
            "-mno-sse",
            "-mno-mmx",
            "-mno-sse2",
            "-mno-3dnow",
            "-mno-avx",
            "-fcf-protection=branch",
            "-fno-jump-tables",
            "-m64",
            "-falign-loops=1",
            "-mno-80387",
            "-mno-fp-ret-in-387",
            "-mstack-alignment=8",
            "-mskip-rax-setup",
            "-march=core2",
            "-mno-red-zone",
            "-mcmodel=kernel",
            "-Wno-sign-compare",
            "-fno-asynchronous-unwind-tables",
            "-fno-delete-null-pointer-checks",
            "-O2",
            "-fstack-protector-strong",
            "-fomit-frame-pointer",
            "-ftrivial-auto-var-init=zero",
            "-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang",
            "-fno-stack-clash-protection",
            "-falign-functions=16",
            "-fno-strict-overflow",
            "-fno-stack-check",
            "-Wall",
            "-Wundef",
            "-Werror=implicit-function-declaration",
            "-Werror=implicit-int",
            "-Werror=return-type",
            "-Werror=strict-prototypes",
            "-Wno-format-security",
            "-Wno-trigraphs",
            "-Wno-frame-address",
            "-Wno-address-of-packed-member",
            "-Wframe-larger-than=2048",
            "-Wno-gnu",
            "-Wno-unused-but-set-variable",
            "-Wno-unused-const-variable",
            "-Wvla",
            "-Wno-pointer-sign",
            "-Wcast-function-type",
            "-Wimplicit-fallthrough",
            "-Werror=date-time",
            "-Werror=incompatible-pointer-types",
            "-Wenum-conversion",
            "-Wno-unused-but-set-variable",
            "-Wno-unused-const-variable",
            "-Wno-format",
            "-Wformat-extra-args",
            "-Wformat-invalid-specifier",
            "-Wformat-zero-length",
            "-Wnonnull",
            "-Wformat-insufficient-args",
            "-Wno-pointer-to-enum-cast",
            "-Wno-tautological-constant-out-of-range-compare",
            "-Wno-unaligned-access",
            "-Wno-missing-field-initializers",
            "-Wno-type-limits",
            "-Wno-shift-negative-value",
            "-Wno-initializer-overrides",
            "-Wno-sign-compare",
            "-g",
            "-gdwarf-4",
            "-fsanitize=kernel-address",
            "-mllvm",
            "-asan-mapping-offset=0xdffffc0000000000",
            "-mllvm",
            "-asan-globals=1",
            "-mllvm",
            "-asan-instrumentation-with-call-threshold=10000",
            "-mllvm",
            "-asan-stack=1",
            "-fsanitize=array-bounds",
            "-fsanitize=shift",
            "-fsanitize-coverage=trace-pc",
            "-fsanitize-coverage=trace-cmp",
            "-DKBUILD_MODFILE=\"fs/afs/kafs\"",
            "-DKBUILD_BASENAME=\"main\"",
            "-DKBUILD_MODNAME=\"kafs\"",
            "-D__KBUILD_MODNAME=kmod_kafs",
            "-o",
            "fs/afs/main.o",
            "fs/afs/main.c"
        ],
        "directory": "/home/li/labdir/linux-6.7",
        "file": "fs/afs/main.c"
    },

@Lelouny
Copy link

Lelouny commented Mar 1, 2025

i followed this solution
and now i got a new error when i run python process_output.py --linux-path /path/to/linux --usage:

Traceback (most recent call last):
  File "process_output.py", line 227, in <module>
    process_usage()
  File "process_output.py", line 201, in process_usage
    for line in file_path.read_text().splitlines():
  File "/usr/lib/python3.8/pathlib.py", line 1236, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/usr/lib/python3.8/pathlib.py", line 1222, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/usr/lib/python3.8/pathlib.py", line 1078, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/li/labdir/linux-6.7/usage.jsonl'

what is usage1.jsonl? how did i miss it?

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

No branches or pull requests

3 participants