Skip to content

Conversation

@ocaisa
Copy link
Member

@ocaisa ocaisa commented Aug 5, 2024

Based off of #4003

@ocaisa ocaisa force-pushed the export_rpath_wrappers branch from 3615517 to bde0281 Compare August 9, 2024 13:10
@ocaisa ocaisa changed the base branch from develop to 5.0.x August 9, 2024 13:10
@ocaisa ocaisa closed this Aug 9, 2024
@ocaisa ocaisa reopened this Aug 9, 2024
@ocaisa ocaisa added the EasyBuild-5.0 EasyBuild 5.0 label Aug 10, 2024
@boegel boegel added this to the 5.0 milestone Aug 13, 2024
@boegel boegel changed the title Add capability to export rpath wrappers for a toolchain Add capability to export RPATH wrappers for a toolchain Aug 13, 2024
@ocaisa ocaisa force-pushed the export_rpath_wrappers branch from ed3800f to 5487954 Compare March 10, 2025 16:00
@ocaisa ocaisa requested a review from boegel March 17, 2025 11:12
@ocaisa
Copy link
Member Author

ocaisa commented Mar 17, 2025

This feature has been tested for EB 5 via easybuilders/easybuild-easyblocks#3661

@boegel boegel modified the milestones: 5.0.0, 5.x Mar 17, 2025
@boegel boegel changed the base branch from 5.0.x to develop March 19, 2025 10:55
@boegel boegel modified the milestones: 4.x, 5.x Mar 19, 2025
@boegel
Copy link
Member

boegel commented Mar 19, 2025

@ocaisa I changed to target branch in this PR from 5.0.x to develop, you should synchronize your PR branch with current develop branch (which has received a massive update after the release of EasyBuild v5.0.0, see #4825)

ext.toolchain.prepare(onlymod=self.cfg['onlytcmod'], silent=True, loadmod=False,
rpath_filter_dirs=self.rpath_filter_dirs)
rpath_filter_dirs=self.rpath_filter_dirs,
rpath_include_dirs=self.rpath_include_dirs,
Copy link
Member Author

@ocaisa ocaisa Apr 2, 2025

Choose a reason for hiding this comment

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

The omission of this in the original call looks like a bug to me, so I have added it back...but I can't be 100%

Copy link
Member Author

@ocaisa ocaisa Apr 2, 2025

Choose a reason for hiding this comment

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

It likely doesn't actually matter as the wrappers will probably already have been prepared by the time this is called by an extension.

Copy link
Member

Choose a reason for hiding this comment

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

Definitely a bug, I don't see a reason not to pass through rpath_include_dirs here.
See also call to self.toolchain.prepare in EasyBlock.prepare_step, where we do pass this down.

This is a genuine bug, and since this call to toolchain.prepare installs additional wrappers, the compiler wrapper from the parent is shadowed. Although I guess the RPATH wrapper script for the extension will use the RPATH wrapper script that was generated for the parent? Not sure about that (I'll check).

I'm a bit puzzled why this hasn't caused a whole bunch of problems, so it seems that somehow this hasn't actually been an issue in practice.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm pretty sure it has no impact, the wrappers have a protective clause to ensure that they do not wrap themselves.

Copy link
Member 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.

It has no impact for 2nd extension, where we'll pick up on wrapper created for first extension.

But the RPATH wrapper that was created for the "parent" will no longer be found (because the build environment is reset before build environment for first extension is set up), and so the installation of extensions will be done with an incorrect RPATH wrapper script in which rpath_include_dirs is not picked up.

That's bad since $ORIGIN/../lib & co are specified that way (see how self.rpath_wrappers_dir is defined in EasyBlock.prepare_step).

Copy link
Member

Choose a reason for hiding this comment

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

Hold on, the resetting of build environment before starting installation of extensions is not correct I think, I'm going through things in detail now.

Copy link
Member

Choose a reason for hiding this comment

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

The rpath_include_dirs mechanism was implemented in #2358, which shows that it's only picked up by the "parent" toolchain.prepare, the call to toolchain.prepare for extensions was overlooked. That confirms to me this is a genuine bug.

I'm still a bit puzzled why this doesn't cause real trouble though, or how it has flown under the radar...

@boegel boegel removed this from the 5.x.x milestone Apr 9, 2025
@boegel boegel added this to the 5.x milestone Apr 9, 2025
'rpath-filter': ("List of regex patterns to use for filtering out RPATH paths", 'strlist', 'store', None),
'rpath-override-dirs': ("Path(s) to be prepended when linking with RPATH (string, colon-separated)",
None, 'store', None),
'rpath-wrappers-dir': ("Absolute path to directory to use for RPATH wrappers creation/use",
Copy link
Member

Choose a reason for hiding this comment

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

Rather than adding an EasyBuild configuration option for this, we can just only give control over through an easyblock which can set self.rpath_wrappers_dir in the constructor, so there's no control from the outside to tweak the location of the generaed RPATH wrapper scripts.

Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

@ocaisa Bunch of changes proposed for this PR in ocaisa#47

boegel and others added 2 commits April 23, 2025 19:11
remove `--rpath-wrapper-dir` configuration option + copy `rpath_args.py` script to avoid that RPATH wrapper scripts rely on external script
Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

lgtm

@boegel boegel modified the milestones: 5.x, 5.0.1 Apr 23, 2025
@boegel boegel added bug fix and removed EasyBuild-5.0 EasyBuild 5.0 labels Apr 23, 2025
@boegel boegel changed the title Add capability to export RPATH wrappers for a toolchain allow specifying location for RPATH wrapper scripts via rpath_wrappers_dir + also pass rpath_include_dirs when preparing build environment for extensions Apr 23, 2025
@boegel boegel merged commit 8d8e70f into easybuilders:develop Apr 23, 2025
37 checks passed
@ocaisa ocaisa deleted the export_rpath_wrappers branch April 30, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants