See the getting started page for more information about downloading, building, and deploying Mesos.
See our community page for more details.
Instead of using grep and other tools to find your way through the
Mesos codebase, you can use cquery
on Windows, Linux, and macOS!
Tested and designed for large code bases like Chromium, cquery provides accurate and fast semantic analysis for any editor that supports the Language Server Protocol.
Using cquery provides IDE features like these (and more):
Although the cquery wiki provides a getting started guide for building from source, generating the compilation information for your project, and setting up your editor, this guide covers setup specifically for Mesos using CMake. Feel free to refer to the wiki for further information, but what follows is the recommended setup.
NOTE: Do not use the released binaries as the latest, v20180302, is still built Clang 5 instead of Clang 6, which is buggy with Mesos.
The cquery project is currently switching to CMake, but the guide
still uses the waf build tool. Since we need to use CMake for Mesos
too, it easier to use it for both. More information can be found
on the wiki:
git clone --recursive https://github.com/cquery-project/cquery
cd cquery && mkdir build && cd build
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release
ninja
There should now exist a binary cquery (or cquery.exe on Windows)
in the build folder of the cquery repo. When configuring your editor,
you need to make sure this can either be found automatically via your
PATH, or point the editor’s plugin toward it.
The next step is to generate a compile_commands.json file for Mesos.
Fortunately, this can be done automatically using CMake. In fact, the
instructions are (almost) identical to the instructions above. Once
generated, either symlink or copy it to the root of the Mesos
repository.
git clone https://gitbox.apache.org/repos/asf/mesos.git
cd mesos && mkdir build && cd build
cmake .. -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=YES
ninja
cd ..
ln -s build/compile_commands.json .
The CMake option
CMAKE_EXPORT_COMPILE_COMMANDS
also supports the Makefile generator on Linux, if you wish to use it
instead of Ninja, but the author has not tested this scenario, and
recommends Ninja anyway as it builds faster. On Windows, Ninja is the
only generator which supports exporting the compilation commands.
Note that for cquery to work properly, an initial build must be completed because of our third-party dependencies, otherwise many of the project’s required headers will be missing.
Finally, your editor’s cquery / LSP plugin needs to be set up. Information for other editors can be found at Langserver.org. Once you have LSP setup, it can be used for other languages too by switching out the cquery backend with one specific for the language.
For Emacs, the packages lsp-mode and lsp-ui are recommended.
A sample (but complete) Emacs configuration which sets up syntax checking and auto-completions with LSP and cquery looks like this:
;; Generic Emacs package repo setup
(require 'package)
(customize-set-variable
'package-archives
'(("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")))
(package-initialize)
;; Used to install and configure Emacs packages.
;; I forgot the old way since using this.
;; https://github.com/jwiegley/use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
;; Syntax checking.
;; Should be automatic.nn
;; http://www.flycheck.org/en/latest/
(use-package flycheck
:ensure t
:config
(global-flycheck-mode))
;; Auto-completions.
;; There's also `C-M-i`, but this is async.
;; Also look at `company-flx` for better sorting.
;; https://company-mode.github.io/
(use-package company
:ensure t
:config
(global-company-mode))
;; Language Server Protocol Plugin.
;; The actual plugin used to communicate with cquery.
;; https://github.com/emacs-lsp/lsp-mode
(use-package lsp-mode
:ensure t)
;; Flycheck and other IDE-feature support for LSP.
;; This has the "fancy features" and should be customized.
;; Personally, I turned the symbol highlighting off.
;; https://github.com/emacs-lsp/lsp-ui
(use-package lsp-ui
:ensure t
:config
(add-hook 'lsp-mode-hook #'lsp-ui-mode))
;; LSP backend for Company.
;; https://github.com/tigersoldier/company-lsp
(use-package company-lsp
n :ensure t
:config
(setq company-lsp-enable-recompletion t)
(add-to-list 'company-backends 'company-lsp))
;; Client to configure and auto-start cquery.
;; https://github.com/cquery-project/emacs-cquery
(use-package cquery
:ensure t
:config
(add-hook 'c-mode-common-hook #'lsp-cquery-enable)
(setq cquery-executable "/path/to/cquery/build/cquery")
(setq cquery-extra-init-params '(:completion (:detailedLabel t))))
Being Emacs, feel free to customize to your liking. The author’s
configurations can be found here.
While auto completion, syntax checking, and other UI improvements are
automatic, you should also be aware of M-. for
xref-find-definitions; M-? for xref-find-references; M-, to
pop back before using xref; imenu to list an index of functions,
namespaces, etc.; and the customization options of
lsp-ui, as it will
automatically turn on a sideline and symbol highlighting, which can be
noisy.
An LSP plugin exists; if you set it up, please add the steps here.
A cquery specific extension exists; if you set it up, please add the steps here.
An LSP package exists; if you set it up, please add the steps here.
© 2012-2022 The Apache Software Foundation. Apache Mesos, the Apache feather logo, and the Apache Mesos project logo are trademarks of The Apache Software Foundation.