From Fedora Project Wiki

How to remove unwanted compiler flags from $RPM_OPT_FLAGS

Stop (medium size).png This document is a draft.

Some packages like blender (see Bug #199418) don't be able to compile properly, if all compiler options in $RPM_OPT_FLAGS will be specified. Becouse we want to use as much as compiler options in $RPM_OPT_FLAGS as possible, we need a method to remove selected compiler options from $RPM_OPT_FLAGS.


An advance to have such a method is the usage of arch specific compiler options specified in the $RPM_OPT_FLAGS without to run in trouble on using compiler options which will couse issues with a specific package.

Therfor I have create the following shell script:

rmopts() {
for i in $@ ; do
RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e "s/\S*$i\S*//")

In the following I demonstrate how to remove all compiler options in $RPM_OPT_FLAGS which match to the regular expression 'protector':

Sample for using rmopts


This package demonstrate the usage of script

source %{SOURCEx}
rmopts 'protector'



The letter 'x' in Sourcex may be substitute by any number.