Skip to content

Commit

Permalink
Merge pull request easybuilders#3388 from bedroge/openfoam_objects_re…
Browse files Browse the repository at this point in the history
…lative_paths

use relative paths to object files when compiling shared libraries in the OpenFOAM easyblock
  • Loading branch information
ocaisa authored Jul 30, 2024
2 parents 2e2d6a3 + c8256a3 commit 0cb2cc9
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 0cb2cc9

Please sign in to comment.