-
Notifications
You must be signed in to change notification settings - Fork 312
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
CLion Fails to Debug cc_binary
target on macOS
#494
Comments
FYI: The above-described problem is still observed when the environment variable |
cc_binary
targetcc_binary
target on macOS
I am encountering the same issue with the latest versions of CLion and the Bazel plugin: CLion version: CLion 2018.3.4 |
I have the same problem. Bazel run is successful, but Debug fails. When I use the gdb which version is 7.11.1, I get an exit code 126. |
I got a solution for my situation.
|
Also encountering this issue, same symptoms. CLion version: 2018.3.4 The suggestion above to |
I am having the same issue. Is there a workaround, or work in progress to solve this issue? |
The solution from #494 (comment) still works, you have to chmod the correct gdbserver.
if you're using CLion 2018.3.
if you're using CLion 2019.1. |
If you download the plugin zip directly from here, and unzip into your plugins directory, it should also work. For some reason when you install it via the IDE marketplace it doesn't preserve the permissions. |
CLion removes the executable permission on the gdbserver script if the plugin is installed through the marketplace. Don't need to worry about the executable bit if we always run directly under bash. PiperOrigin-RevId: 250287356
@chaoren This issue is specifically for macOS. I think your solution applies only for Linux. On macOS the folders you are describing do not exist. The corresponding folder on macOS appears to be |
Yes, sorry, I only saw the last few comments on the issue. On mac we shouldn't be using the script at all. |
@chaoren do you have an idea of what needs to be done ? |
I'm hoping this would fix the issue, but since I don't have access to a mac at the moment, could I ask one of you people to build and test that patch to see if it works first? |
I'll take a shot, thank you! |
@chaoren Happy to report that it's working! Attaching the build from the PR for other to use until it's released. |
Excellent. I will merge the patch shortly. |
That said, debugging itself doesn't work because of bazelbuild/bazel#6327 |
Why was this closed? As @steeve said, debugging in CLion on macOS still doesn't work. |
The issue with the bazel plugin has been fixed. The other issue is in bazel, you should follow that other bug. There's nothing actionable on this bug anymore. |
PiperOrigin-RevId: 251515404
PiperOrigin-RevId: 251515404
Would this be fixed if we launched |
I think there's still another issue with the plugin on macOS (separate from the red popup error which seems to have been fixed, and separate from bazel issue bazelbuild/bazel#6327). There's a workaround discussed in bazelbuild/bazel#6327: adding I'm using plugin version 2019.11.14.0.1 and I also tried the patched version in #494 (comment) above (same behavior). CLion does seem to be using LLDB because the Debug tool window includes a functioning LLDB shell. |
Please can we reopen this issue? It is definitely still broken. @chaoren |
At least for Mac it is is still broken. |
I have a workaround which may be useful for others.
|
@wesleyw72 , thank you very much. Another tip is that .lldbinit can be done in a project level as explained here |
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so. |
The Problem
I've written a hello world
cc_binary
target, but my attempts to debug it from within CLion fail.I've created a repository, dwtj/clwb-bugs-example, to demonstrate the problem. It includes analogous CMake and Bazel builds of this program.
When I use CLion+CMake, I can debug
hello_world
just fine, but when I try to debug it with CLion+Bazel, I get a red popup error. The image below shows these two projects side-by-side:The red popup error says:
Here, "Configure" is a link to CLion's "Preferences" > "Build, Execution, Deployment" > "Toolchains". Here's what that looks like for me:
There are three choices in the "Debugger" drop-down menu:
Note that there doesn't seem to be a "Custom LLDB" option. For varying reasons, all of these options fail in my CLion+Bazel project.
Bundled LLDB
As described above, "Bundled LLDB" seems to work fine in CLion+CMake, but it fails with the red popup error in CLion+Bazel.
Bundled GDB
When I chose this option, I get "a file format not recognized error." This happens for both CLion+CMake and CLion+Bazel.
I guess this makes sense, since my Clang/LLVM toolchain is building the program in either case, and evidently GDB won't work on a Clang-built executable. Here's the image:
Custom GDB Executable:
I don't have GCC/GDB installed on my system, so I don't have a "Custom GDB Executable" to select.
However, if I try to use
/usr/bin/lldb
as a Custom GDB Executable, I get an error:lldb: unrecognized option '-interpreter=mi2'
. As you might expect, this happens for both CLion+CMake and CLion+Bazel. Here's the image:My Testing Environment
be compatible with the latest versions of the plugin.)
https://github.com/bazelbuild/intellij
:0f45ef4
(built from source)Questions
cc_binary
target, and acc_library
target to use another toolchain?lldb
on my hello_world project, I see the same kind of thing in that issue. Might switching to a GCC/GDB toolchain at least let me use CLIgdb
on my Bazelcc_binary
targets?The text was updated successfully, but these errors were encountered: