-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refine rpath fixup to inspect already existing rpaths (#36056)
Reason: ``` -- Adjusting original rpath of: '/mnt/e/all/vcpkg/installed/x64-linux-release/lib/pkgconfig/../../lib/intel64/' -- Fixed rpath in: '/mnt/e/all/vcpkg/packages/numpy_x64-linux-release/lib/python3.11/site-packages/numpy/linalg/lapack_lite.cpython-311-x86_64-linux-gnu.so' ('$ORIGIN:$ORIGIN/../../../../:$ORIGIN/../../../../intel64/') ``` needed `$ORIGIN/../../../../intel64/` in there which came from a pc file via `-Wl,-rpath='${libdir}'` --------- Co-authored-by: Osyotr <[email protected]>
- Loading branch information
Showing
6 changed files
with
188 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "vcpkg-find-acquire-program", | ||
"version-string": "0", | ||
"port-version": 1, | ||
"port-version": 2, | ||
"description": "Test port to exercise vcpkg_find_acquire_program", | ||
"supports": "native" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) | ||
|
||
|
||
# Simple replacement and outside path test | ||
set(elf_dir "${CURRENT_PACKAGES_DIR}/lib") | ||
set(test_rpath "${CURRENT_PACKAGES_DIR}/lib:/usr/lib/") | ||
set(expected "$ORIGIN") | ||
|
||
z_vcpkg_calculate_corrected_rpath( | ||
ELF_FILE_DIR "${elf_dir}" | ||
ORG_RPATH "${test_rpath}" | ||
OUT_NEW_RPATH_VAR new_rpath | ||
) | ||
|
||
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") | ||
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") | ||
else() | ||
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") | ||
endif() | ||
|
||
# Simple pkgconfig path and outside path test | ||
set(elf_dir "${CURRENT_PACKAGES_DIR}/lib/") | ||
set(test_rpath "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/../../lib:/usr/lib/") | ||
set(expected "$ORIGIN") | ||
|
||
z_vcpkg_calculate_corrected_rpath( | ||
ELF_FILE_DIR "${elf_dir}" | ||
ORG_RPATH "${test_rpath}" | ||
OUT_NEW_RPATH_VAR new_rpath | ||
) | ||
|
||
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") | ||
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") | ||
else() | ||
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") | ||
endif() | ||
|
||
# elf dir in subdir | ||
set(elf_dir "${CURRENT_PACKAGES_DIR}/lib/somesubdir") | ||
set(test_rpath "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/../../lib:/usr/lib/") | ||
set(expected "$ORIGIN:$ORIGIN/..") | ||
|
||
z_vcpkg_calculate_corrected_rpath( | ||
ELF_FILE_DIR "${elf_dir}" | ||
ORG_RPATH "${test_rpath}" | ||
OUT_NEW_RPATH_VAR new_rpath | ||
) | ||
|
||
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") | ||
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") | ||
else() | ||
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") | ||
endif() | ||
|
||
# Getting more complex | ||
set(elf_dir "${CURRENT_PACKAGES_DIR}/plugins/notlib/extrasubdir") | ||
set(test_rpath "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/../../lib/someotherdir2:${CURRENT_INSTALLED_DIR}/lib/pkgconfig/../../someotherdir1:/usr/lib/") | ||
set(expected "$ORIGIN:$ORIGIN/../../../lib:$ORIGIN/../../../lib/someotherdir2:$ORIGIN/../../../someotherdir1") | ||
|
||
z_vcpkg_calculate_corrected_rpath( | ||
ELF_FILE_DIR "${elf_dir}" | ||
ORG_RPATH "${test_rpath}" | ||
OUT_NEW_RPATH_VAR new_rpath | ||
) | ||
|
||
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") | ||
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") | ||
else() | ||
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") | ||
endif() | ||
|
||
|
||
set(X_VCPKG_RPATH_KEEP_SYSTEM_PATHS ON) | ||
# Simple replacement and outside path test | ||
set(elf_dir "${CURRENT_PACKAGES_DIR}/lib") | ||
set(test_rpath "${CURRENT_PACKAGES_DIR}/lib:/usr/lib/") | ||
set(expected "$ORIGIN:/usr/lib") | ||
|
||
z_vcpkg_calculate_corrected_rpath( | ||
ELF_FILE_DIR "${elf_dir}" | ||
ORG_RPATH "${test_rpath}" | ||
OUT_NEW_RPATH_VAR new_rpath | ||
) | ||
|
||
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") | ||
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") | ||
else() | ||
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "vcpkg-fix-rpath", | ||
"version-date": "2024-02-10", | ||
"description": "Test port to check the string replacement in z_vcpkg_fixup_rpath", | ||
"supports": "native & linux" | ||
} |