apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47829] New: apr-config: CFLAGS should not include "-O2"
Date Sun, 13 Sep 2009 04:47:08 GMT

           Summary: apr-config: CFLAGS should not include "-O2"
           Product: APR
           Version: HEAD
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: nrc@cs.berkeley.edu

When I build apr 1.3.8 on OSX or Linux, "apr-1-config --cflags" yields:

% ./apr-1-config --cflags
 -g -O2

Why are either of these flags useful? "apr-config --help" notes that

"An application should use the results of --cflags, --cppflags, --includes, and
--ldflags in their build process."

Why should an application that links against apr-config include "-O2" in its
build process, just because apr was compiled that way?

This is an issue in practice, because "-O2" makes debugging harder (and
increases compile times, etc.). If an application that links against apr wants
to have a "debug" build mode, there are 3 options:

(1) Don't include "apr-1-config --cflags" in the application's CFLAGS, which is
potentially non-portable
(2) Manually strip "-O2" from apr's CFLAGS by text search, which is error-prone
and hacky

I think it would be better to limit "--cflags" to only include flags that
application programs should add to their CFLAGS in order to safely build
against APR.

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org

View raw message