Files
CPlusPlusThings/site_extras/cpp-tools-bazel-build-guide.md
light-city dfe1c933b3 docs: address community issue feedback (#5 #338 #142 #246 #136 #303)
- const README: rewrite the space-saving claim per issue #5 follow-ups
  (constant-expression const vs #define immediates; which const qualify
  as constant expressions)
- const README: fix the class-section diagnosis per issue #338 (overload
  resolution picks the const overload; the restriction only surfaces
  once that overload is removed)
- sizeof README: virtual-inheritance result is compiler-dependent
  (GCC merges vbptr+vfptr -> 16, MSVC keeps them separate -> 32) #246
- static README: new section on internal linkage / access restriction
  with anonymous-namespace comparison #142
- 10-day practice: full problem list table + fixed day links #136
- new design_pattern/singleton/singleton_default.hpp: reusable
  thread-safe CRTP singleton template, compile+concurrency tested #303
2026-10-13 19:23:54 +08:00

1.6 KiB
Raw Permalink Blame History

来自 C++那些事网站 的文章,由站点同步脚本导出。

Bazel 构建 C++ 项目

gpadmin@gpadmin:~$ ./bazel-6.1.1-installer-linux-x86_64.sh --user
Bazel installer
---------------

Bazel is bundled with software licensed under the GPLv2 with Classpath exception.
You can find the sources next to the installer on our release page:
   https://github.com/bazelbuild/bazel/releases

# 

## Build information
   - [Commit](https://github.com/bazelbuild/bazel/commit/1a90fe5)
Uncompressing......WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
Extracting Bazel installation...
.

Bazel is now installed!

Make sure you have "/home/gpadmin/bin" in your path.

For bash completion, add the following line to your :
  source /home/gpadmin/.bazel/bin/bazel-complete.bash

For fish shell completion, link this file into your
/home/gpadmin/.config/fish/completions/ directory:
  ln -s /home/gpadmin/.bazel/bin/bazel.fish /home/gpadmin/.config/fish/completions/bazel.fish

See http://bazel.build/docs/getting-started.html to start a new project!

默认安装到home/bin

gpadmin@gpadmin:~$ ls ~/bin/
bazel
  1. 在安装过程中,Bazel 可能会提示您添加环境变量。如果是这样,请根据提示编辑您的 ~/.bashrc 文件并将以下行添加到文件末尾:
复制代码export PATH="$PATH:$HOME/bin"
  1. 重新加载 .bashrc 文件以使更改生效:
复制代码source ~/.bashrc