Bug 154708

Summary: ocaml compile uses -O instead of optimization level specified in RPM_OPT_FLAGS
Product: [Fedora] Fedora Reporter: Toshio Kuratomi <toshio>
Component: ocamlAssignee: GĂ©rard Milmeister <gemi>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://fedoraproject.org/extras/development/build-logs/i386/ocaml-3.08.3-2.log
Whiteboard:
Fixed In Version: ocaml-3.08.3-5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-26 11:53:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to allow user defined CFLAGS to override the default optimization level none

Description Toshio Kuratomi 2005-04-13 16:55:26 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1

Description of problem:
when building ocaml, the optimization flags passed to gcc via RPM_OPT_FLAGS are included but the optimization (-O2) is overridden by -O definitions in the Makefile.

Version-Release number of selected component (if applicable):
3.08.3-2

How reproducible:
Always

Steps to Reproduce:
1. cd cvs/extras/ocaml
2. make i386
3.
  

Actual Results:  Watch the build logs and notice lines similar to the following:
gcc -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -I../../byterun -O -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC   -c -o write.o write.c

Expected Results:  gcc -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -I../../byterun -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC   -c -o write.o write.c

Additional info:

The Makefiles seem to contian the following definitions:
(From byterun/Makefile)::
  CC=$(BYTECC)
  CFLAGS=-DCAML_NAME_SPACE -O $(BYTECCCOMPOPTS)
  DFLAGS=-DCAML_NAME_SPACE -g -DDEBUG $(BYTECCCOMPOPTS)

Since the CC var is where we're defining the RPM_OPT_FLAGS (./configure -ccoption "gcc $RPM_OPT_FLAGS") the commandline ends up with the RPM_OPT_FLAGS -O2 entered first and the CFLAGS -O overriding it.

Unless upstream has a reason for only compiling with -O, I think we should be pulling the -O from the CFLAGS.

Comment 1 Toshio Kuratomi 2005-05-09 00:36:52 UTC
Created attachment 114148 [details]
Patch to allow user defined CFLAGS to override the default optimization level

This is a patch to the ocaml configure script that allows a CFLAGS environment
variable to add to the flags that are eventually passed to gcc when the package
is built.  We can then use this functionality in the rpm spec file to send the
RPM_OPT_FLAGS to gcc.  This addition occurs after the -O defined by the ocaml
defaults so the RPM_OPT_FLAGS supplied optimization level takes precedence.

Comment 2 Toshio Kuratomi 2005-05-26 11:53:27 UTC
Fixes applied and package built.