[VL][Ubuntu] Build fails linking libvelox.so: system libgflags.a not compiled with -fPIC
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- bash, cmake, ubuntu
- 領域
- build-system
調査の方向性
scripts/setup-ubuntu.sh の113行目から始め、依存関係の流れを setup-centos8.sh と setup-openeuler24.sh の install_gflags と比較してください。Folly のビルド前に Ubuntu の gflags インストール手順を追加し、その後 Ubuntu で動的な Velox ビルドを実行して、libvelox.so が非 PIC の libgflags.a エラーなしでリンクされることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Environment
- OS: Ubuntu 22.04 (also affects Ubuntu 20.04)
- Backend: Velox
- Build type: Dynamic (non-vcpkg)
Problem
Building Gluten with the Velox backend on Ubuntu fails at the libvelox.so link step with:
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgflags.a(gflags.cc.o): relocation R_X86_64_PC32 against symbol 'stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
Root Cause
scripts/setup-ubuntu.sh installs gflags via apt-get install libgflags-dev. The apt-packaged libgflags.a on Ubuntu is not compiled with -fPIC, so the linker rejects it when it is pulled into libvelox.so (a shared library).
The issue is in setup-ubuntu.sh:113:
libgflags-dev \ # <-- apt version is not PIC-compiled
Folly's installed cmake config (/usr/local/lib/cmake/folly/folly-targets.cmake) hardcodes gflags_static as a link dependency, which resolves to the non-PIC /usr/lib/x86_64-linux-gnu/libgflags.a.
Why Only Ubuntu
setup-centos8.sh and setup-openeuler24.sh both have a dedicated install_gflags function that:
- Removes the system package (
dnf remove -y gflags) - Builds gflags from source with
cmake_install_dir gflags -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON
setup-ubuntu.sh is missing this function entirely.
Fix
Add an install_gflags function to setup-ubuntu.sh, mirroring what setup-centos8.sh does:
function install_gflags {
# Remove apt version (not PIC-compiled, cannot be linked into shared libs)
sudo apt-get remove -y libgflags-dev
wget_and_untar https://github.com/gflags/gflags/archive/v2.2.2.tar.gz gflags
cmake_install_dir gflags \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_gflags_LIB=ON
}
And call it from install_dependencies before building Folly (since Folly's cmake export will then reference the PIC-compiled version).
Workaround
Until fixed, users on Ubuntu can manually build gflags with PIC before running the Gluten build:
sudo apt-get remove -y libgflags-dev
cd /tmp
wget https://github.com/gflags/gflags/archive/v2.2.2.tar.gz -O gflags.tar.gz
tar -xzf gflags.tar.gz && cd gflags-2.2.2
cmake -B build \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_gflags_LIB=ON \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_BUILD_TYPE=Release
sudo cmake --build build -j4 --target install
# Reinstall glog-dev (removed as a side effect)
sudo apt-get install -y libgoogle-glog-dev
Note
Removing libgflags-dev also removes libgoogle-glog-dev as a side effect (apt dependency), causing a secondary glog/logging.h: No such file or directory error. The workaround above includes reinstalling libgoogle-glog-dev.
- 主要言語
- Scala
- スター
- 1.6k
- フォーク
- 665
- 平均マージ
- 4日 1時間
- マージ済み PR(30日)
- 93
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/gluten のほかの issue
-
[VL] Remove the unused ShuffleSchema.h対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 2 日以内に返信
-
[VL] madvise(WILLNEED) call fails in MmapFileStream because of wrong calculation of fetching length対応中かも @jiangjiangtian が 27 日前に担当しました。 オープンbug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/gluten#12711 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
似ている issue
-
Bound wrong-magic P2P diagnostics to parsed header bytes対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ergoplatform/ergo#2736 ·
メンテナーはふだん 1 日以内に返信
-
area:shuffle enhancement good first issue performance requires-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/datafusion-comet#7072 ·
メンテナーはふだん 1 日以内に返信
-
bug 🐞 CI/CD ⚒️
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
valkey-io/valkey-glide#7370 ·
メンテナーはふだん 1 日以内に返信
-
Improve UI text on confirmation page (at registration)対応中かも @Arghyann が 1 日前に担当しました。 オープンgood first issue improvement
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
lichess-org/lila#22126 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
agent-ready area/dev-tooling kind/docs-only layer/docs size/XS
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
marola-dev/marola#855 ·
メンテナーはふだん 1 日以内に返信