2017-01-19 36 views
1

我想在AIX 7.2上從CPAN構建Encode 2.88-3。在化妝測試階段,我收到各種錯誤關於未知字符:Perl:未知的charname N {alpha}

Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 499. 
Unknown charname 'alpha' at t/Encode.t line 44, within string 
BEGIN not safe after errors--compilation aborted at t/Encode.t line 148. 
t/Encode.t ................. 
Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 459. 
Unknown charname 'LATIN SMALL LETTER SHARP S' at t/encoding.t line 77, within string 
BEGIN not safe after errors--compilation aborted at t/encoding.t line 165. 
t/encoding.t ............... 

Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 459. 
Unknown charname 'POUND SIGN' at t/mime-header.t line 166, within string 
Execution of t/mime-header.t aborted due to compilation errors. 
# Looks like your test exited with 2 just after 1. 
t/mime-header.t ............ 

爲了檢驗這是否是一個AIX的問題或與編碼,測試用例的問題,我試圖建立我的Linux系統上的相同版本(Ubuntu的14.04),其中Encode安裝得很好。

要挑選的第一個錯誤:

is "\N{alpha}",substr($uni,0,1),"alpha does not map to symbol 'a'"; 

看來AIX Perl是無法找到\ N {}字母字符。我在這裏有點迷路 - Perl通常在哪裏搜索這樣的字符?

我需要一個暗示我必須尋找這個問題的方向。有人可以提供一些調試技巧?

perl -V 
Summary of my perl5 (revision 5 version 20 subversion 1) configuration: 

    Platform: 
    osname=aix, osvers=6.1.0.0, archname=aix-thread-multi 
    uname='aix blade08 1 6 00003c3ad100 ' 
    config_args='-d -Dprefix=/usr/opt/perl5 -Dcc=xlc_r -Duseshrplib -Dusethreads' 
    hint=recommended, useposix=true, d_sigaction=define 
    useithreads=define, usemultiplicity=define 
    use64bitint=undef, use64bitall=undef, uselongdouble=undef 
    usemymalloc=n, bincompat5005=undef 
    Compiler: 
    cc='xlc_r -q32', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias -qlanglvl=extc99 -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -q32 -D_LARGE_FILES', 
    optimize='-O', 
    cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias -qlanglvl=extc99 -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT' 
    ccversion='12.1.0.9', gccversion='', gccosandvers='' 
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 
    alignbytes=8, prototype=define 
    Linker and Libraries: 
    ld='ld', ldflags =' -brtl -bdynamic -b32' 
    libpth=/lib /usr/lib /usr/ccs/lib 
    libs=-lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lpthreads -lc 
    perllibs=-lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc 
    libc=, so=a, useshrplib=true, libperl=libperl.a 
    gnulibc_version='' 
    Dynamic Linking: 
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -bE:/usr/opt/perl5/lib/5.20.1/aix-thread-multi/CORE/perl.exp' 
    cccdlflags=' ', lddlflags='-bhalt:4 -G -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -bnoentry -lpthreads -lc -lm' 


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_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 aix 
    Compiled at Feb 6 2015 14:54:29 
    %ENV: 
    PERL5LIB="/home/perl_ss/perl5/lib/perl5/aix-thread-multi:/home/perl_ss/perl5/lib/perl5:/usr/local/lib/site_perl/5.8.8:/usr/local/site_perl/common" 
    PERL5OPT="" 
    PERL5_CPANPLUS_IS_RUNNING="9961732" 
    PERL5_CPAN_IS_RUNNING="9961732" 
    PERL_LOCAL_LIB_ROOT="/home/perl_ss/perl5" 
    PERL_MB_OPT="--install_base /home/perl_ss/perl5" 
    PERL_MM_OPT="INSTALL_BASE=/home/perl_ss/perl5" 
    @INC: 
    /home/perl_ss/perl5/lib/perl5/aix-thread-multi 
    /home/perl_ss/perl5/lib/perl5/aix-thread-multi 
    /home/perl_ss/perl5/lib/perl5 
    /usr/local/lib/site_perl/5.8.8/aix-thread-multi 
    /usr/local/lib/site_perl/5.8.8 
    /usr/local/site_perl/common 
    /usr/opt/perl5/lib/site_perl/5.20.1/aix-thread-multi 
    /usr/opt/perl5/lib/site_perl/5.20.1 
    /usr/opt/perl5/lib/5.20.1/aix-thread-multi 
    /usr/opt/perl5/lib/5.20.1 
    /usr/opt/perl5/lib/site_perl/5.8.8 
    /usr/opt/perl5/lib/site_perl 

UPDATE: 問題的進一步檢查使我的結論是,編碼這可能不相關。我啓動了我的調試器並執行了一些測試。請注意如何字符\ N {希臘:阿爾法}在Linux平臺中,但不能在AIX: AIX 7.2:

DB<1> use charnames qw(greek) 

    DB<2> print "\N{alpha}" 
Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 459. 
[...] 
Unknown charname 'alpha' at (eval 9)[/usr/opt/perl5/lib/5.20.1/perl5db.pl:732] line 2, within string 

    DB<3> print "\N{U+03B1}" 
Wide character in print at (eval 10)[/usr/opt/perl5/lib/5.20.1/perl5db.pl:732] line 2. 
[...] 

    DB<4> print "\N{greek:alpha}" 
Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 459. 
[...] 
Unknown charname 'greek:alpha' at (eval 11)[/usr/opt/perl5/lib/5.20.1/perl5db.pl:732] line 2, within string 

的Ubuntu 14.04

DB<1> use charnames qw(greek) 

DB<2> print "\N{alpha}" 
Unknown charname 'alpha' at (eval 8)[/usr/share/perl/5.18/perl5db.pl:732] line 2, within string 

DB<3> print "\N{U+03B1}" 
Wide character in print at (eval 9)[/usr/share/perl/5.18/perl5db.pl:732] line 2. 


DB<4> print "\N{greek:alpha}" 
Wide character in print at (eval 10)[/usr/share/perl/5.18/perl5db.pl:732] line 2. 

想有東西弄亂了與AIX字符表?

UPDATE 2: 我開始深究這一點。

Name.pl中缺少AIX:

[email protected]:/usr/opt/perl5/lib/5.20.1/unicore $ ls 
Blocks.txt   Decomposition.pl Name.pm    SpecialCasing.txt UCD.pl 
CombiningClass.pl Heavy.pl   NamedSequences.txt To     lib 

與Linux不同:

[email protected]:/usr/share/perl/5.18/unicore $ ls 
Blocks.txt   Decomposition.pl lib     Name.pl SpecialCasing.txt UCD.pl 
CombiningClass.pl Heavy.pl   NamedSequences.txt Name.pm To     version 
+0

重新「*我想從CPAN *打造編碼2.88-3」,有CPAN上沒有這樣的事情。 – ikegami

+0

構建Perl時,表是從Unicode數據庫(定義字符及其屬性的文本文件集合)構建的。這是這些文件的問題。不知道該怎麼辦。你有沒有嘗試將Perl安裝到你的主目錄而不是搞亂系統'perl'? – ikegami

回答

1

我想通了。 AIX上的錯誤出現了,因爲無論出於何種原因,在AIX 7.2中都缺少unicore/Name.pl

由於Name.pl是在編譯perl的過程中生成的,因此在AIX系統上找不到必需的程序mktables,因爲我似乎沒有提供打包的perl。

解決方法: 將從CPAN安裝的perl-Version下載到臨時目錄中。在AIX 7.2上,我有perl 5.20,所以我從cpan下載perl 5.20(http://www.cpan.org/src/)。

提取它,並cd到lib/unicore。在那裏你可以找到mktables程序。 然後生成Unicode文件:

chmod 755 mktables 
./mktables 

這產生一堆文件,包括Name.pl.我將所有新生成的文件與我的系統perl中的文件進行了比較,結果發現沒有區別,所以我只將Name.pl複製到我的系統unicore-path中。錯誤消失了。

+0

mktables包含在perl源文件中,但不會被複制到安裝目錄中(在任何平臺上),因爲它不需要運行perl,僅用於構建它。您應該使用'perlbug'實用程序提交錯誤報告,這樣維護人員就可以找出爲什麼unicore/Name.pl沒有生成並且可以修復它。 – ThisSuitIsBlackNot

0

雖然我同意分配存在問題,但需要在上游進行修復。我非常感謝所提供的答案,幫助我解決了手頭的問題。

對於我來說,它看起來像:

wget http://www.cpan.org/src/5.0/perl-5.20.1.tar.gz 
gunzip -c ../perl-5.20.1.tar.gz | tar xvf - 
cd perl-5.20.1/lib/unicore/ 
chmod 755 ./mktables 
./mktables # Note there is no output... just wait. It will complete 
sudo cp Name.pl /usr/opt/perl5/lib/5.20.1/unicore 

而生命是和好如初