vishi has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I am trying to install Perl modules on my local home directory (as I do not have root/su permission on the server). I am able to generate the Makefile without any issues, but when I try to run

make install

I get the following error:

/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/ +perl5/5.8.8/ExtUtils/typemap Tty.xs > Tty.xsc && mv Tty.xsc Tty.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdecla +ration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FI +LE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTI +FY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 +-m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DVERS +ION=\"1.10\" -DXS_VERSION=\"1.10\" -fPIC "-I/usr/lib/perl5/5.8.8/i386 +-linux-thread-multi/CORE" -DHAVE_DEV_PTMX -DHAVE_GETPT -DHAVE_GRANTP +T -DHAVE_OPENPTY -DHAVE_POSIX_OPENPT -DHAVE_PTSNAME -DHAVE_PTSNAME_R +-DHAVE_PTY_H -DHAVE_SIGACTION -DHAVE_SYS_STROPTS_H -DHAVE_TERMIOS_H - +DHAVE_TERMIO_H -DHAVE_TTYNAME -DHAVE_UNLOCKPT Tty.c cc1: error: unrecognized command line option "-fstack-protector" cc1: error: invalid parameter `ssp-buffer-size' Tty.c:1: error: bad value (generic) for -mtune= switch

Now, I have used the "search" feature on this site and I came up with this thread. I believe I have a similar issue on hand, but I'm a little confused on what compiler Perl is trying to use. When I tried a few things, here's what I found:

$ perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: ... ... ... Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasin +g -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFI +LE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions +-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=g +eneric -fasynchronous-unwind-tables', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -W +declaration-after-statement -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-48)', gcco +sandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, prototype=define

So, I am guessing Perl wants to use gcc 4.1.2... Right! Now, when I try and find what gcc is set in the path, here's what I found:

$ which gcc /usr/bin/gcc $ gcc -v Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man -- +infodir=/usr/share/info --enable-shared --enable-threads=posix --disa +ble-checking --with-system-zlib --enable-__cxa_atexit --disable-libun +wind-exceptions --enable-languages=c,c++,f77 --disable-libgcj --host= +i386-redhat-linux Thread model: posix gcc version 3.4.6 20060404 (Red Hat 3.4.6-4)

But, when I do a "ls" in the directory /usr/lib/gcc, I find that there is a 4.1.1 also available

$ ls -ltr total 20 drwxr-xr-x 3 root root 4096 Feb 16 2010 4.1.1 lrwxrwxrwx 1 root root 5 Jul 1 16:52 4.1.2 -> 4.1.1 drwxr-xr-x 3 root root 4096 Jul 1 16:52 3.4.6

So, am I right in assuming that Perl has gotten "disconnected" from the gcc it was configured to use? How do I fix this issue? Whatever the solution is, I need a really solid justification to convince the Sys Admins & their bosses to get this fixed. Any help would be highly appreciated as am currently looking at a dead end, while the project deadlines are fast approaching!

Replies are listed 'Best First'.
Re: GCC and Perl: Module installation error cc1
by shmem (Chancellor) on Aug 09, 2011 at 09:07 UTC
    So, am I right in assuming that Perl has gotten "disconnected" from the gcc it was configured to use?

    Yes. From the listing you provided, I would say that somebody fouled up the system for whatever reason. Run rpm -qifl /usr/lib/gcc/4.1.1 and rpm -qfl /usr/lib/gcc/4.1.2, perhaps you will find a gcc binary that corresponds to the version you need. If there is, you could link that binary to ~/bin/gcc and have ~/bin first in your $PATH. That would be a quick fix.

    But what you probably should do is: Record the package details and installation date of the gcc RPMs and write your Sys Admins & their bosses that such a system is inacceptable.

      Wow thanks... So, my fears were right... I am now thinking of installing a local version of Perl under my home directory and a local installation of gcc as well. I guess this is quicker than getting the system configured correctly.

      Any idea on how I can get a local Perl installation and a local gcc to go along with it? I read some topics on the Internet on how to do this.. but I'm not sure whether I need to get only a newer version of Perl, or whether I need to get both gcc and Perl, as a "pack"?

        Any idea on how I can get a local Perl installation and a local gcc to go along with it?

        Er... yes. But last time I built my own gcc was gcc 1.83 on a SPARCstation ELC, and building stage1 through stage3 took 3 days... Why don't you just blame the admins of that box and let them do the job?

        Another method that might work for you... grab the desired RPM package, dump it into your home directory with

        server$ mkdir gcc; cd gcc server$ rpm2cpio ~/gcc*.rpm | cpio -i --make-directories

        and set the search path and the spec file. You will have to tweak the cflags or such of your perl, that might work copying Config.pm to some place included in the PERL5LIB environment variable, and edit Config.pm. Alternatively, build a local perl, probably tweaking the spec file of the system perl (from the source rpm).