Skip to content

fix(build): Register /usr/local/lib64 with ldconfig after gflags install on CentOS 9#16817

Closed
Avinash-Raj wants to merge 9 commits intofacebookincubator:mainfrom
Avinash-Raj:avi/fix-centos9-gflags-ldconfig
Closed

fix(build): Register /usr/local/lib64 with ldconfig after gflags install on CentOS 9#16817
Avinash-Raj wants to merge 9 commits intofacebookincubator:mainfrom
Avinash-Raj:avi/fix-centos9-gflags-ldconfig

Conversation

@Avinash-Raj
Copy link
Copy Markdown
Contributor

@Avinash-Raj Avinash-Raj commented Mar 18, 2026

gflags installs to /usr/local/lib64 which is not in the default ldconfig search path on CentOS Stream 9.
This causes downstream builds (e.g. fbthrift's thrift1 compiler) to fail at runtime with:

error while loading shared libraries: libgflags.so.2.2

This moves gflags to /usr/local/lib to align with other dependency installation paths and registers that path with ldconfig.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 18, 2026

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit e4bdbb5
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/69bde1c75af77e0008e9d1eb

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 18, 2026
@Avinash-Raj Avinash-Raj changed the title Fix: gflags shared library not found on CentOS 9 fix(build): Register /usr/local/lib64 with ldconfig after gflags install on CentOS 9 Mar 18, 2026
dnf remove -y gflags
wget_and_untar https://github.com/gflags/gflags/archive/"${GFLAGS_VERSION}".tar.gz gflags
cmake_install_dir gflags -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_gflags_LIB=ON -DLIB_SUFFIX=64
echo "/usr/local/lib64" >/etc/ld.so.conf.d/local-lib64.conf && ldconfig
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: space between > and /etc.

Copy link
Copy Markdown
Contributor Author

@Avinash-Raj Avinash-Raj Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I did the same, but the repo's pre-commit hook complains about the space which appears next to the > operator.

Copy link
Copy Markdown
Collaborator

@mattgara mattgara Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the contents of /usr/local/lib64/ but could this create conflicts with other libraries that share the same soname?

Have we reviewed if any such conflicts are possible?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These days it seems fairly interchangeable with /usr/local/lib and some libraries just decide to put their DSOs there instead. @bdice made a similar change in the Velox container Dockerfile a few weeks ago (#16387)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we remove -DLIB_SUFFIX=64 from the above, and then remove this line? I believe that would make it install to /usr/local/lib instead of /usr/local/lib64. That might be cleaner overall.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can try this.

Copy link
Copy Markdown
Collaborator

@bdice bdice Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validating the changes with a manual CI run using Presto master (2ff4adf2d3b1691947b16bcd7c41b3a87ce0bc9f) and this branch of Velox (a14663eaf90afa42be471907d402f2f8a4b614a4).

https://github.com/rapidsai/velox-testing/actions/runs/23355678278/job/67945747920

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I settled on a solution that calls ldconfig but doesn't use -DLIB_SUFFIX=64 anymore.

I accidentally rebased/force-pushed, then restored the history in a second force-push. Apologies for that. I'll approve the PR.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked. Let's get it merged. 👍

@bdice bdice force-pushed the avi/fix-centos9-gflags-ldconfig branch from a14663e to cc68f01 Compare March 20, 2026 23:04
…stall on CentOS 9

gflags installs shared libraries to INSTALL_PREFIX/lib, which is not in
the default ldconfig search path on CentOS Stream 9. This causes
fbthrift's thrift1 compiler to fail at runtime with:

  error while loading shared libraries: libgflags.so.2.2

Also remove -DLIB_SUFFIX=64 so gflags installs to lib/ instead of
lib64/, consistent with the INSTALL_PREFIX convention.
@bdice bdice force-pushed the avi/fix-centos9-gflags-ldconfig branch from cc68f01 to e4bdbb5 Compare March 21, 2026 00:09
@bdice bdice added the ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall label Mar 23, 2026
@aditi-pandit
Copy link
Copy Markdown
Collaborator

I've been seeing this error when starting presto_server which might be related.

/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/cmake-build-debug/presto_cpp/main/presto_server --logtostderr=1 --v=1 --etc_dir=/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/etc
ERROR: something wrong with flag 'flagfile' in file '/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/deps-download/gflags/src/gflags.cc'.  One possibility: file '/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/deps-download/gflags/src/gflags.cc' is being linked both statically and dynamically into this executable.

Have others seen this as well ?

@majetideepak, @czentgr

@majetideepak
Copy link
Copy Markdown
Collaborator

I've been seeing this error when starting presto_server which might be related.

We discussed this internally. Aditi is seeing this issue on MacOS. Christian suggested the following fix

set VELOX_BUILD_SHARED=ON (env var) and then re-install folly via setup script (setup-macos.sh install_folly).
Then build with EXTRA_CMAKE_FLAGS="-DVELOX_BUILD_SHARED=ON" .

@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 23, 2026

@kgpai has imported this pull request. If you are a Meta employee, you can view this in D97776866.

@bdice
Copy link
Copy Markdown
Collaborator

bdice commented Mar 23, 2026

@aditi-pandit I think this is solving a different issue. We saw this kind of error when building the Presto native dependencies image:

/build/deps-download/fbthrift/_build/bin/thrift1: error while loading shared libraries: libgflags.so.2.2: cannot open shared object file: No such file or directory

Full logs are in https://github.com/rapidsai/velox-testing/actions/runs/23355678278/job/67945776144.

@meta-codesync meta-codesync bot closed this in 1e19ac6 Mar 23, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 23, 2026

@kgpai merged this pull request in 1e19ac6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants