Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6630771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:27:12+00:00 2026-05-25T22:27:12+00:00

I am running on a CentOS 5.7 system. I downloaded a source package and

  • 0

I am running on a CentOS 5.7 system.

I downloaded a source package and a .spec file from someone else. I am trying to build a RPM from the source using a vanilla command like:

% rpmbuild -ba ~/rpmbuild/SPECS/foo.spec
...
Configuration summary:
======================

  Host type................: x86_64-redhat-linux-gnu
  CC.......................: gcc
  CFLAGS...................: -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Werror

  Package..................: sudosh2
  Version..................: 1.0.4

  Installation prefix......: /usr
  Man directory............: /usr/share/man
  sysconfdir...............: /etc
  recording input..........: no

However, this build is failing. The code is a little sloppy and is generating some warnings. Some part of this toolchain is enabling -Werror flag, which makes “all warnings into errors.” Thus, the build fails with an error:

gcc -DHAVE_CONFIG_H -I. -I..     -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Werror -MT parse.o -MD -MP -MF .deps/parse.Tpo -c -o parse.o parse.c
cc1: warnings being treated as errors
sudosh.c: In function 'main':
sudosh.c:486: warning: unused variable 'written'
sudosh.c:112: warning: unused variable 'found'
cc1: warnings being treated as errors
parse.c: In function 'parse':
parse.c:20: warning: unused variable 'y'
parse.c:14: warning: unused variable 'opt'
parse.c:14: warning: unused variable 'cmt'
parse.c:14: warning: unused variable 'arg'
parse.c:10: warning: unused variable 'i'
parse.c:10: warning: unused variable 'line_number'
make[2]: *** [sudosh.o] Error 1

I know the proper fix is for the author to fix the code, but I want to work around this problem in the short term. I need a working RPM.

It looks like either ./configure or autoconf is automatically adding the -Werror flag. How can I disable the -Werror flags for my builds, short of editing the Makefile myself?

Update in response to @pwan’s answer:

The .spec file is pretty generic, and doesn’t specify any special flags:

%build
%configure \
    --program-prefix="%{?_program_prefix}"
%{__make} %{?_smp_mflags}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:27:13+00:00Added an answer on May 25, 2026 at 10:27 pm

    How can I disable the -Werror flags for my builds, short of editing
    the Makefile myself?

    The GCC manual has the solution in 3.8 Options to Request or Suppress Warnings:

    You can request many specific warnings with options beginning -W',
    for example -Wimplicit to request warnings on implicit declarations.
    Each of these specific warning options also has a negative form
    beginning
    -Wno-‘ to turn off warnings; for example, -Wno-implicit.
    This manual lists only one of the two forms, whichever is not the
    default.

    So, setting -Wno-error the CFLAGS environment variable did the trick for me. Now that I know what I’m looking for, I can see that Stackoverflow has a wealth of answers: https://stackoverflow.com/search?q=%22-Wno-%22 , specifically how to disable specific warning when -Wall is enabled.

    In my specific case, the build was failing due to ‘warning: unused variable”, and I can suppress those specific warnings with -Wno-unused-variable.

    Since I’m using rpmbuild, I need to put this in the .spec file as suggested by @pwan. The only way I could figure this out was to:

    1. Build the rpm once:

      rpmbuild -v -bb ~/rpmbuild/SPECS/sudosh.spec
      
    2. Search for the CFLAGS which is generated by ./configure

      Configuration summary:
      ======================
      
        Host type................: x86_64-redhat-linux-gnu
        CC.......................: gcc
        CFLAGS...................: -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Werror
      
    3. And manually append these CFLAGS to my .spec file, into the `%configure% section:

      %configure \
          --program-prefix="%{?_program_prefix}"
      #%{__make} %{?_smp_mflags}
      %{__make} %{?_smp_mflags} CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Werror -pedantic-errors -Wno-unused-variable -ansi -std=c99"
      

    The above is a little hack-ish, because if the ./configure script is changed upstream I may need to re-adjust the CFLAGS in my .spec file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm planning a new build system for our project running on Centos 5.4. I
I'm running CentOS 5, and am trying to get a django application working with
I'm trying to install gevent on a fresh EC2 CentOS 5.3 64-bit system. Since
I am running CentOS 5.2 and using yum to manage packages. I have had
I am working on a PC running CentOS as its operating system. I also
I was upgrading the OS on one of our build from Centos 5.3 32bit
I recently upgraded my server running CentOS 5.0 to a quad-core CPU from a
I am trying to install MediaCore on my machine running CentOS as soon as
I'm trying to get buildbot running on centos5, and getting the following error: File
I'm trying to set up a virtual machine (vmware workstation 8.0.2) running CentOS 6.2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.