Skip to content

Substitution in R package recipe produces invalid LDFLAGS when R installation hash starts with "lz" #6078

Description

@w8jcik

The substitution in R package recipe
https://github.com/spack/spack-packages/blob/develop/repos/spack_repo/builtin/packages/r/package.py#L211

    @run_after("install")
    def copy_makeconf(self):
        # Ensure full library flags are included in Makeconf
        for _lib, _pkg in [
            ("lzma", "xz"),
            ("bz2", "bzip2"),
            ("z", "zlib-api"),
            ("tirpc", "libtirpc"),
            ("icuuc", "icu4c"),
        ]:
            filter_file(
                f"-l{_lib}",
                f"-L{self.spec[_pkg].libs.directories[0]} -l{_lib}",
                join_path(self.etcdir, "Makeconf"),
            )

        # Make a copy of Makeconf because it will be needed to properly build R
        # dependencies in Spack.
        src_makeconf = join_path(self.etcdir, "Makeconf")
        dst_makeconf = join_path(self.etcdir, "Makeconf.spack")
        install(src_makeconf, dst_makeconf)

replaces paths like this

r-4.6.1-lz2tzkvuubnqxzawnlbms2dt434elf3n

with malformed

r-4.6.1-L[...]spack/opt/spack/linux-skylake/zlib-ng-2.3.3-azwva5hzyxy2m4j2at2evdnaklj6sflh/lib -lz2tzkvuubnqxzawnlbms2dt434elf3n

All linking attempts against this installation fail afterwards

LDFLAGS = -Wl,-rpath,[...]spack/opt/spack/linux-skylake/r-4.6.1-L[...]spack/opt/spack/linux-skylake/zlib-ng-2.3.3-azwva5hzyxy2m4j2at2evdnaklj6sflh/lib -lz2tzkvuubnqxzawnlbms2dt434elf3n/rlib/R/lib

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions