ajeet@perl has asked for the wisdom of the Perl Monks concerning the following question:

Hello Everybody..

I have problem regarding perl module installation.

I had downloaded a perl module from CPAN,while installation MakeFile.PL goes fine, but "make" creates problem, it reports me error about saying that "/usr/ucb/cc- Language optional software package not installed" , however i have gcc installed in my system(Solaris), Now i modified the environment to use gcc instead of cc, but again it reports error, something like below..

cp t1.pl blib/lib/Acme/t1.pl cp Damn.pm blib/lib/Acme/Damn.pm /usr/bin/perl /usr/local/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /us +r/local/lib/perl5/5.8.8/ExtUtils/typemap Damn.xs > Damn.xsc && mv Da +mn.xsc Damn.c cc -c -I. -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -I/ +usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_U +SE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -xO3 -xspace -xildoff -DVERS +ION=\"0.04\" -DXS_VERSION=\"0.04\" -KPIC "-I/usr/local/lib/perl5/5.8 +.8/sun4-solaris/CORE" Damn.c ucbcc: unrecognized option `-Xs' ucbcc: unrecognized option `-KPIC' ucbcc: language ildoff not recognized ucbcc: Damn.c: linker input file unused because linking not done ucbcc: -lucb: linker input file unused because linking not done ucbcc: -lsocket: linker input file unused because linking not done ucbcc: -lnsl: linker input file unused because linking not done ucbcc: -lelf: linker input file unused because linking not done ucbcc: -laio: linker input file unused because linking not done Running Mkbootstrap for Acme::Damn () chmod 644 Damn.bs rm -f blib/arch/auto/Acme/Damn/Damn.so cc -G -L/usr/local/lib -L/usr/lib Damn.o -o blib/arch/auto/Acme/Damn +/Damn.so \ \ ucbcc: Damn.o: No such file or directory ucbcc: unrecognized option `-Xs' *** Error code 1 make: Fatal error: Command failed for target `blib/arch/auto/Acme/Damn +/Damn.so'

I guess the command line switches supported by "cc" is not supported by "gcc",Please provide any solution...I dont want to install "cc",

I guess without installation also, One can use the perl module, by putting the module file in the same directory. This works for me, except one module "Acme::Damn", in which it says, can not found loadable for "Acme::Damn".... Please have some look into the matter and provide solution...as i can not move with my project without it..

Thanks in Advance

Replies are listed 'Best First'.
Re: CPAN Module Installation
by Corion (Patriarch) on Mar 24, 2010 at 13:40 UTC
    Please provide any solution...I dont want to install "cc",

    There is no solution. Either use a Perl compiled with gcc, then it can and will use gcc. Or use a Perl compiled with cc (the Sun C compiler), and install and use cc. Mixing C compilers does rarely work and needs special precautions. Perl knows which C compiler it was compiled with and will use that one.

Re: CPAN Module Installation
by almut (Canon) on Mar 24, 2010 at 13:40 UTC
    I guess the command line switches supported by "cc" is not supported by "gcc"

    Your guess is correct.  See also Installing Modules using CPAN.

    Generally, modules that have an XS component will need a compiler to build (no way around it, except if you can find a pre-built binary (.so file) for your platform and perl version).  And you save yourself a lot of trouble by installing the same compiler that your perl binary has been built with.

      So, is there any option by modifying the Makefile.pl file, forcing it to use gcc compiler?? or can i get any pre-built binary for Acme::Damn module..>I searched net badly, but unable to get a pointer on it.
Re: CPAN Module Installation
by marto (Cardinal) on Mar 24, 2010 at 13:43 UTC

    Does perl -V from the command line say that perl was build with cc? Sun ship Solaris with perl built with the Sun Workshop compiler, and Solaris (IIRC) doesn't ship with this but (again IIRC) does come with gcc out of the box. Ideally you want to be compiling modules with the same compiler which was used to build perl.

    On top of this my general advice is not to use the system perl, but download the source and 'roll your own'. Reason being that your OS uses this perl for systemy type things. Other apps (for example Oracle and BMC patrol) ship with their own perl as part of the distribution. This will ensure you don't run in to any OS/perl related issues and allow you to compile your own verson of perl compiled with your compiler of choice. You could install to somewhere like /opt/appname/perl.

    Perhaps it's time to talk to your sysadmin, I'm sure they'd be in favour of you not messing with the perl their OS uses, though they may simply download a build from sunfreeware or similar.

      perl -V shows that it is built for Sun Solaris and shows ld=cc here is a snap shot of perl -v

      Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=solaris, osvers=2.10, archname=sun4-solaris uname='sunos bikini-zone4.asd.mbalance.com 5.10 generic_118833-22 +sun4u sparc sunw,sun-fire-v210 ' config_args='-Dlibpth=/usr/local/lib /usr/lib -DPolicy=solaris2 -D +prefix=/usr/local -Dcc=cc -Dinstallprefix=/usr/local -Dccflags=-D_LAR +GEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -Doptimize=-xO3 -xsp +ace -xildoff -Dperladmin=support@mbalance.com -Dvendorprefix=/usr/loc +al -Dotherlibdirs=/usr/local/lib/perl5/site_perl/5.8.0 -desO' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_T +S_ERRNO -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS= +64 -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTE +NV -DPERL_USE_SAFE_PUTENV -DPERL_USE_SAFE_PUTENV', optimize='-xO3 -xspace -xildoff', cppflags='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO - +I/usr/local/include' ccversion='Sun C 5.8 2005/10/13', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib -L/usr/lib ' libpth=/usr/local/lib /usr/lib libs=-lsocket -lnsl -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib -L/usr/lib' Characteristics of this binary (from libperl): Compile-time options: PERL_MALLOC_WRAP PERL_USE_SAFE_PUTENV USE_LARGE_FILES USE_PERLIO Built under solaris Compiled at Jun 21 2007 13:08:59 %ENV: PERLLIB="/u01/app/netboss/unsup/perl/lib/5.6.0:/u01/app/netboss/un +sup/perl/lib/5.6.0/sun4-solaris:/u01/app/netboss/unsup/perl/lib/site_ +perl/5.6.0:/u01/app/netboss/unsup/perl/lib/site_perl/5.6.0/sun4-solar +is" @INC: /u01/app/netboss/unsup/perl/lib/5.6.0 /u01/app/netboss/unsup/perl/lib/5.6.0/sun4-solaris /u01/app/netboss/unsup/perl/lib/site_perl/5.6.0 /u01/app/netboss/unsup/perl/lib/site_perl/5.6.0/sun4-solaris /usr/local/lib/perl5/5.8.8/sun4-solaris /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/vendor_perl/5.8.8/sun4-solaris /usr/local/lib/perl5/vendor_perl/5.8.8 /usr/local/lib/perl5/vendor_perl /usr/local/lib/perl5/site_perl/5.8.0

      I am seriously screwed up with the installation of module, Your suggestion of using a seprate perl interpreter is best, but the work i m doing is in organization, and they dont want to rebuild/seprate build of perl interpreter, Now I have to install modules from CPAN, I am unable to do anything as of now, because i can not install modules, also installing from CPAN is not working, saying that something "unable to resolve host "...

        'also installing from CPAN is not working, saying that something "unable to resolve host "...'

        Network connectivity is a different problem, and somewhat unrelated to the fact that you still won't be able to compile modules, again speak to your sysadmin. If internet access is out of the question use CPAN::Mini on a machine which does have internet access to create a mirror when you could then use 'offline'.

        'but the work i m doing is in organization, and they dont want to rebuild/seprate build of perl interpreter, Now I have to install modules from CPAN'

        For clarity, I wasn't suggesting you rebuild Perl that Solaris uses, for the love of Zod leave that alone. I suggested that a separate build of perl be compiled using gcc. If your organisation can't see the benefit of this then this isn't an issue we can help you with.

        Compiling your code and required modules using pp on another solaris 10 server (it would need to be the same architecture) would be an option, if you can get access to a server were you can build perl and install modules. If not I guess you need to either raise the issue with your employer again, if they don't want to give you access to the right tools then they can't expect much.

Re: CPAN Module Installation
by jmcnamara (Monsignor) on Mar 24, 2010 at 16:58 UTC
      Thanks John...that was a wonderful option...but my perl interpreter is not compatible with it..
      Invalid perl version 5.008008, this module is for 5.005_03 and 5.6.1 o +nly

      any more option...most welcome