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
770
Battle of bazel build - OPTiM TECH NIGHT
OPTiM
October 24, 2019
Tweet
Share
More Decks by OPTiM
See All by OPTiM
Ruby初学者から見たRubyKaigi
optim
0
200
メモ整理が苦手な者による頑張らないObsidian活用術
optim
1
240
新卒でも即戦力になりたい! ~新卒エンジニアがAIを使ってElectronアプリの改善をやってみた~/20250723-ai-endo
optim
0
42
製品価値向上のための "上流工程" AI支援/20250723-ai-uehara
optim
0
44
IoT機器の一括デバイスプロビジョニングと遠隔操作の技術 / 20250424-iot-aoki
optim
0
56
ClineにNext.jsのプロジェクト改善をお願いしてみた / 20250321_reacttokyo_LT
optim
2
2.1k
k8s(EKS)でマルチテナントプラットフォームを運用する際のコスト按分の実装 / 250124_LT_SRE
optim
0
68
MDMサービスの巨大さと特殊さに負けない開発体制と品質プロセス / technight250218
optim
0
140
Nuxt3マイグレーションについて / nuxt_migration
optim
1
280
Other Decks in Technology
See All in Technology
複数サービスを支えるマルチテナント型Batch MLプラットフォーム
lycorptech_jp
PRO
1
870
Create Ruby native extension gem with Go
sue445
0
120
KotlinConf 2025_イベントレポート
sony
1
140
企業の生成AIガバナンスにおけるエージェントとセキュリティ
lycorptech_jp
PRO
2
190
新アイテムをどう使っていくか?みんなであーだこーだ言ってみよう / 20250911-rpi-jam-tokyo
akkiesoft
0
330
Automating Web Accessibility Testing with AI Agents
maminami373
0
1.3k
プラットフォーム転換期におけるGitHub Copilot活用〜Coding agentがそれを加速するか〜 / Leveraging GitHub Copilot During Platform Transition Periods
aeonpeople
1
230
【NoMapsTECH 2025】AI Edge Computing Workshop
akit37
0
230
ブロックテーマ時代における、テーマの CSS について考える Toro_Unit / 2025.09.13 @ Shinshu WordPress Meetup
torounit
0
130
Platform開発が先行する Platform Engineeringの違和感
kintotechdev
4
580
「Linux」という言葉が指すもの
sat
PRO
4
140
現場で効くClaude Code ─ 最新動向と企業導入
takaakikakei
1
260
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
140
7.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
GitHub's CSS Performance
jonrohan
1032
460k
Context Engineering - Making Every Token Count
addyosmani
3
58
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Optimizing for Happiness
mojombo
379
70k
Gamification - CAS2011
davidbonilla
81
5.4k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Balancing Empowerment & Direction
lara
3
620
A Modern Web Designer's Workflow
chriscoyier
696
190k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Statistics for Hackers
jakevdp
799
220k
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