niosus / EasyClangComplete

:boom: Robust C/C++ code completion for Sublime Text 3/4

Home Page:https://niosus.github.io/EasyClangComplete/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cross platform bazel workspaces cause generate.sh to fail.

chetgnegy opened this issue · comments

System info:

Ubuntu 16.04

  • Sublime Text version: Build 3126
    other stuff probably not relevant, this is clearly a bazel+ecc problem. I'm running bazel 1.0.0 at the moment and I just downloaded ecc today.

What happens:

When I try to generate compile_commands.json, it silently fails (which is less silent once I realize sublime has a console I never use, haha). The error message is kinda useless, it just says generate.sh can't find "a binary". See LOG 1

So then I go run generate.sh, which gives much clearer error messages. SEE LOG 2. Now it's very clear that the script is just trying to build all targets and it doesn't like some Objective C (objc_library) targets that would build if I were on OSX (I have a cross-platform OSX/Linux codebase). Bazel support for OSX/Windows is much younger and less common, so I'm not surprised if that hasn't come up yet. Once I delete all those targets out of my Bazel BUILD files and run generate.sh again, everything is fine. I go back into sublime and generate compile_commands.json and everything works. As long as I don't have to run that command things should be fine for me.

I'm not sure whose responsibility it is to decide whether bazel builds these targets or not. It's possible I could configure this in bazel, I guess.

LOG 1
[ECC:DEBUG]:[EasyClangComplete.py]:[run]:[MainThread]: Starting generating compilation database.
[ECC:DEBUG]:[file.py]:[search]:[Thread-4]: Searching 'WORKSPACE' file in: SearchScope: from_folder: /home/chetgnegy/Neptune/Source, to_folder: /
[ECC:DEBUG]:[file.py]:[search]:[Thread-4]: Found 'WORKSPACE' file: /home/chetgnegy/Neptune/Source/WORKSPACE
[ECC:DEBUG]:[file.py]:[search]:[Thread-4]: Nothing to search for in file so its ok.
[ECC:DEBUG]:[subl_bridge.py]:[get_view_lang]:[Dummy-6]: ECC does nothing for language syntax: 'Plain text'
[ECC:DEBUG]:[tools.py]:[run_command]:[Thread-4]: Executable file not found executing: ['/home/chetgnegy/.config/sublime-text-3/Packages/EasyClangComplete/external/bazel-compilation-database/generate.sh']
[ECC:DEBUG]:[bazel.py]:[compdb_generated]:[Thread-4]: Database generated. Output:
None
ERROR:concurrent.futures:exception calling callback for <Future at 0x7f897dd5f290 state=finished returned NoneType>
Traceback (most recent call last):
File "./python3.3/concurrent/futures/_base.py", line 296, in _invoke_callbacks
File "/home/chetgnegy/.config/sublime-text-3/Packages/EasyClangComplete/plugin/flags_sources/bazel.py", line 37, in compdb_generated
output_text = future.result()
TypeError: argument of type 'NoneType' is not iterable
[ECC:DEBUG]:[subl_bridge.py]:[is_valid_view]:[Dummy-6]: view file_name is None

LOG 2
ERROR: /home/chetgnegy/.cache/bazel/_bazel_chetgnegy/703b9800778fef35edeb624f262556cf/external/local_config_cc/BUILD:47:1: in cc_toolchain_suite rule @local_config_cc//:toolchain: cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'darwin_x86_64'
ERROR: Analysis of target '//ThirdParty/Juce:JuceForBinaryBuilder_osx_objc' failed; build aborted: Analysis of target '@local_config_cc//:toolchain' failed; build aborted
INFO: Elapsed time: 0.188s
`

Thanks for reporting this. I'm not sure how much I can do about this as I just call the script from here without much modification.

If you're able to pass along the logs for generate.sh, that would be good enough, in my opinion. It probably doesn't make sense for you to take on all the things that could be complex about someone's build environment, but the fix is straightforward (and can be achieved without editing your code) once one knows what the problem is.

Hmm, I though I already pass the logs. Will check that.

I got the error "TypeError: argument of type 'NoneType' is not iterable" which doesn't indicate the problem at all.

By the way, sorry my pasted log format is such a disaster. Let me take a take a stab at cleaning that up.

(for whatever reason the

and tags strips out newlines. yikes.)

I'm gonna stop touching stuff now.

Is this still relevant?

@chetgnegy my main issue is still that I don't fully understand the problem. Is the issue in having the bazel set up to build some binaries for other platforms and these error when we try to generate the compilation database from within ECC?

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Just comment here to prevent this from happening.

commented

The issue has been automatically closed due to lack of activity. Feel free to reopen the issue if it is still relevant.