Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
Florian Weimer writes: After installing redhat-rpm-config, this works in bash and similar shells: $ eval `rpm --eval %set_build_flags` Maybe we can make it more clear in buildflags.md that this macro is a shell script fragment? I find it more convenient to generate parameters for an autoconf-generated configure script. I do not need to always use the same build flags as rpm. Sometimes you want to build without optimizations, for debugging purposes. What I do is ./configure `rpmflags` with "rpmflags" being this script: #! /bin/bash echo -n "CXXFLAGS='" rpm -E '%build_cxxflags' | tr -d '\012' echo -n "' CFLAGS='" rpm -E '%build_cflags' | sed 's/ *$//' | tr -d '\012' echo -n "' LDFLAGS='" rpm -E '%build_ldflags' | sed 's/ *$//' | tr -d '\012' echo "'" I suppose I can turn this inside-out, and change this to use %set_build_flags and directly run configure. pgpb1WTkcDfaO.pgp Description: PGP signature ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
Dne 02. 01. 23 v 14:09 Florian Weimer napsal(a): * Vít Ondruch: And yes, that is the problem why upstream can't see the issues we see, despite they were so kind to test on Fedora. Luckily, there was analysis of the issue which initially triggered this discussion done by Mamoru [1] and it seem that the issue are caused by LTO. Nevertheless, if there was some way to tell them lets say: 1) $ sudo dnf install fedora-official-build-flags 2) $ with-fedora-official-build-flags make That would be super convenient and I still find surprising we don't have anything like this. After installing redhat-rpm-config, this works in bash and similar shells: $ eval `rpm --eval %set_build_flags` Maybe we can make it more clear in buildflags.md that this macro is a shell script fragment? My gut answer was something about "who reads the documentation", but since I was referring to the buildflags.md in the issue, then this could be probably good start :D But still, if there was something I can remember or even find via e.g. tab completion, that would be much better. Vít Thanks, Florian OpenPGP_signature Description: OpenPGP digital signature ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
* Vít Ondruch: > And yes, that is the problem why upstream can't see the issues we see, > despite they were so kind to test on Fedora. Luckily, there was > analysis of the issue which initially triggered this discussion done > by Mamoru [1] and it seem that the issue are caused by > LTO. Nevertheless, if there was some way to tell them lets say: > > 1) $ sudo dnf install fedora-official-build-flags > > 2) $ with-fedora-official-build-flags make > > That would be super convenient and I still find surprising we don't > have anything like this. After installing redhat-rpm-config, this works in bash and similar shells: $ eval `rpm --eval %set_build_flags` Maybe we can make it more clear in buildflags.md that this macro is a shell script fragment? Thanks, Florian ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
Dne 24. 12. 22 v 20:49 Florian Weimer napsal(a): * Vít Ondruch: Working with upstream on one issue [1], it seems that the culprit is in the Fedora compiler options. Is there some convenient way to set them up? Of course I can copy them from log, or somehow put together from the RPM macros, but I'd appreciate if there was some easier way. Can we e.g. distribute some script, which would set them up, as part or some RPM? Build systems and test harnesses often tweak the build flags, so it's probably best to enable logging there to see what's going on. Of course the build flags can be seen from the build log, but precisely for the reason that "Build systems and test harnesses often tweak the build flags", I'd like to have easy way to provide upstream with the default Fedora build flags. Different distributions also have different compiler defaults. For example, most of Fedora's explicit compiler flags are enabled by default in Ubuntu's GCC. And yes, that is the problem why upstream can't see the issues we see, despite they were so kind to test on Fedora. Luckily, there was analysis of the issue which initially triggered this discussion done by Mamoru [1] and it seem that the issue are caused by LTO. Nevertheless, if there was some way to tell them lets say: 1) $ sudo dnf install fedora-official-build-flags 2) $ with-fedora-official-build-flags make That would be super convenient and I still find surprising we don't have anything like this. Vít [1] https://bugs.ruby-lang.org/issues/19248#note-14 OpenPGP_signature Description: OpenPGP digital signature ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
On Sun Dec 25, 2022 at 09:02 -0500, Sam Varshavchik wrote: > rpm -E '%__global_ldflags' > > is also needed for LDFLAGS. %__global_ldflags is deprecated. You should use %build_ldflags instead[1]. Also, %build_cflags, %build_cxxflags, and friends are preferred to %optflags AFAIK. [1]: https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/rawhide/f/macros#_130 -- Maxwell G (@gotmax23) Pronouns: He/Him/His ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
Vitaly Zaitsev via devel writes: On 23/12/2022 19:21, Vít Ondruch wrote: Working with upstream on one issue [1], it seems that the culprit is in the Fedora compiler options. Is there some convenient way to set them up? rpm -E %optflags rpm -E '%__global_ldflags' is also needed for LDFLAGS. pgpjBHXq8wZxo.pgp Description: PGP signature ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
On 23/12/2022 19:21, Vít Ondruch wrote: Working with upstream on one issue [1], it seems that the culprit is in the Fedora compiler options. Is there some convenient way to set them up? rpm -E %optflags -- Sincerely, Vitaly Zaitsev (vit...@easycoding.org) ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
* Vít Ondruch: > Working with upstream on one issue [1], it seems that the culprit is in > the Fedora compiler options. Is there some convenient way to set them > up? Of course I can copy them from log, or somehow put together from the > RPM macros, but I'd appreciate if there was some easier way. Can we e.g. > distribute some script, which would set them up, as part or some RPM? Build systems and test harnesses often tweak the build flags, so it's probably best to enable logging there to see what's going on. Different distributions also have different compiler defaults. For example, most of Fedora's explicit compiler flags are enabled by default in Ubuntu's GCC. ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
> So you can do > $ eval `rpm -E '%set_build_flags'` > in a script to set the flags that RPM uses. Another solution could be something like: $ gcc $(rpm -E '%optflags') ... $(rpm -E '%build_ldflags') A.FI. ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Re: Is there convenient way to setup Fedora compilation flags outside of the RPM build?
On Fri, Dec 23, 2022 at 1:21 PM Vít Ondruch wrote: > > Working with upstream on one issue [1], it seems that the culprit is in > the Fedora compiler options. Is there some convenient way to set them > up? Of course I can copy them from log, or somehow put together from the > RPM macros, but I'd appreciate if there was some easier way. Can we e.g. > distribute some script, which would set them up, as part or some RPM? > Now that we have the `set_build_flags` macro, it's somewhat straightforward to do: $ rpm -E '%set_build_flags' CFLAGS="${CFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CFLAGS ; CXXFLAGS="${CXXFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CXXFLAGS ; FFLAGS="${FFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FFLAGS ; FCFLAGS="${FCFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FCFLAGS ; LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 }" ; export LDFLAGS ; LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-/usr/lib64:}" ; export LT_SYS_LIBRARY_PATH ; CC="${CC:-gcc}" ; export CC ; CXX="${CXX:-g++}" ; export CXX So you can do $ eval `rpm -E '%set_build_flags'` in a script to set the flags that RPM uses. > > Vít > ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Is there convenient way to setup Fedora compilation flags outside of the RPM build?
Working with upstream on one issue [1], it seems that the culprit is in the Fedora compiler options. Is there some convenient way to set them up? Of course I can copy them from log, or somehow put together from the RPM macros, but I'd appreciate if there was some easier way. Can we e.g. distribute some script, which would set them up, as part or some RPM? Vít [1] https://bugs.ruby-lang.org/issues/19248 OpenPGP_signature Description: OpenPGP digital signature ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue