#49686 Issue 49684 - AC_PROG_CC clobbers CFLAGS set by --enable-debug
Closed 3 years ago by spichugi. Opened 5 years ago by vashirov.
vashirov/389-ds-base debug-cflags  into  master

file modified
+2
@@ -27,7 +27,9 @@ 

  AC_CONFIG_MACRO_DIRS([m4])

  

  # Checks for programs.

+ : ${CXXFLAGS=""}

  AC_PROG_CXX

+ : ${CFLAGS=""}

  AC_PROG_CC

  AM_PROG_CC_C_O

  AM_PROG_AS

Bug Description:
AC_PROG_CC macro sets CFLAGS/CXXFLAGS environment variable to -g -O2
for GCC if CFLAGS/CXXFLAGS are not defined.

Fix Description:
Use an empty default for CFLAGS and CXXFLAGS instead.

https://pagure.io/389-ds-base/issue/49684

Reviewed by: ???

rebased onto 68ecbff

5 years ago

Pull-Request has been merged by vashirov

5 years ago

@vashirov, Are you sure that this is the best solution?

IIUC you wanted to fix just "--enable-debug" and do not influence other ways.
I didn't test but I would say that it will also influence also standard build.

And thus it will influence distributions which does not set CFLAGS by default (debian). (you can see that in build log https://buildd.debian.org/status/fetch.php?pkg=389-ds-base&arch=amd64&ver=1.3.7.10-1%2Bb1&stamp=1525936509&raw=0)

RPM build sets CFLAGS to $RPM_OPT_FLAGS which uses __global_cflags:

%{__global_cflags}   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4

So that should not affect RPM build.

Are you sure that Debian doesn't set CFLAGS? IIRC it uses dpkg-buildflags to populate the variable.

RPM build sets CFLAGS to $RPM_OPT_FLAGS which uses __global_cflags:
%{__global_cflags} -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4

I did not mention rpm based distros in previous comment, Because I know the explicitly set *FLAGS

So that should not affect RPM build.
Are you sure that Debian doesn't set CFLAGS? IIRC it uses dpkg-buildflags to populate the variable.

Can you see it in log which I mention in previous comment? I cannot but I might overlook it.

Anyway, 99.99% of autotools based packages are wine with default CFLAGS set to "-g -O2". There is something wrong with --enable-debug and --enable-asan that they do not override such default properly. I would prefer to fix these options rather then changing default provided by autotools.

You're right, --enable-debug mixes preprocessor flags and compiler flags. We should set them separately. I'll rework this.

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/2745

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata