Skip to content

Commit

Permalink
[fbgemm_gpu] Remove errant RPATHs from binaries
Browse files Browse the repository at this point in the history
- Remove errant RPATHs from binaries (pytorch#3098)
  • Loading branch information
q10 committed Sep 23, 2024
1 parent 2889f3a commit ecd8c28
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/scripts/fbgemm_gpu_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ __print_library_infos () {

echo "[CHECK] Listing out external shared libraries linked:"
print_exec ldd "${library}"

echo "[CHECK] Displaying ELF information:"
print_exec readelf -d "${library}"
echo "################################################################################"
echo ""
echo ""
Expand Down
12 changes: 12 additions & 0 deletions .github/scripts/fbgemm_gpu_postbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

echo "[CMAKE] Running post-build script ..."

echo $(pwd)
echo $(ls -la)
find . -name *.so | xargs patchelf --remove-rpath
1 change: 1 addition & 0 deletions .github/scripts/utils_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ install_build_tools () {
ncurses \
ninja \
openblas \
patchelf \
scikit-build \
wheel) || return 1

Expand Down
4 changes: 4 additions & 0 deletions fbgemm_gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,7 @@ if(NOT FBGEMM_CPU_ONLY AND NOT USE_ROCM)
#
add_subdirectory(experimental/gen_ai)
endif()


install(CODE "execute_process(COMMAND ../.github/scripts/fbgemm_gpu_postbuild.sh)")
# ; patchelf --remove-rpath *.so)
7 changes: 7 additions & 0 deletions fbgemm_gpu/FbgemmGpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -725,3 +725,10 @@ install(FILES ${gen_python_source_files}

install(FILES ${gen_defused_optim_py_files}
DESTINATION fbgemm_gpu/split_embedding_optimizer_codegen)


add_custom_target(clean_rpath ALL
WORKING_DIRECTORY ${OUTPUT_DIR}/bin
COMMAND sh ../.github/scripts/fbgemm_gpu_postbuild.sh)

add_dependencies(fbgemm_gpu_py clean_rpath)

0 comments on commit ecd8c28

Please sign in to comment.