Hi Ben,

On 25/09/15 04:09, Ben Roberts wrote:
Hi list,

A colleague and I have noticed that the Perl easyblock forces inclusion of the 
“-Dusethreads” compiler directive. This has caused us some difficulty in which 
a package requiring threads, forks and MPI dies a gruesome death to do with 
pthreads. An experimental build of Perl without “-Dusethreads” doesn’t exhibit 
the same problem. We’re therefore looking at ways of using Easybuild to build a 
non-threaded Perl, and can think of two options: removing “-Dusethreads” as a 
default configuration option and allowing maintainers of easyconfig to add it 
in within configopts, or adding an extra option with a corresponding new if 
condition in the easyblock itself.

I would prefer the first option. Use of interpreter-based threads in Perl is 
noted to be discouraged (http://perldoc.perl.org/threads.html), and the former 
option will be easier for writers of new easyconfigs to implement insofar as 
they won’t have to consult a strange custom option. However, removing 
“-Dusethreads” as the default would affect backwards compatibility, so I was 
interested in getting feedback before I commit to one option or the other.

Any thoughts or opinions on the subject?

Removing it from the easyblock and making people add it to 'configopts' in their easyconfig files is one way, but is indeed backward incompatible.

A better way would be to introduce a new easyconfig parameter that is specific to the Perl easyblock (for example, 'usethreads'), and have the default set to True. If you want to build Perl without it, you can simply add 'usethreads = False' in your easyconfig file. When stuff is hardcoded in easyblocks, it's mostly because of laziness that there's no easyconfig parameter for it yet to turn it off...

Everybody happy: no backwards incompatible changes, and you get the flexibility you need?

Quick and dirty (and untested), you need to add something like this to the Perl easyblock:

from easybuild.framework.easyconfig import CUSTOM

...

class EB_Perl(ConfigureMake):
    ...

    @staticmethod
    def extra_options(extra_vars=None):
        """Extra easyconfig parameters specific to Perl easyblock."""
        extra_vars = EasyBlock.extra_options(extra_vars)
        extra_vars.update({
'usethreads': [True, "Configure with -Dusethreads included", CUSTOM],
        })
        return extra_vars

    ...

    def configure_step(self):
    """
Configure Perl build: run ./Configure instead of ./configure with some different options
    """
    configopts = [
        self.cfg['configopts'],
        '-Dcc="%s"' % os.getenv('CC'),
        '-Dccflags="%s"' % os.getenv('CFLAGS'),
        '-Dinc_version_list=none',
    ]
    if self.cfg['usethreads']:
        configopts.append("-Dusethreads")

cmd = './Configure -de %s -Dprefix="%s" ' % (' '.join(configopts), self.installdir)
    run_cmd(cmd, log_all=True, simple=True)



regards,

Kenneth

Reply via email to