PDA

View Full Version : F12: rpmbuild and compiler flag changes



Hlingler
11th December 2009, 09:47 AM
Hello:

Recently installed F12-LXDE.i686 on a VBox VM. All looks swell so far - except for a couple of little niggles with rpmbuild: rpmbuild no longer builds matching *debuginfo by default. I cannot find reference to when nor where this changed, nor how to restore. Not a big deal, but I'd like to know how to command rpmbuild to also build the matching *debuginfo RPMs, if needed, like it used to do.
Compiler flags: my usual pile has long been: 'CFLAGS="-O2 -g -pipe -m32 -march=i[3|5|6]86 -mtune=generic" CXXFLAGS=$CFLAGS ', but this fails: at some point while building freeciv-2.1.10, I get a message about some source file (libcivui.a or such) not having an index, "run ranlib to fix" (or something like that). Executing rpmbuild without any optimization flag(s) succeeds, but I'd like to optimize. I believe that the problem is in the '-m32' flag, but cannot be sure - and would much prefer not to waste too much time trying different flags, as this is a fairly large and long build, and fails near the end, making experiments painful. Again: I can't find any documentation that helps - as far as I can tell, '-m32' should work, it always has before, and still does on F=<12.

Any help/pointers/suggestions appreciated.

Thanks,
V

leigh123linux
11th December 2009, 05:55 PM
For the debuginfo problem try



su
yum install redhat-rpm-configAs for the flags try adding this line before %configure



export CXXFLAGS="%{optflags}" CFLAGS="%{optflags}"

PabloTwo
11th December 2009, 07:57 PM
If you're using a .spec file and it uses the "%configure" declaration, all the optimization flags are automatically set for your build host.

BASH:chrome/-> rpm --eval %configure

CFLAGS="${CFLAGS:--O2 -g -march=i386 -mtune=i686}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:--O2 -g -march=i386 -mtune=i686}" ; export CXXFLAGS ;
FFLAGS="${FFLAGS:--O2 -g -march=i386 -mtune=i686}" ; export FFLAGS ;
./configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu \
--target=i386-redhat-linux \
--program-prefix= \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/var/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info

Hlingler
11th December 2009, 08:23 PM
Thanks guys.

redhat-rpm-config - OK, I'll check that.

Koji builder logs (http://kojipkgs.fedoraproject.org/packages/freeciv/2.1.9/2.fc12/data/logs/i686/build.log) show the following compiler flags:
CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'

which is obviously where I got my pile, except that I use old default '-mtune=generic'.

Still not sure why my rpmbuild errors out at that one point - maybe a problem in freeciv-2.1.10 code ?

V

EDIT: Installing package redhat-rpm-config does indeed fix the missing *debuginfo builds. My bad, I guess.

EDIT #2: OK, found the GNU GCC blurb: http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
seems to clearly indicate that '-m32' should work. Hm... . Or perhaps I'm chasing the wrong flag.

Hlingler
12th December 2009, 10:13 AM
Well, I resorted to experimenting with the flags, and on a hunch, resorted to '-mtune=atom' (instead of '-mtune=generic' ) with success, all other flags the same as stated before (including '-m32' ). So apparently I was chasing the wrong culprit. But that still leaves the question: why does using '-mtune=generic' instead of F12 default '-mtune=atom' produce a compile error ? And what would need to be done to change that default ?? Aside: why is '-mtune=atom' now (F12) the default (as opposed to the obviously more generic '-mtune=generic') ??? Are Intel Atom processors really that dominant in the market as to justify this as the default ? I find no rationale given for this particular change at https://fedoraproject.org/wiki/Features/F12X86Support. Just curious... but it seems to make more sense to me to keep it generic.
As for the flags try adding this line before %configure
export CXXFLAGS="%{optflags}" CFLAGS="%{optflags}"The spec file already has standard:
make %{?_smp_mflags}
Would this not be the same ?

Thanks,
V

leigh123linux
12th December 2009, 10:25 AM
Well, I resorted to experimenting with the flags, and on a hunch, resorted to '-mtune=atom' (instead of '-mtune=generic' ) with success, all other flags the same as stated before (including '-m32' ). So apparently I was chasing the wrong culprit. But that still leaves the question: why does using '-mtune=generic' instead of F12 default '-mtune=atom' produce a compile error ? And what would need to be done to change that default ?? Aside: why is '-mtune=atom' now (F12) the default (as opposed to the obviously more generic '-mtune=generic') ??? Are Intel Atom processors really that dominant in the market as to justify this as the default ? I find no rationale given for this particular change at https://fedoraproject.org/wiki/Features/F12X86Support. Just curious... but it seems to make more sense to me to keep it generic.The spec file already has standard:
make %{?_smp_mflags}
Would this not be the same ?

Thanks,
V


No they are very different, %{?_smp_mflags} just enables parallel make.


http://developers.sun.com/solaris/articles/parallel_make.html

PabloTwo
12th December 2009, 11:17 PM
You should add the line to your ~/.rpmmacros file:

%_smp_mflags -j3
if it isn't already there by default.

Hlingler
13th December 2009, 07:40 AM
As for the flags try adding this line before %configure
export CXXFLAGS="%{optflags}" CFLAGS="%{optflags}"No, this did not work: rpmbuild reverted to default flags, even if rpmbuild command is preceded by desired flags.

For posterity: the answers to my questions are:
(A) install redhat-rpm-config
(B) edit file (owned by that package) /usr/lib/rpm/redhat/rpmrc and change the line in question as desired, in this case line #6:
optflags: i686 %{__global_cflags} -m32 -march=i686 -mtune=generic -fasynchronous-unwind-tablesThanks,
V