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

Bazel cross-compiled project breaks CLion source code comprehension #7164

Open
jonathanfisher opened this issue Dec 11, 2024 · 0 comments
Open
Assignees
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: CLion CLion plugin type: bug

Comments

@jonathanfisher
Copy link

jonathanfisher commented Dec 11, 2024

Description of the bug:

I have an embedded project, cross compiled (host: Windows 11, target: armv8-m (STM32U575)) using Bazel platforms.

However, when I load the project in CLion, I am unable to do the following:

  1. Reformat code (Ctrl + Alt + L)
  2. Go-to-definition (Ctrl + B) of symbol (function, variable, header)
  3. Fold / unfold C/C++ code
  4. Matching curly brace highlighting

Which category does this issue belong to?

CLion

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Here's a small project I created to try to reproduce this:

MinimalProject.zip

The project builds just fine for me when I build manually using this: bazel build --platforms //platform:u575 //:hello-world.elf. Note: it also builds just fine in CLion. However, I am unable to do the above-mentioned things in C source files (reformat, "go to definition", highlight matching curly braces, fold code).

Example of "Go to definition of mylib_hello":
image

Which Intellij IDE are you using? Please provide the specific version.

CLion 2024.3.1

What programming languages and tools are you using? Please provide specific versions.

C, C++, Bazel 7.4.1

What Bazel plugin version are you using?

2024.11.19.0.3-api-version-243

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

Running an incremental sync produces this output:

Updating VCS...
Running Bazel info...
Command: bazel info --tool_tag=ijwb:CLion --curses=no --color=yes --progress_in_terminal_title=no --override_repository=intellij_aspect=C:\Users\jonat\AppData\Roaming\JetBrains\CLion2024.3\plugins\clwb\aspect --override_repository=intellij_aspect_template=D:\code\c-test\.clwb\.idea\aspect --define=_cpp_use_get_tool_for_action=true bazel-bin bazel-genfiles bazel-testlogs execution_root package_path output_path output_base release starlark-semantics java-home --
Resolving module repository mapping...
Computing VCS working set...
Syncing project: Initial directory update (no_build)...
Updating VCS...
Running Bazel info...
Resolving module repository mapping...
Computing VCS working set...
Running Bazel info...
Building 0 Bazel targets...
Build invocation result: success
Parsing build outputs...
Total rules: 5, new/changed: 0, removed: 0
Reading IDE info result...
Reading IDE info result...
Updating target map...
Loaded 0 aspect files, total size 0kB
Target map size: 5
Prefetching output artifacts...
Prefetching files...
Refreshing files...
Computing directory structure...
Initializing project SDKs...
Committing project structure...
Workspace has 0 libraries
Workspace has 2 modules
Sync finished
Syncing project: Sync (incremental)...
Updating VCS...
Running Bazel info...
Command: bazel info --tool_tag=ijwb:CLion --curses=no --color=yes --progress_in_terminal_title=no --override_repository=intellij_aspect=C:\Users\jonat\AppData\Roaming\JetBrains\CLion2024.3\plugins\clwb\aspect --override_repository=intellij_aspect_template=D:\code\c-test\.clwb\.idea\aspect --define=_cpp_use_get_tool_for_action=true bazel-bin bazel-genfiles bazel-testlogs execution_root package_path output_path output_base release starlark-semantics java-home --
Resolving module repository mapping...
Computing VCS working set...
Querying targets in project directories...
Command: bazel query --tool_tag=ijwb:CLion --output=label_kind --keep_going "attr('tags', '^((?!manual).)*$', //...:all - //bazel-bin/...:all - //bazel-out/...:all - //bazel-testlogs/...:all - //bazel-c-test/...:all - //.clwb/...:all)" --
 no actions running
Loading: 0 packages loaded
ERROR: Skipping '//bazel-bin/...:all': no targets found beneath 'bazel-bin'
ERROR: Skipping '//bazel-out/...:all': no targets found beneath 'bazel-out'
ERROR: Skipping '//bazel-testlogs/...:all': no targets found beneath 'bazel-testlogs'
ERROR: Skipping '//bazel-c-test/...:all': no targets found beneath 'bazel-c-test'
WARNING: --keep_going specified, ignoring errors. Results may be inaccurate
13 targets found under project directories; syncing 7 of them
Sync targets from project view directories:
  //my_lib:my_lib
  //:hello-world.elf
  //toolchain:cc_toolchain_u575_toolchain_arm_none_eabi_darwin_arm64
  //toolchain:cc_toolchain_u575_toolchain_arm_none_eabi_darwin_x86_64
  //toolchain:cc_toolchain_u575_toolchain_arm_none_eabi_linux_aarch64
  //toolchain:cc_toolchain_u575_toolchain_arm_none_eabi_linux_x86_64
  //toolchain:cc_toolchain_u575_toolchain_arm_none_eabi_windows_x86_64

Running Bazel info...
Building 7 Bazel targets...
bazel build --tool_tag=ijwb:CLion --target_pattern_file D:\code\c-test\.clwb\targets\targets-2196100444718833699 --keep_going --curses=no --color=yes --progress_in_terminal_title=no --override_repository=intellij_aspect=C:\Users\jonat\AppData\Roaming\JetBrains\CLion2024.3\plugins\clwb\aspect --override_repository=intellij_aspect_template=D:\code\c-test\.clwb\.idea\aspect --define=_cpp_use_get_tool_for_action=true --noexperimental_run_validations --aspects=@@intellij_aspect//:intellij_info_bundled.bzl%intellij_info_aspect --output_groups=intellij-resolve-cpp,intellij-info-cpp,intellij-info-generic --build_event_binary_file=C:\Users\jonat\AppData\Local\Temp\intellij-bep-f33ee3da-12ff-4427-961b-96a302187ea4 --nobuild_event_binary_file_path_conversion --build_event_publish_all_actions --
Computing main repo mapping:
Loading:
Loading: 0 packages loaded
Analyzing: 7 targets (0 packages loaded, 0 targets configured)
Analyzing: 7 targets (0 packages loaded, 0 targets configured)

WARNING: errors encountered while analyzing target '//my_lib:my_lib', it will not be built.
Target //my_lib:my_lib is incompatible and cannot be built, but was explicitly requested.
Dependency chain:
    //my_lib:my_lib (7365c7)   <-- target platform (@@platforms//host:host) didn't satisfy constraints [@@platforms//cpu:armv8-m, @@platforms//os:none]
INFO: Analyzed 7 targets (5 packages loaded, 28 targets configured).
WARNING: errors encountered while analyzing target '//:hello-world.elf', it will not be built.
Target //:hello-world.elf is incompatible and cannot be built, but was explicitly requested.
Dependency chain:
    //:hello-world.elf (7365c7)   <-- target platform (@@platforms//host:host) didn't satisfy constraints [@@platforms//cpu:armv8-m, @@platforms//os:none]
INFO: Analysis succeeded for only 5 of 7 top-level targets
INFO: Found 7 targets...
Use --verbose_failures to see the command lines of failed build steps.
ERROR: command succeeded, but not all targets were analyzed
INFO: Elapsed time: 0.461s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
FAILED:
INFO: Build Event Protocol files produced successfully.

Build invocation result: build_error
Parsing build outputs...
Total rules: 5, new/changed: 0, removed: 0
Reading IDE info result...
Reading IDE info result...
Updating target map...
Loaded 0 aspect files, total size 0kB
Target map size: 5
Prefetching output artifacts...
Prefetching files...
Refreshing files...
Computing directory structure...
Initializing project SDKs...
Committing project structure...
Workspace has 0 libraries
Workspace has 2 modules
Updating in-memory state...
0 unique C configurations, 0 C targets
Sync finished
@jonathanfisher jonathanfisher added awaiting-maintainer Awaiting review from Bazel team on issues type: bug labels Dec 11, 2024
@github-actions github-actions bot added product: CLion CLion plugin labels Dec 11, 2024
@jonathanfisher jonathanfisher changed the title Bazel project with transitions breaks CLion source code comprehension Bazel cross-compiled project breaks CLion source code comprehension Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: CLion CLion plugin type: bug
Projects
Status: Untriaged
Development

No branches or pull requests

3 participants