Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Battle of bazel build - OPTiM TECH NIGHT
Search
OPTiM
October 24, 2019
Technology
0
750
Battle of bazel build - OPTiM TECH NIGHT
OPTiM
October 24, 2019
Tweet
Share
More Decks by OPTiM
See All by OPTiM
IoT機器の一括デバイスプロビジョニングと遠隔操作の技術 / 20250424-iot-aoki
optim
0
39
ClineにNext.jsのプロジェクト改善をお願いしてみた / 20250321_reacttokyo_LT
optim
2
1.9k
k8s(EKS)でマルチテナントプラットフォームを運用する際のコスト按分の実装 / 250124_LT_SRE
optim
0
52
MDMサービスの巨大さと特殊さに負けない開発体制と品質プロセス / technight250218
optim
0
120
Nuxt3マイグレーションについて / nuxt_migration
optim
1
230
挑戦を楽しむ!保守運用の管理課題への取り組み
optim
0
150
開発生産性を始める前に開発チームができること / optim-improve-development-productivity.pdf
optim
1
920
Go×LLMで新たなコード生成の可能性を探る / GolangDeveloperNight_Go×LLM
optim
0
910
スプリントレビュー(バザー形式)とそれを支えるCI CD / sprint-review-bazaar-and-supporting-cicd
optim
0
990
Other Decks in Technology
See All in Technology
KubeCon + CloudNativeCon Japan 2025 Recap by CA
ponkio_o
PRO
0
300
LangSmith×Webhook連携で実現するプロンプトドリブンCI/CD
sergicalsix
1
230
関数型プログラミングで 「脳がバグる」を乗り越える
manabeai
1
190
Reach American Airlines®️ Instantly: 19 Calling Methods for Fast Support in the USA
flyamerican
1
170
Sansanのデータプロダクトマネジメントのアプローチ
sansantech
PRO
0
150
React開発にStorybookとCopilotを導入して、爆速でUIを編集・確認する方法
yu_kod
1
270
開発生産性を組織全体の「生産性」へ! 部門間連携の壁を越える実践的ステップ
sudo5in5k
2
7k
「良さそう」と「とても良い」の間には 「良さそうだがホンマか」がたくさんある / 2025.07.01 LLM品質Night
smiyawaki0820
1
560
NewSQLや分散データベースを支えるRaftの仕組み - 仕組みを理解して知る得意不得意
hacomono
PRO
2
140
SmartNewsにおける 1000+ノード規模 K8s基盤 でのコスト最適化 – Spot・Gravitonの大規模導入への挑戦
vsanna2
0
130
KiCadでPad on Viaの基板作ってみた
iotengineer22
0
300
american airlines®️ USA Contact Numbers: Complete 2025 Support Guide
supportflight
1
110
Featured
See All Featured
Visualization
eitanlees
146
16k
Building an army of robots
kneath
306
45k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Agile that works and the tools we love
rasmusluckow
329
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
54k
How GitHub (no longer) Works
holman
314
140k
How to train your dragon (web standard)
notwaldorf
95
6.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.8k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.4k
Transcript
Copyright © OPTiM Corp. All Right Reserved. 1 2019/10/24 OPTiM
TECH NIGHT Battle of bazel build (Googleビルドツールではまらないための対策)
Copyright © OPTiM Corp. All Right Reserved. 2 徳⽥ (
@dakuton) OPTiM Corporation / R&D Team 2009年⼊社 定量・⾳声データ解析 + エッジ推論 ⾃⼰紹介 https://speakerdeck.com/dakuton
Copyright © OPTiM Corp. All Right Reserved. 3 Getting Startedで
Install Bazel and use bazel build って書いてあるけど… まとめ # Using Bazel's APT repository $ sudo apt-get install bazel Failed # for macOS $ brew install bazel Failed
Copyright © OPTiM Corp. All Right Reserved. 4 Googleが中⼼となって開発しているOSS等で⽤いられているビルドツール Bazelとは︖
並列実⾏ 差分ビルド(テスト) Platform: Java, C++, Go, Android, iOS, etc HostOS: Ubuntu, CentOS, macOS , Windows ビルド⼀意性を担保 CI等でビルド再現が容易 Fast Multiple Languages Reproducible Extensible Starlark(Python likeな⾔語)による ビルドスクリプト拡張 https://bazel.build/faq.html
Copyright © OPTiM Corp. All Right Reserved. 5 利⽤例: モバイル機械学習
Copyright © OPTiM Corp. All Right Reserved. 6 利⽤例: モバイル機械学習
Copyright © OPTiM Corp. All Right Reserved. 7 Googleが中⼼となって開発しているOSS等で⽤いられているビルドツール MediapipeでのBazel活⽤
並列実⾏ 差分ビルド(テスト) Platform: Java, C++, Go, Android, iOS, etc HostOS: Ubuntu, CentOS, macOS, Windows ビルド⼀意性を担保 CI等でビルド再現が容易 Fast Multiple Languages Extensible Starlark(Python likeな⾔語)による ビルドスクリプト拡張 Reproducible のクロスプラットフォームビルドを で実現
Copyright © OPTiM Corp. All Right Reserved. 8 Build from
sourceで Install Bazel and use bazel build に従うとBazelの破壊的変更で互換性がないバージョンがインストールされる Bazel利⽤による問題点1 # for macOS $ brew install bazel Success $ bazel build -c opt --config=android_arm64 mediapipe/examples/andr oid/src/java/com/google/mediapipe/apps/handtrackinggpu Failed 10/24時点で1.1.0がインストールされる
Copyright © OPTiM Corp. All Right Reserved. 9 Bazel必要バージョン確認⽅法 •
⽐較的規模の⼤きいプロジェクトであればCI向けのビルドスクリプト or Dockerfileが ⽤意されているので利⽤しているバージョンを確認しインストール • https://github.com/tensorflow/tensorflow/blob/r2.0/tensorflow/tools/ci_build/ install/install_bazel.sh 破壊的変更のチェック⽅法 • --incompatible_xxxxxxx や --experimental_xxxxxxx と指定されているものが対象 • --all_incompatible_changes で影響をチェック Bazel利⽤による問題点1(対策)
Copyright © OPTiM Corp. All Right Reserved. 10 Java系プロジェクトで起こっていた問題(現在は修正済み) bazel
build対象プロジェクトとBazel本体で要求されるJDKが異なる Bazel利⽤による問題点2 <<<<<<< HEAD apt-get update && apt-get install -y openjdk-11-jdk ======= apt-get update && apt-get install -y openjdk-8-jdk >>>>>>> Project import generated by Copybara. https://github.com/google/mediapipe/commit/af676420555f60c71c481f597d5ed3aa3b4f6789 Android SDKはOpenJDK 11⾮対応
Copyright © OPTiM Corp. All Right Reserved. 11 Bazel利⽤による問題点2(+対策) $
sudo apt-get -qqy install gnupg2 $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 $ sudo apt-add-repository "deb http://repos.azul.com/azure-only/zulu/apt stable main" $ sudo apt-get -q update $ sudo apt-get -y install zulu-8-azure-jdk $ bazel info java-runtime OpenJDK Runtime Environment (build 1.8.0_212-b04) by Azul Systems, Inc. https://mirror.bazel.build/openjdk/index.html 参考: 最適なOpenJDKディストリビューションの選び⽅ https://www.oracle.co.jp/campaign/code/2019/pdfs/oct2019_b-3-3.pdf LTSサポート終了したOpenJDKを回避する場合 Bazel JDKバンドル版が利⽤しているZulu OpenJDKを⽤いる
Copyright © OPTiM Corp. All Right Reserved. 12 余談 OracleのSSL証明書が期限失効して構築失敗してた(4/27)
Copyright © OPTiM Corp. All Right Reserved. 13 ローカル実⾏環境のリソースを⼤量に使ってビルドする ・デフォルト値だとCPUの半分+RAMの2/3を占有
Bazel利⽤による問題点3(+対策) $ bazel build //foo ¥ --local_cpu_resources=2 ¥ --local_ram_resources=2048 ⼤規模プロジェクトでは CPU+RAMリソース利⽤量を指定するのが無難
Copyright © OPTiM Corp. All Right Reserved. 14 • Install
Bazel どおりだと bazel build は失敗する • バージョンは確認してビルドしましょう まとめ
Copyright © OPTiM Corp. All Right Reserved. 15