How to handle perl package installation error

I already have perl 5.8.4 installed. Now I'm trying to install pear package Compress-Raw-Zlib-2.049 on this unix host (SunOS). After download the paclage from cpan perl website, I following the step  to build:
     perl Makefile.PL
     make
then I got a lot of compile errors starting with following:
cc -c  -I./zlib-src  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO -xO3 -xspace -xildoff    -DVERSION=\"2.049\"  -DXS_V
ERSION=\"2.049\" -KPIC "-I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE"  -DNO_VIZ -DZ_SOLO   -DGZIP_OS_CODE=3 -DUSE_PPPORT_H Zlib.c
cc: unrecognized option `-KPIC'
cc: language ildoff not recognized

How can I fix above compile error?
dominoPgrAsked:
Who is Participating?
 
AnuroopsunddConnect With a Mentor Commented:
Solaris build fails with "gcc: unrecognized option `-KPIC'"
-----------------------------------------------------------

You are running Solaris and you get an error like this when you try to
build this Perl module

    gcc: unrecognized option `-KPIC'

This symptom usually means that you are using a Perl binary that has been
built with the Sun C compiler, but you are using gcc to build this module.

When Perl builds modules that need a C compiler, it will attempt to use
the same C compiler and command line options that was used to build perl
itself. In this case "-KPIC" is a valid option for the Sun C compiler,
but not for gcc. The equivalent option for gcc is "-fPIC".

The solution is either:

    1. Build both Perl and this module with the same C compiler, either
       by using the Sun C compiler for both or gcc for both.

    2. Try generating the Makefile for this module like this perl

           perl Makefile.PL CC=gcc CCCDLFLAGS=-fPIC OPTIMIZE=" " LD=gcc
           make test

       This second option seems to work when mixing a Perl binary built
       with the Sun C compiler and this module built with gcc. Your
       mileage may vary.


http://www.cpan.org/modules/by-module/Compress/Compress-Raw-Zlib-2.049.readme
0
 
AnuroopsunddCommented:
Solaris build fails with "language optional software package not installed"
---------------------------------------------------------------------------

If you are trying to build this module under Solaris and you get an
error message like this

    /usr/ucb/cc: language optional software package not installed

it means that Perl cannot find the C compiler on your system. The cryptic
message is just Sun's way of telling you that you haven't bought their
C compiler.

When you build a Perl module that needs a C compiler, the Perl build
system tries to use the same C compiler that was used to build perl
itself. In this case your Perl binary was built with a C compiler that
lived in /usr/ucb.

To continue with building this module, you need to get a C compiler,
or tell Perl where your C compiler is, if you already have one.

Assuming you have now got a C compiler, what you do next will be dependent
on what C compiler you have installed. If you have just installed Sun's
C compiler, you shouldn't have to do anything. Just try rebuilding
this module.

If you have installed another C compiler, say gcc, you have to tell perl
how to use it instead of /usr/ucb/cc.

This set of options seems to work if you want to use gcc. Your mileage
may vary.

    perl Makefile.PL CC=gcc CCCDLFLAGS=-fPIC OPTIMIZE=" "
    make test


http://www.cpan.org/modules/by-module/Compress/Compress-Raw-Zlib-2.049.readme
0
 
dominoPgrAuthor Commented:
Thanks for all your responses.

I tried the step:
perl Makefile.PL CC=gcc CCCDLFLAGS=-fPIC OPTIMIZE=" "
make test

Now I got following error:
>make test
gcc -c  -I./zlib-src  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO     -DVERSION=\"2.049\"  -DXS_VERSION=\"2.049\" -fPIC "-I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE"  -DNO_VIZ -DZ_SOLO   -DGZIP_OS_CODE=3 -DUSE_PPPORT_H Zlib.c
gcc: language arch=v8 not recognized

I can see CCFLAGS -xarch=v8 in the Makefile. Is there a equivalent compiler switch for arch=v8 in gcc?
0
 
dominoPgrAuthor Commented:
i'm going to take another approach: install perl from scratch. Thanks for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.