Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine rpath fixup to inspect already existing rpaths #36056

Merged
merged 14 commits into from
Feb 29, 2024

Conversation

Neumann-A
Copy link
Contributor

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}'

@Neumann-A Neumann-A mentioned this pull request Jan 6, 2024
@Cheney-W Cheney-W added the category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly label Jan 8, 2024
@Cheney-W
Copy link
Contributor

Cheney-W commented Jan 8, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Neumann-A
Copy link
Contributor Author

@dg0yt Any idea why vcpkg-find-acquire-program is failing or why it does a double extraction (at least that is what I assume)? Is the search path wrong? Should the test port search for everything twice?

@dg0yt
Copy link
Contributor

dg0yt commented Jan 14, 2024

I guess the problem is related to the fact that vfap is unable to parse the version from the program's output, and that's why it even doesn't accept its own previous download.
Cf. #36046.

@Cheney-W
Copy link
Contributor

Cheney-W commented Feb 2, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Neumann-A
Copy link
Contributor Author

I guess the problem is related to the fact that vfap is unable to parse the version from the program's output, and that's why it even doesn't accept its own previous download.
Cf. #36046.

Nope was a problem with the test. It simply set the variable to empty resulting in unexpected behavior

Cheney-W
Cheney-W previously approved these changes Feb 8, 2024
@Cheney-W Cheney-W added the info:reviewed Pull Request changes follow basic guidelines label Feb 8, 2024
data-queue
data-queue previously approved these changes Feb 10, 2024
Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

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

LGTM with string manipulation test(s)

scripts/cmake/z_vcpkg_fixup_rpath.cmake Outdated Show resolved Hide resolved
scripts/cmake/z_vcpkg_fixup_rpath.cmake Outdated Show resolved Hide resolved
@Neumann-A Neumann-A dismissed stale reviews from data-queue and Cheney-W via 2fbead5 February 10, 2024 10:58
Copy link
Contributor

@Osyotr Osyotr left a comment

Choose a reason for hiding this comment

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

Can we have x64-linux-dynamic CI run with these changes?

@@ -169,8 +171,8 @@ if(CMD STREQUAL "BUILD")

include("${CURRENT_PORT_DIR}/portfile.cmake")
if(DEFINED PORT)
if(VCPKG_FIXUP_ELF_RPATH)
include("${SCRIPTS}/cmake/z_vcpkg_fixup_rpath.cmake")
if(VCPKG_FIXUP_ELF_RPATH OR VCPKG_TARGET_IS_LINUX)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(VCPKG_FIXUP_ELF_RPATH OR VCPKG_TARGET_IS_LINUX)
if(VCPKG_FIXUP_ELF_RPATH)

or

Suggested change
if(VCPKG_FIXUP_ELF_RPATH OR VCPKG_TARGET_IS_LINUX)
if(VCPKG_FIXUP_ELF_RPATH AND VCPKG_TARGET_IS_LINUX)

Otherwise I don't see how VCPKG_FIXUP_ELF_RPATH makes sense anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I think I was assuming it would be fixed to not apply to static triplets in my comment.

scripts/cmake/z_vcpkg_fixup_rpath.cmake Outdated Show resolved Hide resolved
triplets/x64-linux.cmake Outdated Show resolved Hide resolved
execute_process(
COMMAND "${PATCHELF}" --set-rpath "${rpath}" "${elf_file}"
COMMAND "${PATCHELF}" --set-rpath "${new_rpath}" "${elf_file}"
OUTPUT_QUIET
ERROR_VARIABLE set_rpath_error
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ERROR_VARIABLE set_rpath_error

Or keep the error check in case patchelf for some reason couldn't fix our binary for some reason.

Co-authored-by: Osyotr <Osyotr@users.noreply.github.com>
@Cheney-W
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Cheney-W Cheney-W removed the info:reviewed Pull Request changes follow basic guidelines label Feb 18, 2024
@Neumann-A
Copy link
Contributor Author

Should I retrigger CI or should i wait for further review?

@Cheney-W
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Cheney-W Cheney-W added the info:reviewed Pull Request changes follow basic guidelines label Feb 27, 2024
@vicroms vicroms merged commit 2ac6ba1 into microsoft:master Feb 29, 2024
16 checks passed
@Neumann-A Neumann-A deleted the refine_rpath_fixup branch February 29, 2024 06:56
BillyONeal added a commit to BillyONeal/vcpkg that referenced this pull request Mar 4, 2024
…e actually need it.

In microsoft#36056 , things were changed to unconditionally patchelf when targeting Linux. Unfortunately that broke --only-downloads a lot of the time. This fixes that.
BillyONeal added a commit to data-queue/vcpkg-tool that referenced this pull request Mar 4, 2024
data-queue added a commit to microsoft/vcpkg-tool that referenced this pull request Mar 4, 2024
* print compiler path

* update messages.json

* fix empty message

* fix format

* add tests and fix

* update vcpkg to latest commit

* fix

* fix

* Fix e2e test on Windows.

* Change scripts SHA to not include microsoft/vcpkg#36056

---------

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
BillyONeal added a commit that referenced this pull request Mar 7, 2024
…ATH (#37129)

... and don't fetch patchelf unless we actually need it. For example
cmake helper ports have no need to fetch patchelf.

In #36056 , things were changed
to unconditionally patchelf when targeting Linux. Unfortunately that
broke --only-downloads a lot of the time. This fixes that.

Also contains @Osyotr 's fixes from
#37190 to coalesce world rebuilds
a bit, so repeating comments from there:

Fixes #37183
Towards #25668
Comment on lines +28 to +37
# lib relative corrections
list(TRANSFORM rpath_norm REPLACE "${current_prefix}/lib/?" "\$ORIGIN/${relative_to_lib}/")
list(TRANSFORM rpath_norm REPLACE "${current_installed_prefix}/lib/?" "\$ORIGIN/${relative_to_lib}/")
list(TRANSFORM rpath_norm REPLACE "${current_prefix}/lib/?" "\$ORIGIN/${relative_to_lib}/")
list(TRANSFORM rpath_norm REPLACE "${current_installed_prefix}/lib/?" "\$ORIGIN/${relative_to_lib}/")
# prefix relativ
list(TRANSFORM rpath_norm REPLACE "${current_prefix}" "\$ORIGIN/${relative_to_prefix}/")
list(TRANSFORM rpath_norm REPLACE "${current_installed_prefix}" "\$ORIGIN/${relative_to_prefix}/")
list(TRANSFORM rpath_norm REPLACE "${current_prefix}" "\$ORIGIN/${relative_to_prefix}/")
list(TRANSFORM rpath_norm REPLACE "${current_installed_prefix}" "\$ORIGIN/${relative_to_prefix}/")
Copy link
Contributor

Choose a reason for hiding this comment

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

@Neumann-A I may be overlooking the obvious: Is there a reason why each line occurs twice? AFAICS they cannot match twice. Every match inserts $ORIGIN, and then it cannot have a second insertion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants