fintanr's weblog

Archives

« April 2005 »
MonTueWedThuFriSatSun
    
2
3
4
6
8
9
10
11
12
13
14
15
16
17
21
22
23
24
25
28
29
30
 
       
Today

the links




Twitter Updates

    follow me on Twitter
















    20050418 Monday April 18, 2005

    perlgcc
    One of the more common complaints that you hear from people regarding perl on Solaris is that you need the Sun CC compiler to compile modules. This was addressed quite some time ago, but as I generally have cc available I never really notice the issue. Or I didn't until about ten minutes ago.

    I need a local copy of Expect.pm for some stuff I'm working on, so I went off to compile up IO::Tty which is required by the Expect.pm module. And as I typed make I get the following.

    /usr/bin/perl /usr/perl5/5.8.4/lib/ExtUtils/xsubpp  -typemap 
    /usr/perl5/5.8.4/lib/ExtUtils/typemap  Tty.xs > Tty.xsc && mv Tty.xsc Tty.c
    cc -c    -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -xO3 -xspace -xildoff    
    -DVERSION=\"1.02\"  -DXS_VERSION=\"1.02\" -KPIC 
    "-I/usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE"  -DHAVE_DEV_PTMX -DHAVE_GRANTPT 
    -DHAVE_PTSNAME -DHAVE_SIGACTION -DHAVE_STRLCPY -DHAVE_SYS_STROPTS_H -DHAVE_TERMIOS_H 
    -DHAVE_TERMIO_H -DHAVE_TTYNAME -DHAVE_UNLOCKPT Tty.c
    cc: unrecognized option `-KPIC'
    cc: language ildoff not recognized
    cc: Tty.c: linker input file unused because linking not done
    Running Mkbootstrap for IO::Tty ()
    chmod 644 Tty.bs
    rm -f blib/arch/auto/IO/Tty/Tty.so
    LD_RUN_PATH="" cc  -G Tty.o  -o blib/arch/auto/IO/Tty/Tty.so
    cc: Tty.o: No such file or directory
    cc: no input files
    *** Error code 1
    make: Fatal error: Command failed for target `blib/arch/auto/IO/Tty/Tty.so'
    
    Basically whats happened here is that perl is compiled with the Sun compilers, and I'm trying to compile this module with gcc from /usr/sfw/bin. And perl doesn't like this (you can go take a look at /usr/perl5/5.8.4/lib/i86pc-solaris-64int/Config.pm for all the gory detail).

    Anyway the work around is to use a handy little script bundled in Solaris called perlgcc, so rather than your normal perl Makefile.PL; make; make test; make install you do

    /usr/perl5/5.8.4/bin/perlgcc Makefile.PL; make
    
    and away you go. As an aside -KPIC is an option for generating position idependent code, and is dealt with in a lot more detail in the linkers and libraries documentation.
    (2005-04-17 22:51:03.0) Permalink Comments [2]