Giter VIP home page Giter VIP logo

bazel-stack-vscode-cc's People

Contributors

pcj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bazel-stack-vscode-cc's Issues

Generation fails for "target_compatible_with" targets

When attempting to build a compilation database for a target with "target_compatible_with" set to something other than the host platform, the plugin fails to generate a compilation database. Example output:

Example cc_binary:

cc_binary(
    name = "native",
    srcs = ["test.c"],
    linkshared = True,
    deps = ["//third_party/wpilib:hal-athena", ":example-jni-athena"],
    target_compatible_with = ["@platforms//cpu:arm"]
)

Error output:

ERROR: /home/cameronearle/frc6328/AdvantageKit/example_java_project/BUILD:33:10: in @bazel_vscode_compdb//:aspects.bzl%compilation_database_aspect aspect on cc_binary rule //example_java_project:native: 
Traceback (most recent call last):
        File "/home/cameronearle/.cache/bazel/_bazel_cameronearle/df2869d739dc2caa4da3626bfdc238b8/external/bazel_vscode_compdb/aspects.bzl", line 312, column 48, in _compilation_database_aspect_impl
                compile_commands = _cc_compile_commands(ctx, target, feature_configuration, cc_toolchain)
        File "/home/cameronearle/.cache/bazel/_bazel_cameronearle/df2869d739dc2caa4da3626bfdc238b8/external/bazel_vscode_compdb/aspects.bzl", line 138, column 39, in _cc_compile_commands
                compile_flags = _get_compile_flags(target)
        File "/home/cameronearle/.cache/bazel/_bazel_cameronearle/df2869d739dc2caa4da3626bfdc238b8/external/bazel_vscode_compdb/aspects.bzl", line 87, column 30, in _get_compile_flags
                compilation_context = dep[CcInfo].compilation_context
Error: <target //example_java_project:native> (rule 'cc_binary') doesn't contain declared provider 'CcInfo'
ERROR: Analysis of aspect '@bazel_vscode_compdb//:aspects.bzl%compilation_database_aspect of //example_java_project:native' failed; build aborted: Analysis of target '//example_java_project:native' failed
INFO: Elapsed time: 0.133s
INFO: 0 processes.
INFO: Build Event Protocol files produced successfully.
The terminal process "bash '-c', 'bazel build --override_repository=bazel_vscode_compdb=/home/cameronearle/.vscode-server/extensions/stackbuild.bazel-stack-vscode-cc-1.1.2/compdb/ --aspects=@bazel_vscode_compdb//:aspects.bzl%compilation_database_aspect --color=no --noshow_progress --noshow_loading_progress --output_groups=compdb_files,header_files --build_event_json_file=/tmp/tmp-197-FEInLrkbeQyu //example_java_project:native && /home/cameronearle/.vscode-server/extensions/stackbuild.bazel-stack-vscode-cc-1.1.2/compdb/postprocess.py -b /tmp/tmp-197-FEInLrkbeQyu && rm /tmp/tmp-197-FEInLrkbeQyu'" failed to launch (exit code: 1).

In my example the host is a 64 bit Ubuntu system, but I've been able to reproduce this on macOS as well. In both cases an appropriate toolchain was registered in the WORKSPACE file to build for the platform.

This was also a problem with the older bazel-compdb project that this plugin is based on, so I don't know how involved the fix would be.

Generate Comp Database OOM crash with large repositories

The generate comp database python script fails due to appending all of the compile command json files at the same time. This problem could be handled in a better way where all of the compile commands arent stored in heap at the same time.

Generation fails for more than one target

Our current configuration for github.com/magma/magma is like this with 1 binary target.

		"bsv.bazel.buildFlags": [
		],
		"bsv.bazel.testFlags": [
		],
		"bsv.bes.enabled": false,
		"bsv.bzl.codesearch.enabled": false,
		"bsv.bzl.invocation.buildEventPublishAllActions": false,
		"bsv.bzl.invocation.enabled": false,
		"bsv.bzl.invocation.invokeWithBuildEventStreaming": false,
		"bsv.bzl.lsp.enableCodelensStarlarkDebug": false,
		"bsv.bzl.lsp.enableCodelensRun": false,
		"bsv.bzl.remoteCache.enabled": false,
		"bsv.bzl.starlarkDebugger.enabled": false,
		// Update this field with any new targets that need compilation database generation
		"bsv.cc.compdb.targets": [
			"//lte/gateway/c/session_manager:sessiond",
		]

This works great as expected, but if I add another binary, I end up with an empty compile_commands.json, with not too much error to go off of.

This is the modified config that fails:

		"bsv.cc.compdb.targets": [
			"//lte/gateway/c/session_manager:sessiond",
                        "//lte/gateway/c/connection_tracker/src:main",
		]

gist of output I see: https://gist.github.com/themarwhal/b27527151f7a6732f91eb1cd3ebe9ad1

Not sure if there could be an error message somewhere else though.

Thanks!

Extension doesn't work in Windows

Extension running on Windows depends on the default terminal setting (and doesn't work in any of them).

If my terminal shell is set to bash, then the following happens:

bash: c:Usersaml.vscodeextensionsstackbuild.bazel-stack-vscode-cc-1.2.0compdbpostprocess.py: command not found

 *  The terminal process "C:\Program Files\Git\bin\bash.exe '--login', '-i', '-c', 'bazelisk build --override_repository=bazel_vscode_compdb=c:\Users\aml\.vscode\extensions\stackbuild.bazel-stack-vscode-cc-1.2.0\compdb\ --aspects=@bazel_vscode_compdb//:aspects.bzl%compilation_database_aspect --color=no --show_result=2147483647 --noshow_progress --noshow_loading_progress --output_groups=compdb_files,header_files --build_event_json_file=C:\Users\aml\AppData\Local\Temp\tmp-14324-bNEOqVPkTvzR //... && c:\Users\aml\.vscode\extensions\stackbuild.bazel-stack-vscode-cc-1.2.0\compdb\postprocess.py -b C:\Users\aml\AppData\Local\Temp\tmp-14324-bNEOqVPkTvzR && rm C:\Users\aml\AppData\Local\Temp\tmp-14324-bNEOqVPkTvzR'" terminated with exit code: 127. 

Backslashes are passed without escaping to bash.

If I set it to Powershell, then the command is not modified and still uses bash-specific &&:

Executing task: bazelisk build --override_repository=bazel_vscode_compdb=c:\Users\aml\.vscode\extensions\stackbuild.bazel-stack-vscode-cc-1.2.0\compdb\ --aspects=@bazel_vscode_compdb//:aspects.bzl%compilation_database_aspect --color=no --show_result=2147483647 --noshow_progress --noshow_loading_progress --output_groups=compdb_files,header_files --build_event_json_file=C:\Users\aml\AppData\Local\Temp\tmp-14324-bbRS9Waq8J10 //... && c:\Users\aml\.vscode\extensions\stackbuild.bazel-stack-vscode-cc-1.2.0\compdb\postprocess.py -b C:\Users\aml\AppData\Local\Temp\tmp-14324-bbRS9Waq8J10 && rm C:\Users\aml\AppData\Local\Temp\tmp-14324-bbRS9Waq8J10 

At line:1 char:417
+ ... \Users\aml\AppData\Local\Temp\tmp-14324-bbRS9Waq8J10 //... && c:\User ...      
+                                                                ~~
The token '&&' is not a valid statement separator in this version.
At line:1 char:571
+ ...  -b C:\Users\aml\AppData\Local\Temp\tmp-14324-bbRS9Waq8J10 && rm C:\U ...      
+                                                                ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine
 

 *  The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command bazelisk build --override_repository=bazel_vscode_compdb=c:\Users\aml\.vscode\extensions\stackbuild.bazel-stack-vscode-cc-1.2.0\compdb\ --aspects=@bazel_vscode_compdb//:aspects.bzl%compilation_database_aspect --color=no --show_result=2147483647 --noshow_progress --noshow_loading_progress --output_groups=compdb_files,header_files --build_event_json_file=C:\Users\aml\AppData\Local\Temp\tmp-14324-bbRS9Waq8J10 //... && c:\Users\aml\.vscode\extensions\stackbuild.bazel-stack-vscode-cc-1.2.0\compdb\postprocess.py -b C:\Users\aml\AppData\Local\Temp\tmp-14324-bbRS9Waq8J10 && rm C:\Users\aml\AppData\Local\Temp\tmp-14324-bbRS9Waq8J10" terminated with exit code: 1. 

Bazel/C++: Generate Compilation Database fails

Bazel/C++: Generate Compilation Database fails with the error:

INFO: Invocation ID: 58786031-b770-44b5-a91f-342266d84192
ERROR: /bazel/cache/my_project/25a3c77a065e294bcbb59ec17782c259/external/bazel_vscode_compdb/aspects.bzl:329:19: name 'json' is not defined
ERROR: Extension 'aspects.bzl' has errors
ERROR: Analysis of aspect '@bazel_vscode_compdb//:aspects.bzl%compilation_database_aspect of //path_to_my_target' failed; build aborted: Extension 'aspects.bzl' has errors
INFO: Elapsed time: 0.203s
INFO: 0 processes.
INFO: Build Event Protocol files produced successfully.
The terminal process "bash '-c', 'bazel build --override_repository=bazel_vscode_compdb=/home/oper/.vscode-server/extensions/stackbuild.bazel-stack-vscode-cc-1.1.2/compdb/ --aspects=@bazel_vscode_compdb//:aspects.bzl%compilation_database_aspect --color=no --noshow_progress --noshow_loading_progress --output_groups=compdb_files,header_files --build_event_json_file=/tmp/tmp-5392-5LoJNl1KOOTa --config=local //path_to_my_target && /home/oper/.vscode-server/extensions/stackbuild.bazel-stack-vscode-cc-1.1.2/compdb/postprocess.py -b /tmp/tmp-5392-5LoJNl1KOOTa && rm /tmp/tmp-5392-5LoJNl1KOOTa'" terminated with exit code: 1.

What am I doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.