Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 886317 - sci-libs/vtk-9.2.2-r1 overwrites user's optimization (-O*)
Summary: sci-libs/vtk-9.2.2-r1 overwrites user's optimization (-O*)
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Science Related Packages
Depends on:
Reported: 2022-12-16 10:29 UTC by Agostino Sarubbo
Modified: 2022-12-17 09:49 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

build.log.xz (build.log.xz,139.59 KB, application/x-xz)
2022-12-16 10:29 UTC, Agostino Sarubbo

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-12-16 10:29:46 UTC

Issue: sci-libs/vtk-9.2.2-r1 overwrites user's optimization (-O*).
Discovered on: amd64 (internal ref: ci)

unless there are known issues with -O* configured by the user, the build system should not overwrite -O*.
Comment 1 Agostino Sarubbo gentoo-dev 2022-12-16 10:29:49 UTC
Created attachment 843111 [details]

build log and emerge --info (compressed because it exceeds attachment limit, use 'xzless' to read it)
Comment 2 Bernd 2022-12-16 11:19:56 UTC
Unfortunately the QA message isn't very helpful, as it doesn't show where these assumed optimizations are overridden.

The output at the end of the configure step looks like it respects the users optimization flags:

-- <<< Gentoo configuration >>>
Build type      RelWithDebInfo
Install path    /usr
Compiler flags:
C               -O2 -pipe -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 
C++             -O2 -pipe -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 
Linker flags:
Executable       -Wl,-lc  -Wl,-lc -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 
Module           -Wl,-lc  -Wl,-lc -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 
Shared           -Wl,-lc -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 

-- Configuring done

Flags from the provided emerge --info:

CFLAGS="-O2 -pipe -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0"
CXXFLAGS="-O2 -pipe -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0"

This doesn't look like they are overriden by the build system.

AFAIK the build system always respects the CMAKE_C{,XX}_FLAGS when adding additional values to it, with the exception of the vtkm module, which wasn't built with this setup and where I also provide a patch to fix it.
Comment 3 Agostino Sarubbo gentoo-dev 2022-12-16 11:28:37 UTC
[147/3311] /usr/bin/x86_64-pc-linux-gnu-g++ -DCommonMath_EXPORTS -DVTK_IN_VTK -Dkiss_fft_scalar=double -I/var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2_build/Common/Math -I/var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2/Common/Math -I/var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2_build/Common/Core -I/var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2/Common/Core -I/var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2_build/ThirdParty/kissfft/vtkkissfft -I/var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2/ThirdParty/kissfft/vtkkissfft -isystem /var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2_build/Utilities/KWIML -isystem /var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2/Utilities/KWIML -isystem /var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2_build/Utilities/KWSys -isystem /var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2/Utilities/KWSys -isystem /var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2_build/ThirdParty/kissfft -isystem /var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2/ThirdParty/kissfft  -O2 -pipe -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0  -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -std=c++11 -O0 -MD -MT Common/Math/CMakeFiles/CommonMath.dir/vtkPolynomialSolversUnivariate.cxx.o -MF Common/Math/CMakeFiles/CommonMath.dir/vtkPolynomialSolversUnivariate.cxx.o.d -o Common/Math/CMakeFiles/CommonMath.dir/vtkPolynomialSolversUnivariate.cxx.o -c /var/tmp/portage/sci-libs/vtk-9.2.2-r1/work/VTK-9.2.2/Common/Math/vtkPolynomialSolversUnivariate.cxx
Comment 4 Bernd 2022-12-17 09:49:43 UTC
This is explicitly added for that specific file only, so I assume it is needed. I couldn't find any other optimizations (O1, O3, Os) in the build log.
I'm going to ask upstream whether the options is still desired as needed, it's there for several years.