Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile perl with DEBUG_LEAKING_SCALARS?

Tags:

perl

I am trying to install perl with -DDEBUG_LEAKING_SCALARS

perlbrew install perl-5.24.1 -DDEBUGGING -DDEBUG_LEAKING_SCALARS --as perl-debug-5.24.1

but without success:

$ perl -V | perl -MData::Dumper -e 'local $/; $_ = <>; $h{$1} = $2 while /(-(?:DDEBUGGING|DDEBUG_LEAKING_SCALARS))(?:=(.*?))?(?=\s|$)/g; print Dumper \%h'
$VAR1 = {
          '-DDEBUGGING' => undef,
          '-DDEBUG_LEAKING_SCALARS' => undef
        };
kes@work ~/work/projects/github-forks/perl5 $ perl -V
Summary of my perl5 (revision 5 version 24 subversion 1) configuration:

  Platform:
    osname=linux, osvers=4.4.0-57-generic, archname=x86_64-linux
    uname='linux work 4.4.0-57-generic #78-ubuntu smp fri dec 9 23:50:32 utc 2016 x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1 -DDEBUGGING -DDEBUG_LEAKING_SCALARS -Aeval:scriptdir=/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g',
    cppflags='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion='', gccversion='5.4.0 20160609', 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 =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.23.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.23'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME
                        USE_PERLIO USE_PERL_ATOF
  Locally applied patches:
    Devel::PatchPerl 1.38
  Built under linux
  Compiled at Mar  9 2017 15:21:39
  %ENV:
    PERL5LIB="/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/lib/perl5"
    PERLBREW="command perlbrew"
    PERLBREW_BASHRC_VERSION="0.76"
    PERLBREW_HOME="/home/kes/.perlbrew"
    PERLBREW_LIB="debug"
    PERLBREW_MANPATH="/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/man:/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/man"
    PERLBREW_PATH="/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/bin:/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin"
    PERLBREW_PERL="perl-debug-5.24.1"
    PERLBREW_ROOT="/home/kes/perl5/perlbrew"
    PERLBREW_VERSION="0.76"
    PERL_LOCAL_LIB_ROOT="/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug"
    PERL_MB_OPT="--install_base /home/kes/.perlbrew/libs/perl-debug-5.24.1@debug"
    PERL_MM_OPT="INSTALL_BASE=/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug"
  @INC:
    /home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/lib/perl5/x86_64-linux
    /home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/lib/perl5
    /home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1
    /home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1
    .

Also this show that perl is not compiled with required option:

$ perl -MConfig::Perl::V -MDDP -E 'p %{ Config::Perl::V::myconfig() }'
{
    build         {
        options   {
            DEBUGGING                           1,
            DEBUG_LEAKING_SCALARS               0,
            DEBUG_LEAKING_SCALARS_FORK_DUMP     0,
            DECCRTL_SOCKETS                     0,
            FAKE_THREADS                        0,
            FCRYPT                              0,
            HAS_TIMES                           1,
            HAVE_INTERP_INTERN                  0,
            MULTIPLICITY                        0,
            MYMALLOC                            0,
            NO_HASH_SEED                        0,
            NO_MATHOMS                          0,
            NO_TAINT_SUPPORT                    0,
            PERL_BOOL_AS_CHAR                   0,
            PERL_COPY_ON_WRITE                  1,
            PERL_DEBUG_READONLY_COW             0,
            PERL_DEBUG_READONLY_OPS             0,
            PERL_DISABLE_PMC                    0,
            PERL_DONT_CREATE_GVSV               1,
            PERL_EXTERNAL_GLOB                  0,
            PERL_GLOBAL_STRUCT                  0,
            PERL_GLOBAL_STRUCT_PRIVATE          0,
            PERL_HASH_FUNC_DJB2                 0,
            PERL_HASH_FUNC_MURMUR3              0,
            PERL_HASH_FUNC_ONE_AT_A_TIME        0,
            PERL_HASH_FUNC_ONE_AT_A_TIME_HARD   1,
            PERL_HASH_FUNC_ONE_AT_A_TIME_OLD    0,
            PERL_HASH_FUNC_SDBM                 0,
            PERL_HASH_FUNC_SIPHASH              0,
            PERL_HASH_FUNC_SUPERFAST            0,
            PERL_IMPLICIT_CONTEXT               0,
            PERL_IMPLICIT_SYS                   0,
            PERLIO_LAYERS                       1,
            PERL_IS_MINIPERL                    0,
            PERL_MAD                            0,
            PERL_MALLOC_WRAP                    1,
            PERL_MEM_LOG                        0,
            PERL_MEM_LOG_ENV                    0,
            PERL_MEM_LOG_ENV_FD                 0,
            PERL_MEM_LOG_NOIMPL                 0,
            PERL_MEM_LOG_STDERR                 0,
            PERL_MEM_LOG_TIMESTAMP              0,
            PERL_MICRO                          0,
            PERL_NEED_APPCTX                    0,
            PERL_NEED_TIMESBASE                 0,
            PERL_NEW_COPY_ON_WRITE              0,
            PERL_OLD_COPY_ON_WRITE              0,
            PERL_PERTURB_KEYS_DETERMINISTIC     0,
            PERL_PERTURB_KEYS_DISABLED          0,
            PERL_PERTURB_KEYS_RANDOM            0,
            PERL_POISON                         0,
            PERL_PRESERVE_IVUV                  1,
            PERL_RELOCATABLE_INCPUSH            0,
            PERL_SAWAMPERSAND                   0,
            PERL_TRACK_MEMPOOL                  0,
            PERL_USE_DEVEL                      0,
            PERL_USE_SAFE_PUTENV                0,
            PERL_USES_PL_PIDSTATUS              0,
            PL_OP_SLAB_ALLOC                    0,
            THREADS_HAVE_PIDS                   0,
            UNLINK_ALL_VERSIONS                 0,
            USE_ATTRIBUTES_FOR_PERLIO           0,
            USE_FAST_STDIO                      0,
            USE_HASH_SEED_EXPLICIT              0,
            USE_IEEE                            0,
            USE_ITHREADS                        0,
            USE_LARGE_FILES                     1,
            USE_LOCALE                          1,
            USE_LOCALE_COLLATE                  1,
            USE_LOCALE_CTYPE                    1,
            USE_LOCALE_NUMERIC                  1,
            USE_LOCALE_TIME                     1,
            USE_LONG_DOUBLE                     0,
            USE_NO_REGISTRY                     0,
            USE_PERL_ATOF                       1,
            USE_PERLIO                          1,
            USE_QUADMATH                        0,
            USE_REENTRANT_API                   0,
            USE_SFIO                            0,
            USE_SITECUSTOMIZE                   0,
            USE_SOCKS                           0,
            USE_64_BIT_ALL                      1,
            USE_64_BIT_INT                      1,
            VMS_DO_SOCKETS                      0,
            VMS_SHORTEN_LONG_SYMBOLS            0,
            VMS_SYMBOL_CASE_AS_IS               0
        },
        osname    "linux",
        patches   [
            [0] "Devel::PatchPerl 1.38"
        ],
        stamp     "Mar  9 2017 15:21:39"
    },
    config        {
        alignbytes                  8,
        api_subversion              0,
        api_version                 24,
        api_versionstring           "5.24.0",
        archlibexp                  "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1/x86_64-linux",
        archname                    "x86_64-linux",
        bincompat5005               undef,
        byteorder                   12345678,
        cc                          "cc",
        cccdlflags                  "-fPIC",
        ccdlflags                   "-Wl,-E",
        ccflags                     "-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
        ccversion                   "",
        config_args                 "-de -Dprefix=/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1 -DDEBUGGING -DDEBUG_LEAKING_SCALARS -Aeval:scriptdir=/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin",
        cppflags                    "-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include",
        d_dlsymun                   undef,
        dlext                       "so",
        d_longdbl                   "define",
        d_longlong                  "define",
        dlsrc                       "dl_dlopen.xs",
        dont_use_nlink              undef,
        doublesize                  8,
        d_readlink                  "define",
        d_sfio                      undef,
        d_sigaction                 "define",
        d_symlink                   "define",
        exe_ext                     "",
        gccosandvers                "",
        gccversion                  "5.4.0 20160609",
        git_branch                  "",
        git_commit_id               "",
        git_commit_id_title         "",
        git_describe                "",
        git_snapshot_date           undef,
        git_uncommitted_changes     "",
        gnulibc_version             2.23,
        hint                        "recommended",
        inc_version_list            " ",
        intsize                     4,
        ivsize                      8,
        ivtype                      "long",
        ld                          "cc",
        lddlflags                   "-shared -O2 -g -L/usr/local/lib -fstack-protector-strong",
        ldflags                     " -fstack-protector-strong -L/usr/local/lib",
        ldlibpthname                "LD_LIBRARY_PATH",
        libc                        "libc-2.23.so",
        libperl                     "libperl.a",
        libpth                      "/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64",
        libs                        "-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc",
        longdblsize                 16,
        longlongsize                8,
        longsize                    8,
        lseeksize                   8,
        lseektype                   "off_t",
        myuname                     "linux work 4.4.0-57-generic #78-ubuntu smp fri dec 9 23:50:32 utc 2016 x86_64 x86_64 x86_64 gnulinux ",
        nvsize                      8,
        nvtype                      "double",
        optimize                    "-O2 -g",
        osname                      "linux",
        osvers                      "4.4.0-57-generic",
        package                     "perl5",
        patchlevel                  24,
        path_sep                    ":",
        perllibs                    "-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc",
        perl_patchlevel             "",
        privlibexp                  "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1",
        prototype                   "define",
        ptrsize                     8,
        revision                    5,
        scriptdir                   "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin",
        sitearchexp                 "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1/x86_64-linux",
        sitelibexp                  "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1",
        so                          "so",
        subversion                  1,
        useithreads                 undef,
        uselargefiles               "define",
        uselongdouble               undef,
        usemultiplicity             undef,
        usemymalloc                 "n",
        useperlio                   "define",
        useposix                    "true",
        useshrplib                  "false",
        usesocks                    undef,
        usevendorprefix             undef,
        use64bitall                 "define",
        use64bitint                 "define",
        version                     "5.24.1",
        version_patchlevel_string   "version 24 subversion 1"
    },
    derived       {
        Off_t   "off_t",
        patch   "",
        uname   "linux work 4.4.0-57-generic #78-ubuntu smp fri dec 9 23:50:32 utc 2016 x86_64 x86_64 x86_64 gnulinux "
    },
    environment   {
        PERLBREW                  "command perlbrew",
        PERLBREW_BASHRC_VERSION   0.76,
        PERLBREW_HOME             "/home/kes/.perlbrew",
        PERLBREW_LIB              "debug",
        PERLBREW_MANPATH          "/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/man:/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/man",
        PERLBREW_PATH             "/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/bin:/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin",
        PERLBREW_PERL             "perl-debug-5.24.1",
        PERLBREW_ROOT             "/home/kes/perl5/perlbrew",
        PERLBREW_VERSION          0.76,
        PERL_LOCAL_LIB_ROOT       "/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug",
        PERL_MB_OPT               "--install_base /home/kes/.perlbrew/libs/perl-debug-5.24.1@debug",
        PERL_MM_OPT               "INSTALL_BASE=/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug",
        PERL5LIB                  "/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/lib/perl5"
    },
    inc           [
        [0] "/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/lib/perl5/x86_64-linux",
        [1] "/home/kes/.perlbrew/libs/perl-debug-5.24.1@debug/lib/perl5",
        [2] "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1/x86_64-linux",
        [3] "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1",
        [4] "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1/x86_64-linux",
        [5] "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1",
        [6] "."
    ]
}

How to compile perl with DEBUG_LEAKING_SCALARS?

like image 847
Eugen Konkov Avatar asked Mar 11 '17 15:03

Eugen Konkov


1 Answers

The doc has error. To compile perl with this option on you should use next command:

perlbrew install perl-5.24.1 -DDEBUGGING -Accflags=-DDEBUG_LEAKING_SCALARS -j9 --as perl-debug-5.24.1

I have found this info from this commit

UPD
DOC was fixed at commit #b49862865 by David Mitchell. Thanks

like image 158
Eugen Konkov Avatar answered Oct 16 '22 23:10

Eugen Konkov