Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PGO] [BUILD] Compilation fails with --enable-pgo-use #55852

Closed
ptr1337 opened this issue Nov 14, 2024 · 6 comments
Closed

[PGO] [BUILD] Compilation fails with --enable-pgo-use #55852

ptr1337 opened this issue Nov 14, 2024 · 6 comments

Comments

@ptr1337
Copy link

ptr1337 commented Nov 14, 2024

Version

23.2.0

Platform

6.11.7

Subsystem

No response

What steps will reproduce the bug?

Archlinux enviroment:

git clone https://github.com/cachyos/cachyos-pkgbuilds
cd nodejs
makepkg -si

How often does it reproduce? Is there a required condition?

All time

What is the expected behavior? Why is that the expected behavior?

Compilation is successful

What do you see instead?

The profile is gathered with "make test". See here:
https://github.com/CachyOS/CachyOS-PKGBUILDS/blob/master/nodejs/PKGBUILD#L53-L83

This issue has been started with node 23.1 - before the compilation was successful
Compilation fails at the second compilation with the PGO profile:

../deps/ada/ada.cpp:13698:6: error: number of counters in profile data for function ‘ada::url_aggregator::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘arcs’, expected 246 and have 244) [-Werror=coverage-mismatch]
13698 | bool url_aggregator::set_host_or_hostname(const std::string_view input) {
      |      ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:13698:6: error: the control flow of function ‘ada::url_aggregator::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url_aggregator::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’:
../deps/ada/ada.cpp:13698:6: error: number of counters in profile data for function ‘ada::url_aggregator::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘arcs’, expected 251 and have 249) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp:13698:6: error: the control flow of function ‘ada::url_aggregator::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’:
../deps/ada/ada.cpp:11912:6: error: the control flow of function ‘ada::url::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
11912 | bool url::set_host_or_hostname(const std::string_view input) {
      |      ^~~
../deps/ada/ada.cpp:11912:6: error: the control flow of function ‘ada::url::set_host_or_hostname<true>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’:
../deps/ada/ada.cpp:11912:6: error: the control flow of function ‘ada::url::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp:11912:6: error: the control flow of function ‘ada::url::set_host_or_hostname<false>(std::basic_string_view<char, std::char_traits<char> >)bool’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In function ‘ada::parser::parse_url_impl<ada::url_aggregator, false>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’:
../deps/ada/ada.cpp:12144:13: error: number of counters in profile data for function ‘ada::parser::parse_url_impl<ada::url_aggregator, false>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’ does not match its profile data (counter ‘arcs’, expected 601 and have 596) [-Werror=coverage-mismatch]
12144 | result_type parse_url_impl(std::string_view user_input,
      |             ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:12144:13: error: the control flow of function ‘ada::parser::parse_url_impl<ada::url_aggregator, false>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url_aggregator::consume_prepared_path(std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:14751:13: error: the control flow of function ‘ada::url_aggregator::consume_prepared_path(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
14751 | inline void url_aggregator::consume_prepared_path(std::string_view input) {
      |             ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:14751:13: error: the control flow of function ‘ada::url_aggregator::consume_prepared_path(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
  g++ -o /tmp/pkg/src/node/out/Release/obj.target/v8_libbase/deps/v8/src/base/platform/semaphore.o ../deps/v8/src/base/platform/semaphore.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DICU_NO_USER_DATA_OVERRIDE' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D__STDC_FORMAT_MACROS' '-DV8_TARGET_ARCH_X64' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_LINUX' '-DV8_EMBEDDER_STRING="-node.11"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DV8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION' '-DV8_SHORT_BUILTIN_CALLS' '-DOBJECT_PRINT' '-DV8_INTL_SUPPORT' '-DV8_ATOMIC_OBJECT_FIELD_WRITES' '-DV8_ENABLE_LAZY_SOURCE_POSITIONS' '-DV8_USE_SIPHASH' '-DV8_SHARED_RO_HEAP' '-DNDEBUG' '-DV8_WIN64_UNWINDING_INFO' '-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH' '-DV8_USE_ZLIB' '-DV8_ENABLE_SPARKPLUG' '-DV8_ENABLE_MAGLEV' '-DV8_ENABLE_TURBOFAN' '-DV8_ENABLE_WEBASSEMBLY' '-DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS' '-DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA' '-DV8_ALLOCATION_FOLDING' '-DV8_ALLOCATION_SITE_TRACKING' '-DV8_ADVANCED_BIGINT_ALGORITHMS' '-DBUILDING_V8_BASE_SHARED' -I../deps/v8 -I../deps/v8/include  -pthread -Wno-unused-parameter -Wno-strict-overflow -Wno-return-type -Wno-int-in-bool-context -Wno-deprecated -Wno-stringop-overflow -Wno-stringop-overread -Wno-restrict -Wno-array-bounds -Wno-nonnull -Wno-dangling-pointer -flax-vector-conversions -m64 -m64 -O3 -flto=4 -fuse-linker-plugin -ffat-lto-objects -fno-omit-frame-pointer -fprofile-use -fprofile-correction -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -fno-strict-aliasing -std=gnu++20 -Wno-invalid-offsetof -MMD -MF /tmp/pkg/src/node/out/Release/.deps//tmp/pkg/src/node/out/Release/obj.target/v8_libbase/deps/v8/src/base/platform/semaphore.o.d.raw  -march=native -O3 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -mpclmul -fno-semantic-interposition -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/tmp/pkg/src=/usr/src/debug/nodejs -fno-semantic-interposition -c
../deps/ada/ada.cpp: In member function ‘ada::url_aggregator::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:13392:6: error: the control flow of function ‘ada::url_aggregator::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
13392 | bool url_aggregator::set_protocol(const std::string_view input) {
      |      ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:13392:6: error: the control flow of function ‘ada::url_aggregator::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In function ‘ada::parser::parse_url_impl<ada::url_aggregator, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’:
../deps/ada/ada.cpp:12144:13: error: the control flow of function ‘ada::parser::parse_url_impl<ada::url_aggregator, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
12144 | result_type parse_url_impl(std::string_view user_input,
      |             ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:12144:13: error: the control flow of function ‘ada::parser::parse_url_impl<ada::url_aggregator, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url_aggregator const*)ada::url_aggregator’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In function ‘ada::parser::parse_url_impl<ada::url, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url const*)ada::url’:
../deps/ada/ada.cpp:12144:13: error: number of counters in profile data for function ‘ada::parser::parse_url_impl<ada::url, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url const*)ada::url’ does not match its profile data (counter ‘arcs’, expected 747 and have 740) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp:12144:13: error: the control flow of function ‘ada::parser::parse_url_impl<ada::url, true>(std::basic_string_view<char, std::char_traits<char> >, ada::url const*)ada::url’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:12091:6: error: the control flow of function ‘ada::url::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’) [-Werror=coverage-mismatch]
12091 | bool url::set_protocol(const std::string_view input) {
      |      ^~~
../deps/ada/ada.cpp:12091:6: error: the control flow of function ‘ada::url::set_protocol(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In member function ‘ada::url::set_pathname(std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:12082:6: error: number of counters in profile data for function ‘ada::url::set_pathname(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’, expected 428 and have 424) [-Werror=coverage-mismatch]
12082 | bool url::set_pathname(const std::string_view input) {
      |      ^~~
../deps/ada/ada.cpp:12082:6: error: the control flow of function ‘ada::url::set_pathname(std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
../deps/ada/ada.cpp: In function ‘ada::href_from_file[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >)’:
../deps/ada/ada.cpp:10366:13: error: number of counters in profile data for function ‘ada::href_from_file[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘arcs’, expected 206 and have 202) [-Werror=coverage-mismatch]
10366 | std::string href_from_file(std::string_view input) {
      |             ^~~~~~~~~~~~~~
../deps/ada/ada.cpp:10366:13: error: the control flow of function ‘ada::href_from_file[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >)’ does not match its profile data (counter ‘time_profiler’) [-Werror=coverage-mismatch]
  g++ 

Additional information

No response

@RedYetiDev
Copy link
Member

Can you reproduce this without the external installation script? Just by building manually?

@anonrig
Copy link
Member

anonrig commented Nov 14, 2024

can you open an issue to github.com/ada-url/ada? any ideas @lemire?

@ptr1337
Copy link
Author

ptr1337 commented Nov 14, 2024

I have checked right now, if disabling shared-zlib helps, since we recently switched to zlib-ng, but that does not seem to help.
Ill try a local compilation without the PKGBUILD on the weekend.

@ptr1337
Copy link
Author

ptr1337 commented Nov 14, 2024

Here is also the complete build log, in case you need it.

nodejs-pgo-build.txt

@lemire
Copy link
Member

lemire commented Nov 14, 2024

The reporter gets a warning due to -Wcoverage-mismatch.

Here is the GCC documentation

Warn if feedback profiles do not match when using the -fprofile-use option. If a source file is changed between compiling with -fprofile-generate and with -fprofile-use, the files with the profile feedback can fail to match the source file and GCC cannot use the profile feedback information. By default, this warning is enabled and is treated as an error. -Wno-coverage-mismatch can be used to disable the warning or -Wno-error=coverage-mismatch can be used to disable the error.

The most likely explanation is that user is using profile data from one version of the source, and then (likely by accident) trying to use it for profile-guided optimization with another version of the source code.

@ptr1337
Copy link
Author

ptr1337 commented Nov 15, 2024

Yes, this helps. Thank you :)

@ptr1337 ptr1337 closed this as completed Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants