Bug 154708 - ocaml compile uses -O instead of optimization level specified in RPM_OPT_FLAGS
Summary: ocaml compile uses -O instead of optimization level specified in RPM_OPT_FLAGS
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: ocaml
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Gérard Milmeister
QA Contact: Fedora Extras Quality Assurance
URL: http://fedoraproject.org/extras/devel...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-04-13 16:55 UTC by Toshio Kuratomi
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version: ocaml-3.08.3-5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-05-26 11:53:27 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch to allow user defined CFLAGS to override the default optimization level (456 bytes, patch)
2005-05-09 00:36 UTC, Toshio Kuratomi
no flags Details | Diff

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.


Note You need to log in before you can comment on or make changes to this bug.