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

Open
wants to merge 1 commit into
base: staging
from
Open

Conversation

@knl
Copy link
Contributor

knl commented Nov 20, 2019

Motivation for this change

Perl on Darwin should be multithreaded, as any other install method brings multithreaded perl.

This change also fixes one of the failing builds needed when rebuilding perl.

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 label Nov 20, 2019
@knl knl changed the base branch from master to staging Nov 20, 2019
@@ -1,11 +1,11 @@
{ config, lib, stdenv, fetchurl, pkgs, buildPackages, callPackage
, enableThreading ? stdenv ? glibc, coreutils, makeWrapper
, enableThreading ? true, coreutils, makeWrapper

This comment has been minimized.

Copy link
@basvandijk

basvandijk Nov 20, 2019

Member

Wouldn't it make sense to change the default to (stdenv.isDarwin or (stdenv ? glibc))?

This comment has been minimized.

Copy link
@knl

knl Nov 20, 2019

Author Contributor

I followed the text in the comment below, which says it defaults to true. Then I leave it to the assertion to pick it up. Realistically, perl is multithreaded on almost all platforms that Nix supports.

This comment has been minimized.

Copy link
@LnL7

LnL7 Nov 20, 2019

Member

The assertion makes it impossible to override, it's generally only done to ensure optional dependencies are available, etc.

This comment has been minimized.

Copy link
@knl

knl Nov 25, 2019

Author Contributor

What do you think about removing the assertion altogether? Perl can be multithreaded on all platforms Nix supports, except in a special case of bootstrapping. Thus, I'd suggest defaulting to true on enableThreading and removing the assertion.

@knl

This comment has been minimized.

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
@veprbl veprbl removed the 6.topic: ruby label Nov 21, 2019
@knl knl force-pushed the knl:multithreaded-perl-on-darwin branch 2 times, most recently from 7990ae5 to 305b177 Jan 20, 2020
Perl on darwin has a pretty good threading support, enable it.
@knl knl force-pushed the knl:multithreaded-perl-on-darwin branch from 305b177 to 768afea Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.