https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: dev-libs/nspr-4.35 overwrites user's optimization (-O*). Discovered on: amd64 (internal ref: ci) NOTE: unless there are known issues with -O* configured by the user, the build system should not overwrite -O*.
Created attachment 843407 [details] build.log build log and emerge --info
Looks fine to me?
(In reply to Joonas Niilola from comment #2) > Looks fine to me? At the first compiled file we have: x86_64-pc-linux-gnu-gcc -o now.o -c -O2 -pipe -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -Wall -pthread -O2 -fPIC -UDEBUG -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DNDEBUG=1 -DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 -DHAVE_VISIBILITY_PRAGMA=1 -DXP_UNIX=1 -D_GNU_SOURCE=1 -DHAVE_FCNTL_FILE_LOCKING=1 -DHAVE_POINTER_LOCALTIME_R=1 -DLINUX=1 -DHAVE_DLADDR=1 -DHAVE_GETTID=1 -DHAVE_LCHOWN=1 -DHAVE_SETPRIORITY=1 -DHAVE_STRERROR=1 -DHAVE_SYSCALL=1 -DHAVE_SECURE_GETENV=1 -D_REENTRANT=1 -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM /var/tmp/portage/dev-libs/nspr-4.35/work/nspr-4.35/nspr/config/now.c So the latter -O2 will overwrite my -O*, so if I would use -Os, it won't work
# cat /var/db/pkg/dev-libs/nspr-4.35/CFLAGS -march=native -O3 -pipe -flto=thin
(In reply to Joonas Niilola from comment #4) > # cat /var/db/pkg/dev-libs/nspr-4.35/CFLAGS > -march=native -O3 -pipe -flto=thin I don't think it works as you mean. These are your CFLAGS (from portage) used in the build and they are different from the flags actually used. The latest -O (appended from the build system) overwrites the previous
Man gcc says: If you use multiple -O options, with or without level numbers, the last such option is the one that is effective. you can also do a test with: gcc -c -Q -Os -O2 --help=optimizers > /tmp/Os gcc -c -Q -O2 --help=optimizers > /tmp/O2 diff -ru /tmp/Os /tmp/O2 There will be no differences because in both commands -O2 is used.
Hmm right this wasn't about CFLAGS not being respected. How do I enable this new QA check? Are there some QA project's notes about it somewhere?
... because is there a way to disable the check like QA_CONFIGURE_OPTIONS? I do have an easy fix but it's still going to put the -O* twice, will just match the 2nd with first one. But it's useless if the tinderbox will (falsely) report it again. And currently I don't know how to "reproduce" the issue, even though I understand where it's coming from.
(In reply to Joonas Niilola from comment #7) > Hmm right this wasn't about CFLAGS not being respected. How do I enable this > new QA check? Are there some QA project's notes about it somewhere? This is a custom check that I have enabled in the tinderbox. I didn't find a way to make it suitable for everyone. Basically you can double-check with naked-eye where you can see -O* after your CFLAGS/CXXFLAGS Another example here: bug 886989
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da32db6eb88ac45e3e3f441e187c8cd596538f03 commit da32db6eb88ac45e3e3f441e187c8cd596538f03 Author: Joonas Niilola <juippis@gentoo.org> AuthorDate: 2022-12-20 05:52:51 +0000 Commit: Joonas Niilola <juippis@gentoo.org> CommitDate: 2022-12-20 05:52:51 +0000 dev-libs/nspr: respect user's CFLAGS optimization - ... since there's a build system configure option for it. - reseted KEYWORDS due to hard to anticipate issues with different optimization levels. Bug: https://bugs.gentoo.org/886987 Signed-off-by: Joonas Niilola <juippis@gentoo.org> dev-libs/nspr/nspr-4.35-r1.ebuild | 159 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+)