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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AnuroopsunddCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
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?
dominoPgrAuthor Commented:
i'm going to take another approach: install perl from scratch. Thanks for the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.