I am a beginner of envoy, I want to add function to realize my business need, But I do not known how to set up develop environment on mac using clion or vs code, is there a document
describing how to do it ?
We had some success with CLion using this tool to generate CMakeLists.txt: https://github.com/lizan/bazel-cmakelists
Clone thie tool, go to envoy sources directory and run:
<bazel-cmakelists dir>/bazel-cmakelists --targets //source/exe:envoy-static //test/...
Then open envoy directory in CLion. All files/classess should load properly and you will be able to use all CLion's "smart" navigation features.
Another problem on Mac is debugging with breakpoint support. We tried remote debugging with docker and gdb-server, but it is very slow. Someone claims that they successfully setup native debugging on Mac and VSCode, but we didn't try it yet: https://medium.com/@dirao/debugging-envoyproxy-on-osx-a3ebe87dc916
Of course you should also read and follow all the steps from this docs: https://github.com/envoyproxy/envoy/blob/master/DEVELOPER.md, especially https://github.com/envoyproxy/envoy/blob/master/bazel/README.md#quick-start-bazel-build-for-developers
@lizan any interest in doing some docs in the repo on your dev setup? It would be a nice thing for the community.
Thanks @MarcinFalkowski that's what I usually does, I only do smart navigation stuff and use auto completion in CLion. I haven't been able to use debugger for a while (didn't need either).
If you want to use vscode, this https://medium.com/@dirao/debugging-envoyproxy-on-osx-a3ebe87dc916 is useful.
@zplinuxlover sounds like we have a few actionable suggestions for you. Please re-open if you have further follow-up questions.
@jmarantz optimally I would like to get some of this in a dev doc in the repo somewhere. Can we use this to track that doc work potentially? It would be nice to have instructions for people who want to use both CLion and VScode (I think anyone else is on their own ;).
Has there been any progress on a doc for this? I tried the cmake option but I encountered some odd errors with headers when I did this. What are the best practices for developing and debugging envoy with breakpoints on a mac laptop?
Reopening to reflect that instructions for different options for macos dev should be checked in as docs.
CLion support the JSON compilation database. I tried this and it seemed to index everything, but was still unable to resolve any envoy symbols.
CLion ends up building 2 duplicate file trees - one for the checked-out source tree and one for the symlinked bazel tree. It believes that only the bazel tree is part of the project (i.e. has build targets), which I suppose is correct, but it's confusing. It can't resolve symbols no matter which file tree you use.
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.
FWIW, I recently switched from CLion to VSCode + clangd, this set up works well so far. I'll try to blog the whole setup, but in short just use compilation database with vscode-clangd plugin without default C/C++ plugin.
Most helpful comment
FWIW, I recently switched from CLion to VSCode + clangd, this set up works well so far. I'll try to blog the whole setup, but in short just use compilation database with vscode-clangd plugin without default C/C++ plugin.