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

Update prepare_rpath_wrappers to enable wrapper shipping with a module (WIP) #4003

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

stderr-enst
Copy link

This WIP PR is part of a suggested feature to ship rpath wrappers e.g. with GCCcore.
More information in related issues and PRs:

This PR contains a first working version, with a couple of dirty hacks, so it is definitely not ready to be merged.

prepare_rpath_wrappers is currently preparing the wrappers in temporary directories. Wrappers are then used in the module's build step so far!
Updating prepare_rpath_wrappers to also install wrappers in the module install is maybe stretching the purpose of a single function.
Would you suggest that I refactor the code a bit to produce 2 smaller functions? One prepares wrappers for build, the other does installation. There is probably a bit of shared code though.

I'll also point out a specific section of the code in the comments below.

Tagging @boegel

Comment on lines 997 to 1005
if cmdDir is not None and os.path.exists(cmdDir):
orig_cmd = os.path.join(cmdDir,cmd)

# TODO: dirty hack to let module-shipped rpath wrappers point to EESSI software layer's ld
if cmdDir is not None and "ld" in cmd:
orig_cmd = which(cmd, retain_all=True)
orig_cmd = [a for a in orig_cmd if "/tmp" not in a][0]

self.log.debug("orig_cmd: %s", orig_cmd)
Copy link
Author

Choose a reason for hiding this comment

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

This section is a bit critical.
The original prepare_rpath_wrappers is using which to lookup ld and compiler commands to wrap with the newly created rpath wrapper.
But we want to wrap the compiler command of the e.g. GCCcore module that currently is build! So we cannot look it up in PATH and instead have to pass a new cmdDir to the function and decide to set it manually.
This might be a first good reason to split this function into two.

Second, in EESSI we ship ld in the software layer on CVMFS. We don't want to pick up any ld commands that exist in the current /tmp locations. They are still around during module building, so we have to put a dirty hack here.
I don't really like putting an EESSI special case into EasyBuild code.
Do we have a general approach to this kind of problem?
Maybe this calls for another manual path, from where to pick up ld?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused which usage of prepare_rpath_wrappers you're trying to target here with the exception for ld: the usage by EasyBuild when installing with --rpath? Or is it to prevent the ld wrappers from being installed for EESSI? In the latter case, I'd say we should indeed make the ld wrapper installation part of binutils (as was suggested in easybuilders/easybuild-easyblocks#2638). That means --filter-deps binutils is enough to (also) make sure the RPATH wrappers aren't installed (and I guess we filter binutils already in EESSI? Can't remember exactly...).

If it's more about EasyBuild when installing with --rpath (i.e. you're afraid that this will pick up the ld wrappers from the tempdir that EasyBuild creates), I'd have to think how to elegantly solve this. I agree with the statement that we don't want special case things for EESSI in the EasyBuild source code, it should be something generic.

I'm generally a bit confused what we do currently in EESSI: do we set RPATH with our own ld wrapper? Or do we rely on EasyBuild to set RPATH? I thought it was the latter, but then you'd still want it to generate wrappers when installing with --rpath, right?

@boegel boegel added enhancement EESSI Related to EESSI project labels May 4, 2022
@boegel boegel added this to the 4.x milestone May 4, 2022
@ocaisa
Copy link
Member

ocaisa commented Aug 5, 2024

@stderr-enst I'd like to take over what you've done here for a specific use case, I would like to create an updated buildenv easyblock that can ship the rpath wrappers (rather than inject them into GCC). It will also setup the typical build environment you'd need for ConfigureMake/CMakeMake (so Autotools, CMake, pkgconfig) and all the associated envvars. That should be good enough to allow people to build on top of EasyBuild without using EasyBuild itself (at least for the easier cases).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EESSI Related to EESSI project enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants