While working through a bug we ran into with MacOS failing to compile, I
got a better understanding of some of the Bazel settings. In another thread
with Josh, who is compiling on the Apple M1 for the first time, he ran into
issues with Linux vs OSX.

It dawned on me that we were explicitly setting the config to modify a
number of settings. Some of them include the following items:
1. Platform libraries (Linux C libraries)
2. Platform + CPU decision on which binary to use (Helm binary)
3. OS decision (MacOS unique steps vs Linux as the default)
4. Optimization setting (We just hardcoded to C03, but Bazel reported as
"fastbuild")
5. Stylecheck toggle (darwin vs darwin_nostyle)

In a recent PR, I collapsed all of the Linux flavors to a standard
`--config=linux`. This was born out of my frustration with the build
scripts not jiving with Bazel standards. But it was not actually solving
the problem. I'm hoping that this PR will help resolve some of the issues.

https://github.com/apache/incubator-heron/pull/3779

Changes:
1. No longer need to set `--config`. Bazel will detect the OS automatically.
2. Default is `fastbuild`, but you can add `-c opt` to build optimized
build.
  a. You can even build both side by side with Bazel making a folder like
darwin-fastbuild and darwin-opt
3. If you want to run stylecheck, you can add `--config=stylecheck`
4. The Linux libraries (-lm, -lpthread, -lrt) are included in
`tools/platform/BUILD`
5. As we add support for ARM, we can add more options in
`tools/platform/BUILD`
6. Scripts outside of Bazel were updated to remove `--config`.
7. Scripts outside of Bazel will specify  `-c opt` or `--config=stylecheck`
when needed.

Reply via email to