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

Monks, I run Fedora Core 4, fully updated system. When trying to install modules from inside CPAN, I will often get:

cc1: error: unrecognized command line option "-fstack-protector"
cc1: error: invalid parameter ‘ssp-buffer-size’

This happens with gcc 4 and 3.2 the same. Manually editing Makefile to strip off those options does the trick, but I don't feel it like the proper solution... What should I do?

Thank you in advance.

Replies are listed 'Best First'.
Re: Should I get another gcc?
by tirwhan (Abbot) on Feb 27, 2006 at 21:45 UTC

    gcc 3.2 doesn't have the -fstack-protector option (it was introduced somewhere around 3.4), but 4.0 should. Are you sure you're calling the right compiler binary?


    All dogma is stupid.
Re: Should I get another gcc?
by spiritway (Vicar) on Feb 28, 2006 at 04:17 UTC

    gcc is a front end for cc1 (cc1 is the actual C compiler). During compilation, gcc will call cc1 as needed. On my Linux box (SUSE 10), cc1 wasn't in the path. I had to go dig it up. On my box I found it under /usr/lib/gcc/some distro-specific stuff/cc1. You can probably use /usr/lib as a starting point and then do a recursive find for the file name.

    I suggest you track down the cc1 that is being called, and when you are in that directory, type './cc1 --version'. My guess is that you may have upgraded gcc and somehow missed upgrading cc1, though how that might happen isn't clear to me. It may be that for some reason, gcc is looking in the old directory instead of the one with the new cc1.

    I strongly recommend that you *not* edit out those lines in your Makefile, because they refer to security features that will help you avoid buffer overflow exploits. Without them, C programs will compile without these safeguards. This is a Bad Thing (tm).

Re: Should I get another gcc?
by chromatic (Archbishop) on Feb 27, 2006 at 21:22 UTC

    That's weird. What is cc1? What compiler do you have set in Config.pm?

      Which Config.pm? Does this have to do with MakeMaker, Automake, or who?

        When Perl builds, it records its configuration and compile-time settings in a module called Config. I'm curious as to the compiler settings there.

Re: Should I get another gcc?
by samtregar (Abbot) on Feb 28, 2006 at 06:13 UTC
    It sounds to me like you've got a Perl that's come unstuck from your compiler. Generally speaking Perl must be compiled with the same compiler that yo u'll use to compile CPAN modules. If you change your compiler (like going from GCC 4.x to 3.2, for example) you'll probably need to recompile Perl.

    -sam