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

compilation database not generated for OpenWRT #69

Open
maindoor opened this issue Feb 25, 2019 · 5 comments
Open

compilation database not generated for OpenWRT #69

maindoor opened this issue Feb 25, 2019 · 5 comments
Labels

Comments

@maindoor
Copy link

Hi,
I tried to build a using a cross compilation toolchain using make and used compiledb to generate
compilation database, but it kind of hung after the compilation was done for about 10mins. So I Ctrl-C'd
it and got out. I didn't find any json files in my build dir. What do you think could have wrong ? Here is the last output:
make[1]: Leaving directory '/home/sk/openwrt_trunk/attitude-adjustment-38900'
()

Processing build commands from

^Cmake[14748]: *** wait: No child processes. Stop.
make[14748]: *** Waiting for unfinished jobs....
make[14748]: *** wait: No child processes. Stop.
make[14747]: *** wait: No child processes. Stop.
make[14747]: *** Waiting for unfinished jobs....
make[14747]: *** wait: No child processes. Stop.
make[14746]: *** wait: No child processes. Stop.
make[14746]: *** Waiting for unfinished jobs....
make[14746]: *** wait: No child processes. Stop.
make[14745]: *** wait: No child processes. Stop.
make[14745]: *** Waiting for unfinished jobs....
make[14745]: *** wait: No child processes. Stop.
make[14744]: *** wait: No child processes. Stop.
make[14744]: *** Waiting for unfinished jobs....
make[14744]: *** wait: No child processes. Stop.
make[14743]: *** wait: No child processes. Stop.
make[14743]: *** Waiting for unfinished jobs....
make[14743]: *** wait: No child processes. Stop.
make[14742]: *** [/home/sk/openwrt_trunk871/attitude-adjustment-38900/include/verbose.mk] Interrupt
make[14741]: *** [/home/sk/openwrt_trunk871/attitude-adjustment-38900/include/verbose.mk] Interrupt
make[14740]: *** [/home/sk/openwrt_trunk871/attitude-adjustment-38900/include/verbose.mk] Interrupt
make[14739]: *** [/home/sk/openwrt_trunk871/attitude-adjustment-38900/include/verbose.mk] Interr

@nickdiego nickdiego added the bug label Feb 26, 2019
@nickdiego nickdiego added this to the 0.10.0 milestone Feb 26, 2019
@nickdiego
Copy link
Owner

nickdiego commented Feb 26, 2019

Thanks for reporting this.

What exact command are you running?

Essentially to be able to parse the build commands compiledb needs the build log. From the logs you've posted, it seems like openwrt uses recursive makefiles (didn't build it before, so not sure), if that's the case I would recommend you to try to do the process in 2 steps:

  1. Get/store the build log in some file, for example, to build CUPS package [1]:
make -Bkw V=s package/cups/compile | tee build.log

Or even better, if the build system properly supports --dry-run/-n option:

make -Bkw --dry-run V=s package/cups/compile | tee build.log

PS: Check if the build.log file contains build commands (e.g: gcc -c .... -o ...)

  1. Generate json compilation database using the build log as input:
compiledb --parse build.log

[1] https://oldwiki.archive.openwrt.org/doc/howto/build#building_single_packages

@maindoor
Copy link
Author

maindoor commented Apr 9, 2019

I'm sorry, I had moved on to another project. I will get back to this within the next month or so. We'll get this sorted. Thank you for such a great tool and support.

@nickdiego nickdiego removed this from the 0.10.0 milestone May 29, 2019
@Alchiadus
Copy link

Unfortunately the suggestion did not work for me. I built OpenWRT successfully and tried to generate the compile commands from the build.log (as can be expected this is a large file, about 16MB) as follows:

$ make -j $(nproc) V=s | tee build.log
...
$ compiledb --parse build.log
Traceback (most recent call last):
  File "/home/ixon/.local/bin/compiledb", line 10, in <module>
    sys.exit(cli())
  File "/home/ixon/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/ixon/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/ixon/.local/lib/python2.7/site-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/home/ixon/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ixon/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/ixon/.local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ixon/.local/lib/python2.7/site-packages/compiledb/cli.py", line 92, in cli
    use_full_path, command_style)
  File "/home/ixon/.local/lib/python2.7/site-packages/compiledb/__init__.py", line 106, in generate
    command_style=command_style)
  File "/home/ixon/.local/lib/python2.7/site-packages/compiledb/__init__.py", line 54, in generate_json_compdb
    use_full_path=use_full_path, command_style=command_style)
  File "/home/ixon/.local/lib/python2.7/site-packages/compiledb/parser.py", line 103, in parse_build_log
    working_dir = dir_stack[-1]
IndexError: list index out of range

@nickdiego
Copy link
Owner

nickdiego commented Aug 2, 2019

It seems to be a problem with enter/leave directory parsing.

$ make -j $(nproc) V=s | tee build.log

You should have added -w as I recommended above. (atm we don't have an option to ignore enter/leave dir messages).

Anyway, could you upload your build log file somewhere so that we can debug the issue?

Thanks.

@Alchiadus
Copy link

Unfortunately I did not keep the build log and my attempts to reproduce the crash have not been successful.

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

No branches or pull requests

3 participants