Skip to content

Commit

Permalink
replace absolute paths to object files by relative ones
Browse files Browse the repository at this point in the history
  • Loading branch information
bedroge committed Jul 9, 2024
1 parent 064e3e2 commit c8256a3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions easybuild/easyblocks/o/openfoam.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ def configure_step(self):
regex_subs.append((r"^(CPP\s*(=|:=)\s*)/lib/cpp(.*)$", r"\1cpp\2"))
apply_regex_substitutions(fullpath, regex_subs)

# use relative paths to object files when compiling shared libraries
# in order to keep the build command short and to prevent "Argument list too long" errors
wmake_makefile_general = os.path.join(self.builddir, self.openfoamdir, 'wmake', 'makefiles', 'general')
if os.path.isfile(wmake_makefile_general):
objects_relpath_regex = (
# $(OBJECTS) is a list of absolute paths to all required object files
r'(\$\(LINKLIBSO\) .*) \$\(OBJECTS\)',
# we replace the absolute paths by paths relative to the current working directory
r'\1 $(subst $(WM_PROJECT_DIR),$(shell realpath --relative-to=$(PWD) $(WM_PROJECT_DIR)),$(OBJECTS))',
)
apply_regex_substitutions(wmake_makefile_general, [objects_relpath_regex])

# enable verbose build for debug purposes
# starting with openfoam-extend 3.2, PS1 also needs to be set
env.setvar("FOAM_VERBOSE", '1')
Expand Down

0 comments on commit c8256a3

Please sign in to comment.