Bug 1278676
Summary: | rpmbuild does not work with optflags in f23 | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | fujiwara <tfujiwar> |
Component: | rpm | Assignee: | Packaging Maintenance Team <packaging-team-maint> |
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 23 | CC: | i18n-bugs, jzeleny, lkardos, mmraka, novyjindrich, packaging-team-maint, pknirsch, shawn.p.huang, tagoh, tfujiwar, yeti |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-01-22 11:47:16 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
fujiwara
2015-11-06 07:06:38 UTC
The errors are from a configure script. rpmbuild doesn't care about optflags. They are just passed to a configure script. A configure script is part of a package and not part of rpmbuild. So I am reassigning this to ibus-anthy package. I think the package side has not changed anything. This problem does not happen in Fedora 22 or older. This problem happens in Fedora 23 or later. If configure.ac includes "AC_PROG_CC", this problem happens: - The tarball only includes configure.ac % zcat ../SOURCES/a-1.5.8.tar.gz | tar tfv - drwxr-xr-x root/root 0 2016-01-22 16:22 a-1.5.8/ -rw-r--r-- root/root 1207 2016-01-22 16:21 a-1.5.8/configure.ac - configure.ac has only "AC_PROG_CC" and "AC_INIT". % cat ../BUILD/a-1.5.8/configure.ac AC_INIT([ibus-anthy], [ibus_anthy_version], [https://github.com/ibus/ibus-anthy/issues],[ibus-anthy]) AC_PROG_CC - a.spec runs only "autoconf" and "%configure". Name: a Version: 1.5.8 %prep %setup -q %build autoreconf %configure Then this problem always happen: % rpmbuild -bb --define "optflags -g" a.spec checking whether we are cross compiling... configure: error: in `/root/rpmbuild/BUILD/a-1.5.8': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details error: Bad exit status from /var/tmp/rpm-tmp.969HDg (%build) Why rpmbuild runs LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' forcibly? The default CFLAGS is no problem: CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' But If I change optflags, the problem happens. I have no idea to fix this in each package side. Yes, the root cause of this error is that you have '-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' in your LDFLAGS and you don't have its counterpart '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' in CFLAGS because you completely rewrote optflags with '--define "optflags -g"'. Maybe it would be better just to append to optflags instead of rewriting them. You can do this with '--define "optflags `rpm -E %{optflags}` -g"'. If you really want to rewrite optflags then you have to modify accordingly also %{__global_ldflags}. But I don't recommend completely rewrote optflags because then you will create a package which is against fedora rules. > Why rpmbuild runs LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' forcibly? Hardening all fedora packages [1] is a change which was announced, discussed and approved. Rpm team doesn't initiated nor performed this change. I am not entitled to revert this change. You can discuss your problem with owner of this change [1]. Because this is not a bug in rpm. I am closing this as not a bug. [1] https://fedoraproject.org//wiki/Changes/Harden_All_Packages (In reply to Ľuboš Kardoš from comment #3) > You can do this with '--define "optflags `rpm -E %{optflags}` -g"'. If The suggestion does not help my case since the default optflags includes "-O2". > > Why rpmbuild runs LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' forcibly? > > Hardening all fedora packages [1] is a change which was announced, discussed > and approved. Rpm team doesn't initiated nor performed this change. I am not > entitled to revert this change. You can discuss your problem with owner of > this change [1]. OK, thanks. > > Because this is not a bug in rpm. I am closing this as not a bug. > > [1] https://fedoraproject.org//wiki/Changes/Harden_All_Packages (In reply to fujiwara from comment #4) > (In reply to Ľuboš Kardoš from comment #3) > > You can do this with '--define "optflags `rpm -E %{optflags}` -g"'. If > > The suggestion does not help my case since the default optflags includes > "-O2". That's not problem, you can override it with another option -O. From gdb man: If you use multiple -O options, with or without level numbers, the last such option is the one that is effective. (In reply to Ľuboš Kardoš from comment #5) > (In reply to fujiwara from comment #4) > > (In reply to Ľuboš Kardoš from comment #3) > > > You can do this with '--define "optflags `rpm -E %{optflags}` -g"'. If > > > > The suggestion does not help my case since the default optflags includes > > "-O2". > > That's not problem, you can override it with another option -O. From gdb man: > > If you use multiple -O options, with or without level numbers, the last such > option is the one that is effective. Thank you for the suggestion. Probably I think it would be great to archive this way in Fedora wiki. (In reply to Ľuboš Kardoš from comment #5) > (In reply to fujiwara from comment #4) > > (In reply to Ľuboš Kardoš from comment #3) > > > You can do this with '--define "optflags `rpm -E %{optflags}` -g"'. If > > > > The suggestion does not help my case since the default optflags includes > > "-O2". > > That's not problem, you can override it with another option -O. From gdb man: > > If you use multiple -O options, with or without level numbers, the last such > option is the one that is effective. I think -O is still optimized. I need no -O. > I think -O is still optimized. I need no -O.
Use -O0 (aka -O<zero>).
If adding '-O0' (-O followed by zero) doesn't disable optimization then there is a bug in gcc. I mean try 'rpmbuild --define "optflags `rpm -E %{optflags}` -g -O0" .....' Thanks for the comments. I have never used -O0, sorry. |