questions about --compilation_mode

1,054 views
Skip to first unread message

haodah...@gmail.com

unread,
Aug 3, 2016, 8:43:38 AM8/3/16
to bazel-discuss
Hello everyone:

I see that bazel has three compilation modes: fastbuild, opt and dbg.
When I want to have a binary that contains debug information, I choose dbg, when I want to generate a binary for release, I choose opt, so when should fastbuild be used?

And more specifically, what options are they using to build my C++ projects.

And is there any options like RelWithDebInfo, with which I don't need to worry about performance issue and also have debug information written in binaries for testing.

Thanks in advance.

Thiago Farina

unread,
Aug 3, 2016, 12:37:39 PM8/3/16
to haodah...@gmail.com, bazel-discuss


On Wednesday, August 3, 2016, <haodah...@gmail.com> wrote:
Hello everyone:

I see that bazel has three compilation modes: fastbuild, opt and dbg.
When I want to have a binary that contains debug information, I choose dbg, when I want to generate a binary for release, I choose opt, so when should fastbuild be used?

fastbuild is the default.
 
And more specifically, what options are they using to build my C++ projects.

And you can probably see what it is doing by passing -s flag (--subcommands) to build command.


--
Thiago Farina

Brian Silverman

unread,
Aug 3, 2016, 1:30:38 PM8/3/16
to Thiago Farina, haodah...@gmail.com, bazel-discuss
On Wed, Aug 3, 2016 at 9:37 AM, Thiago Farina <tfa...@chromium.org> wrote:


On Wednesday, August 3, 2016, <haodah...@gmail.com> wrote:
Hello everyone:

I see that bazel has three compilation modes: fastbuild, opt and dbg.
When I want to have a binary that contains debug information, I choose dbg, when I want to generate a binary for release, I choose opt, so when should fastbuild be used?

fastbuild is the default.
 
As far as why it exists, it's intended to build quickly. When the slowest part of your compile-test iteration is compiling (which it often is for C++), making the compiler faster by not dealing with debug information etc is helpful.
Message has been deleted

haodah...@gmail.com

unread,
Aug 3, 2016, 10:50:12 PM8/3/16
to bazel-discuss, haodah...@gmail.com
在 2016年8月4日星期四 UTC+8上午12:37:39,Thiago Farina写道:
Yeah, I can see. So there is no things like RelWithDebInfo?
Currently, my solution is: bazel build *** -c dbg --copt=-O3
Reply all
Reply to author
Forward
0 new messages