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

compiledb not working with linux kernel #85

Open
seujza opened this issue Sep 20, 2019 · 6 comments
Open

compiledb not working with linux kernel #85

seujza opened this issue Sep 20, 2019 · 6 comments

Comments

@seujza
Copy link

seujza commented Sep 20, 2019

Hi,
when I exec compiledb -n make in Linux kernel source code,It's not working
there is the log
Thanks!

/usr1/jza/linux-5.2.15$ compiledb -n make
Traceback (most recent call last):
  File "/home/jza/.local/bin/compiledb", line 11, in <module>
    sys.exit(cli())
  File "/home/jza/.local/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/jza/.local/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/jza/.local/lib/python3.5/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/jza/.local/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/jza/.local/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/jza/.local/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/jza/.local/lib/python3.5/site-packages/compiledb/commands/make.py", line 98, in command
    done = generate(**args)
  File "/home/jza/.local/lib/python3.5/site-packages/compiledb/__init__.py", line 106, in generate
    command_style=command_style)
  File "/home/jza/.local/lib/python3.5/site-packages/compiledb/__init__.py", line 54, in generate_json_compdb
    use_full_path=use_full_path, command_style=command_style)
  File "/home/jza/.local/lib/python3.5/site-packages/compiledb/parser.py", line 89, in parse_build_log
    while (line.endswith('\\\n')):
TypeError: endswith first arg must be bytes or a tuple of bytes, not str
jza@dyjza00001:/usr1/jza/linux-5.2.15$ ***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***

@Petross404
Copy link

What happens if you run make menuconfig first?

@kloenk
Copy link

kloenk commented Nov 17, 2020

Also fails with compiledb -n make O=build after running `make O=build defconfig

@artisdom
Copy link

Linux kernel comes with "scripts/clang-tools/gen_compile_commands.py" that can generate "compile_commands.json" by parsing ".cmd" files.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b30204640192234d18f9168f19f9cd693485b86d

@rcorre
Copy link

rcorre commented Apr 25, 2024

I've had success with gen_compile_commands.py. However, it requires you to run a full build first, which takes a while. I was hoping compiledb -n could make this faster, but I get this, even though I have generated a config and running make LLVM=1 -k itself works fine:

$ compiledb -n make LLVM=1
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[1]: *** [/home/rrc/src/linux/Makefile:776: .config] Error 1
make[1]: Failed to remake makefile 'include/config/auto.conf.cmd'.
make[1]: Failed to remake makefile 'include/config/auto.conf'.
make: *** [Makefile:240: __sub-make] Error 2

@rcorre
Copy link

rcorre commented Apr 25, 2024

The issue seems to be the -B flag. It seems like compiledb tries to work around this, but the workaround isn't working for the linux kernel: https://github.com/nickdiego/compiledb/blob/master/compiledb/commands/make.py#L13

@CS-liujf
Copy link

CS-liujf commented May 25, 2024

I've had success with gen_compile_commands.py. However, it requires you to run a full build first, which takes a while. I was hoping compiledb -n could make this faster, but I get this, even though I have generated a config and running make LLVM=1 -k itself works fine:

$ compiledb -n make LLVM=1
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[1]: *** [/home/rrc/src/linux/Makefile:776: .config] Error 1
make[1]: Failed to remake makefile 'include/config/auto.conf.cmd'.
make[1]: Failed to remake makefile 'include/config/auto.conf'.
make: *** [Makefile:240: __sub-make] Error 2

I encounter the same problem with compiledb -n make bzImage

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

6 participants