위키로그:2014/11/14 - Perl은 어떻게 빌드 설정을 출력할까?

From PGWiki

문득 perl -V를 실행했을 때 나오는 빌드 옵션들이 어떤 식으로 출력되는지가 궁금해졌다.

아래는 아치 리눅스 상에서 수행한 결과다.

[potatogim@Potato-Arch ~]$ perl -V
Summary of my perl5 (revision 5 version 20 subversion 1) configuration:
   
  Platform:
    osname=linux, osvers=3.16.2-1-arch, archname=x86_64-linux-thread-multi
    uname='linux mnt-chroots-arch-extra-x86_64-flo-64 3.16.2-1-arch #1 smp preempt sat sep 6 13:12:51 cest 2014 x86_64 gnulinux '
    config_args='-des -Dusethreads -Duseshrplib -Doptimize=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -Dprefix=/usr -Dvendorprefix=/usr -Dprivlib=/usr/share/perl5/core_perl -Darchlib=/usr/lib/perl5/core_perl -Dsitelib=/usr/share/perl5/site_perl -Dsitearch=/usr/lib/perl5/site_perl -Dvendorlib=/usr/share/perl5/vendor_perl -Dvendorarch=/usr/lib/perl5/vendor_perl -Dscriptdir=/usr/bin/core_perl -Dsitescript=/usr/bin/site_perl -Dvendorscript=/usr/bin/vendor_perl -Dinc_version_list=none -Dman1ext=1perl -Dman3ext=3perl -Dcccdlflags='-fPIC' -Dlddlflags=-shared -Wl,-O1,--sort-common,--as-needed,-z,relro -Dldflags=-Wl,-O1,--sort-common,--as-needed,-z,relro'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.9.1', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/include-fixed /usr/lib /lib/../lib /usr/lib/../lib /lib /lib64 /usr/lib64
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=libc-2.19.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.19'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        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_PERLIO
                        USE_PERL_ATOF USE_REENTRANT_API
  Built under linux
  Compiled at Sep 15 2014 14:11:33
  %ENV:
    PERL5LIB="/home/potatogim/perl5/lib/perl5:/home/potatogim/perl5/lib/perl5"
    PERL_LOCAL_LIB_ROOT="/home/potatogim/perl5:/home/potatogim/perl5"
    PERL_MB_OPT="--install_base "/home/potatogim/perl5""
    PERL_MM_OPT="INSTALL_BASE=/home/potatogim/perl5"
  @INC:
    /home/potatogim/perl5/lib/perl5/x86_64-linux-thread-multi
    /home/potatogim/perl5/lib/perl5
    /home/potatogim/perl5/lib/perl5/x86_64-linux-thread-multi
    /home/potatogim/perl5/lib/perl5
    /usr/lib/perl5/site_perl
    /usr/share/perl5/site_perl
    /usr/lib/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib/perl5/core_perl
    /usr/share/perl5/core_perl
    .

빌드 과정에서 정적으로 들어가는건가? 싶어서 perl5 저장소에서 코드를 내려받아 문자열 검색을 해봤다.

[potatogim@Potato-Arch perl5]$ grep -R "Summary of my" .
./plan9/myconfig.plan9:Summary of my $package ($baserev version $PERL_VERSION subversion $PERL_SUBVERSION) configuration:
./myconfig.SH:Summary of my $package (revision $revision $version_patchlevel_string) configuration:
./vms/myconfig.com:$ ECHO "Summary of my ''$package' (version ''$PATCHLEVEL' subversion ''$SUBVERSION') configuration:"
./cpan/Config-Perl-V/V.pm:    if ($pv =~ m/^Summary of my\s+(\S+)\s+\(\s*(.*?)\s*\)/m) {
./cpan/Config-Perl-V/t/25_plv5162.t:Summary of my perl5 (revision 5 version 16 subversion 2) configuration:
./cpan/Config-Perl-V/t/25_plv516.t:Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
./cpan/Config-Perl-V/t/26_plv5182.t:Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
./cpan/Config-Perl-V/t/20_plv56.t:Summary of my perl5 (revision 5.0 version 6 subversion 2) configuration:
./cpan/Config-Perl-V/t/21_plv58.t:Summary of my perl5 (revision 5 version 8 subversion 9) configuration:
./cpan/Config-Perl-V/t/27_plv5200.t:Summary of my perl5 (revision 5 version 20 subversion 0) configuration:
./cpan/Config-Perl-V/t/22_plv510.t:Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
./cpan/Config-Perl-V/t/24_plv514.t:Summary of my perl5 (revision 5 version 14 subversion 2) configuration:
./cpan/Config-Perl-V/t/26_plv518.t:Summary of my perl5 (revision 5 version 18 subversion 0) configuration:
./cpan/Config-Perl-V/t/23_plv512.t:Summary of my perl5 (revision 5 version 12 subversion 2) configuration:
./t/run/switches.t:	  qr/\ASummary of my perl5 .*configuration:/,
[potatogim@Potato-Arch perl5]$ 

몇 개의 파일들이 나오는데 딱봐도 수상한 myconfig.SH라는 녀석이 보인다...

26 # This script is designed to provide a handy summary of the configuration
27 # information being used to build perl. This is especially useful if you
28 # are requesting help from comp.lang.perl.misc on usenet or via mail.
29 
30 # Note that the text lines /^Summary of/ .. /^\s*$/ are copied into Config.pm.
31 cat <<'!NO!SUBS!'
32 Summary of my $package (revision $revision $version_patchlevel_string) configuration:
33   $git_commit_id_title $git_commit_id$git_ancestor_line
34   Platform:
35     osname=$osname, osvers=$osvers, archname=$archname
36     uname='$myuname'
37     config_args='$config_args'
38     hint=$hint, useposix=$useposix, d_sigaction=$d_sigaction
39     useithreads=$useithreads, usemultiplicity=$usemultiplicity
40     use64bitint=$use64bitint, use64bitall=$use64bitall, uselongdouble=$uselongdouble
41     usemymalloc=$usemymalloc, bincompat5005=undef
42   Compiler:
43     cc='$cc', ccflags ='$ccflags',
44     optimize='$optimize',
45     cppflags='$cppflags'
46     ccversion='$ccversion', gccversion='$gccversion', gccosandvers='$gccosandvers'
47     intsize=$intsize, longsize=$longsize, ptrsize=$ptrsize, doublesize=$doublesize, byteorder=$byteorder, doublekind=$doublekind
48     d_longlong=$d_longlong, longlongsize=$longlongsize, d_longdbl=$d_longdbl, longdblsize=$longdblsize, longdblkind=$longdblkind
49     ivtype='$ivtype', ivsize=$ivsize, nvtype='$nvtype', nvsize=$nvsize, Off_t='$lseektype', lseeksize=$lseeksize
50     alignbytes=$alignbytes, prototype=$prototype
51   Linker and Libraries:
52     ld='$ld', ldflags ='$ldflags'
53     libpth=$libpth
54     libs=$libs
55     perllibs=$perllibs
56     libc=$libc, so=$so, useshrplib=$useshrplib, libperl=$libperl
57     gnulibc_version='$gnulibc_version'
58   Dynamic Linking:
59     dlsrc=$dlsrc, dlext=$dlext, d_dlsymun=$d_dlsymun, ccdlflags='$ccdlflags'
60     cccdlflags='$cccdlflags', lddlflags='$lddlflags'

30번 줄에 모든 설명이 있다.

허허허...

Potatogim (토론) 2014년 11월 14일 (금) 16:48 (KST)



blog comments powered by Disqus