如何在AIX中编译Perl

AIX默认是不带编译器的,所以如果要自己编译Perl,需要先安装编译器。开源的gcc自然可以算是最佳选择。

在64位平台的AIX中,如果选择使用gcc来编译perl源代码,默认情况下是编译成32位的版本。这样在编译DBD::Oracle的时候也需要选择正确的32位库,否则无法编译成功。也可以选择将Perl编译成64位的,这样在64位平台上应该更方便些,很多依赖库的路径使用默认即可。

编译成32位Perl

$./Configure -des -Dprefix=/opt/perl  -Dcc=gcc
$make && make install

编译成64位Perl

$./Configure -des -Dprefix=/opt/perl  -Dcc='gcc -maix64'
$make && make install

注:gcc在linux下64位编译选项为-m64,在HP-UX下64位编译选项为-mlp64。不同平台下需要编译64位程序,选用不同的选项即可。为了确认编译后的版本,可以使用-V选项运行perl:

$./perl -V
Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
   
  Platform:
    osname=aix, osvers=5.3.0.0, archname=aix-64all
    uname='aix dbtest 3 5 00cad8cf4c00 '
    config_args='-des -Dprefix=/opt/perl -Dcc=gcc -maix64'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc -maix64 -maix64', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE 
-D_POSIX_SOURCE -DUSE_NATIVE_DLOPEN -fno-strict-aliasing -pipe 
-maix64 -DUSE_64_BIT_ALL',
    optimize='-O',
    cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE 
-DUSE_NATIVE_DLOPEN -fno-strict-aliasing -pipe'
    ccversion='', gccversion='4.2.0', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=87654321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc -maix64 -maix64', ldflags =' -Wl,-brtl -Wl,-bdynamic -Wl,-b64'
    libpth=/lib /usr/lib /usr/ccs/lib
    libs=-lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lc
    perllibs=-lbind -lnsl -ldl -lld -lm -lcrypt -lc
    libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, 
ccdlflags='-Xlinker -bE:/opt/perl/lib/5.10.1/aix-64all/CORE/perl.exp'
    cccdlflags=' ', lddlflags='  -Wl,-b64 -Wl,-bhalt:4 -Wl,
-G -Wl,-bI:$(PERL_INC)/perl.exp -Wl,
-bE:$(BASEEXT).exp -Wl,-bnoentry -lc -lm'


Characteristics of this binary (from libperl): 
  Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL
                        USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
  Built under aix
  Compiled at Dec  1 2009 19:48:22
  @INC:
    /opt/perl/lib/5.10.1/aix-64all
    /opt/perl/lib/5.10.1
    /opt/perl/lib/site_perl/5.10.1/aix-64all
    /opt/perl/lib/site_perl/5.10.1


无觅相关文章插件,快速提升流量

一条评论

  • At 2012.05.04 17:36, liubin said:

    你好,我在AIX6.1上用gcc重新安装了perl,也没有出错
    但是系统始终提示没有装perl
    #perl -V
    #ksh: perl: not found.
    # ls -l /usr/bin/perl
    lrwxrwxrwx 1 root system 26 May 04 17:05 /usr/bin/perl -> /usr/opt/perl5_64/bin/perl
    (/usr/opt/perl5_64/是安装路径)
    这是怎么回事呢?能解答一下吗?


    (Required)
    (Required, will not be published)