Closed Bug 268292 Opened 20 years ago Closed 19 years ago

PATCH: Pass properly CFLAGS to the mozilla/Makefile and don't kill optimization or debug flags

Categories

(SeaMonkey :: Build Config, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 284767

People

(Reporter: mmokrejs, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a5) Gecko/20041107
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a5) Gecko/20041107

Hi,
  I build on Linux with gcc, and couldn't get mozilla built with debug. The
problem is that configure and some subdir files overwrite values originally
passed to configure. Here's the first attempt to to pass them at least to
toop-level Makefile. In general, this patch shouldn't change default behaviour
in most cases. It only doesn't overwrite CFLAGS, CXXFLAGS from user. For
example, hardcoded debug flags are removed in case of linux, but only when user
has specified --enable-debug (otherwise they kick in as expected).

  I think this part was easy. The subdirectories under mozilla/ overwrite
debug/optimzie flags sometimes. It hard to guess why maintainers wish so.

  Debug opts get passed partly through MOZ_DEBUG_FLAGS so far, but this doesn't
yield full debug, as this variable isn't used always. So, to get same flags to
resulting compile commands, user has to do:

MOZ_DEBUG_FLAGS="-O0 -ggdb" CFLAGS="-O0 -ggdb" ./configure  --enable-debug
--disable-optimize --with-gssapi=/usr/heimdal --enable-crypto --enable-jprof
--enable-debug-modules=all --enable-debugger-info-modules

Important here is of these two environment variables MOZ_DEBUG_FLAGS, CFLAGS.

These flags still don't get to resulting compile commands only case of:
mozilla/security/coreconf/nsinstall
mozilla/security/nss/lib/util
mozilla/security/nss/lib/freebl
mozilla/security/nss/lib/softoken
mozilla/security/nss/lib/base
mozilla/security/nss/lib/dev
mozilla/security/nss/lib/pki
mozilla/security/nss/lib/certdb
mozilla/security/nss/lib/certhigh
mozilla/security/nss/lib/pk11wrap
mozilla/security/nss/lib/cryptohi
mozilla/security/nss/lib/nss
mozilla/security/nss/lib/ssl
mozilla/security/nss/lib/pkcs12
mozilla/security/nss/lib/pkcs7
mozilla/security/nss/lib/smime
mozilla/security/nss/lib/crmf
mozilla/security/nss/lib/jar
mozilla/security/nss/lib/ckfw
mozilla/security/nss/lib/ckfw/builtins
mozilla/security/nss/lib/fortcrypt
mozilla/security/nss/lib/fortcrypt/swfort
mozilla/security/nss/lib/fortcrypt/swfort/pkcs11
mozilla/security/nss/cmd/lib
mozilla/security/nss/cmd/shlibsign/mangle
mozilla/security/nss/lib/util

So, this patch affects MOZ_DEBUG_FLAGS which gets it's content from
MOZ_DEBUG_FLAGS environment variable, or if tha was empty, from some hardcoded
values in configure (for example "-g -fno-inline" on linux).

These other 3 configures should be fixed too in the same respect, if you'd aggree:
./security/nss/tests/pkcs11/netscape/trivial/configure.in
./nsprpub/configure.in
./directory/c-sdk/configure.in


Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Pass CFLAGS, CXXFLAGS and MOZ_DEBUG_FLAGS downstream thought mozilla/configure
at least.
--disable-optimize --enable-debug causes debug builds to occur.  We do not
support using the environment's CFLAGS/CXXFLAGS at make time.  Setting
CXXFLAGS/CFLAGS when running configure will cause those flags to show up in the
compile line.  Yes, it is known that CFLAGS aren't passed down to NSS (bug 101249). 
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Sorry, but this patch allows user to use CFLAGS/CXXFLAGS at configure time!
The patch fixes configure, as this is the reason they are ignored! Did you have
a look into the patch? It makes teh configure respect HOST_OPTIMIZE_FLAGS and
only when they were empty, it takes the old (current at the moment) approach and
applies -O2. Currently, it always forces -O2, so don't be surprised why people
complain that debug build don't have debug symbols.

This patch doesn't fix the configure of nspr, but the fix would be simmilar. I
can improve it but first I want to know what are you going to accept.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Product: Browser → Seamonkey
Comment on attachment 165051 [details] [diff] [review]
CFLAGS, CXXFLAGS and MOZ_DEBUG_FLAGS handling

Ok, this patch has all of the same issues as the one from bug 284767.  Plus, it
unconditionally removes the use of MOZ_OPTIMIZE_FLAGS when --enable-optimize is
given without args.

It also unconditionally removes the use of MOZ_OPTIMIZE_FLAGS from HOST_CFLAGS
when not cross compiling.

--enable-optimize --enable-debug is a valid build configuration.  We do not
automatically disable one when using the other.
Attachment #165051 - Flags: review-
(In reply to comment #3)
> Sorry, but this patch allows user to use CFLAGS/CXXFLAGS at configure time!

I don't see where CFLAGS/CXXFLAGS even comes into play with this patch. 
CFLAGS/CXXFLAGS are already checked & used at configure time.  As I pointed out
before, it's already known that those specific flags aren't automatically passed
down to the NSS build (bug 101249).

I don't understand why we have 3 separate bugs on this very similiar and very
basic problem.  I'm marking this as a dupe of bug 284767.


*** This bug has been marked as a duplicate of 284767 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago19 years ago
Resolution: --- → DUPLICATE
For completeness of the archive, I use currently:

$ ./configure --disable-optimize --enable-debug='-g3 -O0 -ggdb' --enable-debug-modules=all --enable-debugger-info-modules --enable-detect-webshell-leaks --enable-svg --enable-svg-renderer-libart --enable-image-decoders=all --with-qtdir=/usr/qt/3 --enable-application=suite --disable-freetype2 --enable-jprof --enable-default-toolkit=cairo-gtk2 --enable-xft --disable-gssapi
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: