Error Installing PERL modules "unrecognized command line option -fstack -protector"

unrecognized command line option "-fstack-protector" error usually comes on Cygwin when installing PERL modules. For example when installing the DBI module or DBD::MySQL perl module, the following error comes on cygwin :

cp lib/DBI/Gofer/Serializer/ blib/lib/DBI/Gofer/Serializer/ cp dbipport.h blib/arch/auto/DBI/dbipport.h cp lib/DBI/Gofer/ blib/lib/DBI/Gofer/ cp lib/DBI/ blib/lib/DBI/ cp lib/Win32/ blib/lib/Win32/ cp lib/DBI/ blib/lib/DBI/ cp lib/DBD/ blib/lib/DBD/ cp lib/DBI/ blib/lib/DBI/ /usr/bin/perl.exe -p -e "s/~DRIVER~/Perl/g" ./Driver.xst > Perl.xsi /usr/bin/perl.exe /usr/lib/perl5/5.10/ExtUtils/xsubpp -typemap /usr/lib/perl5/5 .10/ExtUtils/typemap -typemap typemap Perl.xs > Perl.xsc && mv Perl.xsc Perl.c gcc -c -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fno-strict-aliasing -pipe -fs tack-protector -I/usr/local/include -DUSEIMPORTLIB -O3 -DVERSION=\"1.609\" -DX S_VERSION=\"1.609\" "-I/usr/lib/perl5/5.10/i686-cygwin/CORE" -W -Wall -Wpointe r-arith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmiss ing-noreturn -Wno-unused-parameter Perl.c cc1: error: unrecognized command line option "-fstack-protector" make: *** [Perl.o] Error 1 TIMB/DBI-1.609.tar.gz /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible

This error is due to older version of GCC in your system. The stack protector was introduced as of GCC 4. Look the version in your system by running

gcc -v

Update your system if you are using cygwin run setup.exe and from the package list check GCC4, as shown below.
Cygwin install GCC4 solve unrecognized command line option -fstack-protector

(Search for GCC)

Now try reinstalling the PERL module, everything should be fine. :)

24 Mar, 2010
Comments (5)
  • Thank you for the solution !!!
    This is exactly what I was looking for while compiling net-snmp 5.7 under cygwin.

    By zomba on 07 Feb, 2012
  • Thank you!

    Thank you! Ran into this issue when trying to install the DBI module, which is required by the git-p4raw project.

    Hopefully this keyword-stuffing will help others in my situation find this on Google :)

    By Tom on 31 May, 2010
    • Wonderful

      Great to know people find the post. I had a bad time searching for its solution. :)
      By digitalpbk on 01 Jun, 2010
  • Fixed the issue

    Thank you!

    By Ben on 20 Apr, 2010
  • Thanks for this

    Thanks very much for this solution. I did know that there was a version compliance problem, but I am pretty dumb to figure out how to exactly resolve the problem :)

    By Rajeev Sharma on 07 Apr, 2010
You may also like
On Facebook
Email Newsletter