Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Battle of bazel build - OPTiM TECH NIGHT
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
OPTiM
October 24, 2019
Technology
870
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Battle of bazel build - OPTiM TECH NIGHT
OPTiM
October 24, 2019
More Decks by OPTiM
See All by OPTiM
Railsバージョンを4倍にした話
optim
0
430
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
570
IHV like なユースケースへのOpenID Connect 関連仕様の適用事例
optim
0
660
製品の問い合わせ負荷をLLMで解消したい 〜RAGで作る「自社を知っている」チャットボット〜
optim
0
46
AI エージェントシステムの開発を AI で加速させたい!
optim
0
47
既存プロダクトのRSpec カバレッジを 40% から100% にした話
optim
1
150
最近やってよかったデザインシステム運用改善3選
optim
1
440
<install>要素は何ができて、何を変えるのか
optim
1
380
CIでリグレッションテストを実行し継続的に品質を担保する
optim
1
410
Other Decks in Technology
See All in Technology
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
140
Rust で関数型ドメインモデリング
takonda
0
140
"優秀な誰か"の下位互換にならないために
yut0naga1_fa
1
1.8k
USB PDを使ってスマホを労わりたい
raspython3
0
180
大型犬好きによるPugの紹介
yamanoku
1
160
Refining Active Record
shugo
0
160
WasmをRustにする
sansantech
PRO
0
260
Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
1
630
Persisting Massive Data with Rails ~Designing for 60 billion rows, and fighting the bottlenecks~ Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
0
730
ウォンテッドリーの最近のプロダクトと技術の紹介
stomk
0
120
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
990
AI導入は済んだ。次は統制を作り替える番だ_AI×開発組織 Summit 2026
techtekt
PRO
0
300
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.6k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
580
Done Done
chrislema
187
17k
Why Our Code Smells
bkeepers
PRO
340
58k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Balancing Empowerment & Direction
lara
6
1.3k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.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