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

[bug] export compile commands pop up not working #40

Closed
jdekarske opened this issue Nov 20, 2021 · 11 comments
Closed

[bug] export compile commands pop up not working #40

jdekarske opened this issue Nov 20, 2021 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@jdekarske
Copy link

Hi! Great tool!
Instead of requiring a workspace to have a .catkin_tools directory, can you add an optional setting to specify the one you want to use? for example:
I'd like my workspace to be ~/catkin_ws/src/pkg_a and I can set the .catkin_tools location to ${workspaceFolder}/../..

Or better yet, automatically traverse higher directories until .catkin_tools is found.

Thanks!

@betwo
Copy link
Owner

betwo commented Nov 24, 2021

Hi @jdekarske, thank you!

I'll have a look at this soon, hopefully this evening.

In the past we needed the vscode workspace to include the build directory in order to access the compile_commands.json files.
In the mean time, while working on multi-root workspaces, this could have changed.
We can then definitely allow the traversing out of the workspace.

@betwo betwo self-assigned this Nov 24, 2021
@betwo betwo added the enhancement New feature or request label Nov 24, 2021
@betwo
Copy link
Owner

betwo commented Nov 24, 2021

So, I just checked my prior presumptions by opening a package folder <root>/src/package_a.
The workspace was detected and everything seemed to work.

What kind of problems did you run into when trying this?

@jdekarske
Copy link
Author

I might be having a different issue then. Is this no longer true from the readme?

Setup / Configuration (catkin_tools)
This extension activates itself only if there is a top level .catkin_tools directory in any of your opened workspaces. In a standard catkin layout, this means that an opened workspace should look like the following:...

The setup works if my only workspace folder is ~/cakin_ws. However, I get the following error if I only have the ~/catkin_ws/src/pkg_a folder open in my workspace.

This hangs:

Loading catkin_tools workspace 'catkin_ws': Clearing caches

and (consequently?):

Could not find a catkin workspace, is your workspace still being indexed?

@betwo
Copy link
Owner

betwo commented Nov 27, 2021

You're right, we should update the readme now that the extension always activates. (Once we have solved this issue.)

The setup works if my only workspace folder is ~/cakin_ws. However, I get the following error if I only have the ~/catkin_ws/src/pkg_a folder open in my workspace.

This hangs:

Loading catkin_tools workspace 'catkin_ws': Clearing caches

and (consequently?):

Could not find a catkin workspace, is your workspace still being indexed?

Could you please check the logs to see if there are any identifiable issues?

  1. Can you see any errors in the debug console, when you enable developer tools?
  2. Does the catkin_tools output panel show anything?

Maybe we can find a way to replicate this on my setup?
Has your workspace been built already? I.e. does a .catkin_tools directory exist?

@jdekarske
Copy link
Author

jdekarske commented Nov 29, 2021

Developer tools helped! I think the issue is with the popup to add the -DCMAKE_EXPORT_COMPILE_COMMANDS=ON arg. I already have cmake args set:

[Extension Host] Additional CMake Args -DENABLE_GAZEBO=on -DBUILD_LOC_RVIZ_PLUGINS=on -DUSE_CCACHE=on -DUSE_ROS=on -DUSE_DDS=off -DUSE_DRIVERS=on -DENABLE_QP=on -DENABLE_PICOFLEXX=off -DENABLE_VIVE=on -DENABLE_VIVE_SOLVER=on -DENABLE_INTEGRATION_TESTING=off -DCMAKE_BUILD_TYPE=RelWithDebInfo

Then I clicked the popup to add the compile_commands arg, then the popup to rebuild to find the compile_commands.json. In the console I get:

Additional CMake Args:       -DENABLE_GAZEBO=on -DBUILD_LOC_RVIZ_PLUGINS=on -DUSE_CCACHE=on -DUSE_ROS=on -DUSE_DDS=off -DUSE_DRIVERS=on -DENABLE_QP=on -DENABLE_PICOFLEXX=off -DENABLE_VIVE=on -DENABLE_VIVE_SOLVER=on -DENABLE_INTEGRATION_TESTING=off -DCMAKE_BUILD_TYPE=RelWithDebInfo

I think this is the problem line, which should append the -DCMAKE_EXPORT_COMPILE_COMMANDS=ON arg.

Using catkin config --append-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON fixed the issue and everything works if done manually :)

I'm not well versed in developing extensions, but I'd be happy to test out a patch.

@jdekarske jdekarske changed the title [request] .catkin_tools directory as a setting [bug] export compile commands pop up not working Nov 29, 2021
@betwo
Copy link
Owner

betwo commented Dec 3, 2021

Ah, great catch and sorry for the delay.
I did some testing, looks like this space got lost due to auto formatting with a syntax error... Don't know why that should happen.

I'll post a pre-release soon and would be glad if you could test that!

@betwo
Copy link
Owner

betwo commented Dec 3, 2021

@jdekarske
Copy link
Author

I think we're close. After clicking the update workspace button to add the compile_commands arg I get this error:

console.ts:137 [Extension Host] rejected promise not handled within 1 second: TypeError: Cannot read property 'getRootPath' of undefined
mainThreadExtensionService.ts:63 [[object Object]]Cannot read property 'getRootPath' of undefined

In the console I have:

Additional CMake Args:       -DENABLE_GAZEBO="on -DBUILD_LOC_RVIZ_PLUGINS=on -DUSE_CCACHE=on -DUSE_ROS=on -DUSE_DDS=off -DUSE_DRIVERS=on -DENABLE_QP=on -DENABLE_PICOFLEXX=off -DENABLE_VIVE=on -DENABLE_VIVE_SOLVER=on -DENABLE_INTEGRATION_TESTING=off -DCMAKE_BUILD_TYPE=RelWithDebInfo  -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"

Note:

  • there are now some wild quotations in the first arg and after the last
  • there are two spaces before the last arg

And this is the resulting config.yaml:

blacklist: []
build_space: /home/astrobee/catkin_ws/build
catkin_make_args: []
cmake_args:
- -DENABLE_GAZEBO=on -DBUILD_LOC_RVIZ_PLUGINS=on -DUSE_CCACHE=on -DUSE_ROS=on -DUSE_DDS=off
  -DUSE_DRIVERS=on -DENABLE_QP=on -DENABLE_PICOFLEXX=off -DENABLE_VIVE=on -DENABLE_VIVE_SOLVER=on
  -DENABLE_INTEGRATION_TESTING=off -DCMAKE_BUILD_TYPE=RelWithDebInfo  -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
devel_layout: linked
devel_space: /home/astrobee/catkin_ws/devel
extend_path: null
extends: null
install: false
install_space: /home/astrobee/catkin_ws/install
isolate_install: false
jobs_args: []
licenses:
- TODO
log_space: /home/astrobee/catkin_ws/log
maintainers: []
make_args: []
source_space: src
use_env_cache: false
use_internal_make_jobserver: true
whitelist: []

If you're interested I'm using a devcontainer here. If you want to use it, you'll need to change "REMOTE": "ghcr.io", in devcontainer.json

@betwo
Copy link
Owner

betwo commented Dec 5, 2021

Thank you for all the information! I just cloned your repo and set up the devcontainer.

I found two issues, one caused the tray quotes, the other was an issue triggered by the default .bashrc file in the devcontainer not sourceing the default ros workspace.

With 3.3.6-beta I was now able to initialize the cmake args and I was also able to start building the workspace:
Screenshot from 2021-12-05 20-22-34

Would be awesome if you could try this again in your setup!

@jdekarske
Copy link
Author

Everything works! Awesome! Thanks for your help with this 😄

@betwo
Copy link
Owner

betwo commented Dec 5, 2021

Great! Thank you for testing!

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

No branches or pull requests

2 participants