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

Multithreaded perl on darwin #73819

Merged
merged 1 commit into from Feb 20, 2020
Merged

Conversation

knl
Copy link
Contributor

@knl knl commented Nov 20, 2019

Motivation for this change

note: the below text was set in place after all the fruitful discussion happening in this PR. Initially, it only said about enabling multithreaded perl on Darwin, which was not correct.

Perl on darwin (and any other sane platform) has a pretty good threading
support, enable it.

As it turns out, we were building non-multithreaded perl on all systems,
since glibc was not part of the stdenv anymore:

nix-repl> pkgs = import <nixpkgs> {}

nix-repl> pkgs.stdenv ? glibc
false

meaning that the comments were incorrect. Thus, clear up the confusion
and remove the misleading comments, while enabling multithreading by
default. The builds will fail on unsupported platforms, and in this case
the only place is the bootstrap, where we already force
non-multithreaded perl.

As a consequence of the above, this change will cause the full rebuild
of stdenv on all platforms, including linux.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @eelco @matthewbauer

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Nov 20, 2019
@knl knl changed the base branch from master to staging November 20, 2019 15:20
@knl
Copy link
Contributor Author

knl commented Nov 20, 2019

This is the output of result/bin/perl -V:

result/bin/perl -V
Summary of my perl5 (revision 5 version 30 subversion 0) configuration:

  Platform:
    osname=darwin
    osvers=darwin
    archname=darwin-thread-multi-2level
    uname='darwin x86_64 darwin '
    config_args='-de -Dcc=cc -Uinstallusrbinperl -Dinstallstyle=lib/perl5 -Duseshrplib -Dlocincpth=/no-such-path/include -Dloclibpth=/no-such-path/lib -Dusethreads -Dprefix=/nix/store/am4vsg0bdzy6w5cpmjmvha5r4l2jkxnf-perl-5.30.0 -Dman1dir=/nix/store/am4vsg0bdzy6w5cpmjmvha5r4l2jkxnf-perl-5.30.0/share/man/man1 -Dman3dir=/nix/store/am4vsg0bdzy6w5cpmjmvha5r4l2jkxnf-perl-5.30.0/share/man/man3'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -fno-strict-aliasing -pipe -fstack-protector-strong -I/no-such-path/include -DPERL_USE_SAFE_PUTENV'
    optimize='-O3'
    cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -fno-strict-aliasing -pipe -fstack-protector-strong -I/no-such-path/include'
    ccversion=''
    gccversion='4.2.1 Compatible Clang 7.1.0 (tags/RELEASE_710/final)'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -mmacosx-version-min=10.12 -fstack-protector-strong -L/no-such-path/lib'
    libpth=
    libs=-lpthread -ldbm -ldl -lm -lutil -lc
    perllibs=-lpthread -ldl -lm -lutil -lc
    libc=
    so=dylib
    useshrplib=true
    libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=bundle
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags=' -mmacosx-version-min=10.12 -bundle -undefined dynamic_lookup -L/no-such-path/lib -fstack-protector-strong'


Characteristics of this binary (from libperl):
  Compile-time options:
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_IMPLICIT_CONTEXT
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
    USE_THREAD_SAFE_LOCALE
  Built under darwin
  Compiled at Nov 20 2019 14:55:38
  @INC:
    /nix/store/am4vsg0bdzy6w5cpmjmvha5r4l2jkxnf-perl-5.30.0/lib/perl5/site_perl/5.30.0/darwin-thread-multi-2level
    /nix/store/am4vsg0bdzy6w5cpmjmvha5r4l2jkxnf-perl-5.30.0/lib/perl5/site_perl/5.30.0
    /nix/store/am4vsg0bdzy6w5cpmjmvha5r4l2jkxnf-perl-5.30.0/lib/perl5/5.30.0/darwin-thread-multi-2level
    /nix/store/am4vsg0bdzy6w5cpmjmvha5r4l2jkxnf-perl-5.30.0/lib/perl5/5.30.0

@knl knl force-pushed the multithreaded-perl-on-darwin branch 3 times, most recently from 305b177 to 768afea Compare January 20, 2020 10:40
@veprbl
Copy link
Member

veprbl commented Feb 9, 2020

This had become an stdenv rebuild on linux, which not supposed to be an effect here.

@knl I think you should investigate or revert to a previous version.

@basvandijk
Copy link
Member

@knl @veprbl apparently glibc is not an attribute of stdenv anymore:

nix-repl> pkgs = import <nixpkgs> {}

nix-repl> pkgs.stdenv ? glibc
false

So enableThreading defaulted to false on Linux. Since we now set it to true it requires rebuilding the world.

So this is to be expected and I think it's OK to merge.

Perl on darwin (and any other sane platform) has a pretty good threading
support, enable it.

As it turns out, we were building non-multithreaded perl on all systems,
since glibc was not part of the stdenv anymore:

    nix-repl> pkgs = import <nixpkgs> {}

    nix-repl> pkgs.stdenv ? glibc
    false

meaning that the comments were incorrect. Thus, clear up the confusion
and remove the misleading comments, while enabling multithreading by
default. The builds will fail on unsupported platforms, and in this case
the only place is the bootstrap, where we already force
non-multithreaded perl.

As a consequence of the above, this change will cause the full rebuild
of stdenv on all platforms, including linux.
@knl knl force-pushed the multithreaded-perl-on-darwin branch from ad62940 to b5b49ed Compare February 10, 2020 11:01
@basvandijk
Copy link
Member

@GrahamcOfBorg build perl

@FRidh FRidh requested a review from volth February 11, 2020 06:53
@FRidh FRidh added this to Needs review in Staging Feb 11, 2020
@FRidh FRidh merged commit 6d8539c into NixOS:staging Feb 20, 2020
Staging automation moved this from Needs review to Done Feb 20, 2020
veprbl added a commit that referenced this pull request Mar 9, 2020
Fixes: 6d8539c ('perl: Enable threading on darwin')
cc #73819
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Staging
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants