OS: ubuntu 24.10 GCC: 14.2.0 node: node-v20.9.0 from here Python: 3.11.0
PATH=/usr/local/Python-3.11.0/bin:$PATH ./configure --prefix=/usr/local/node-v20.9.0
make -j 64
-msign-return-address=all -pthread -Wno-unused-parameter -Wno-return-type -fno-strict-aliasing -O3 -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++17 -MMD -MF /home/benchmark/repos/node-v20.9.0/out/Release/.deps//home/benchmark/repos/node-v20.9.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/heap/cppgc/process-heap-statistics.o.d.raw -c
In file included from ../deps/v8/src/heap/cppgc/process-heap-statistics.h:9,
from ../deps/v8/src/heap/cppgc/process-heap-statistics.cc:5:
../deps/v8/src/heap/cppgc/stats-collector.h: In member function ‘void cppgc::internal::StatsCollector::ForAllAllocationObservers(Callback)’:
../deps/v8/src/heap/cppgc/stats-collector.h:401:48: error: cannot convert ‘std::vector<cppgc::internal::StatsCollector::AllocationObserver*>::iterator’ to ‘const char*’
401 | std::remove(allocation_observers_.begin(), allocation_observers_.end(),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| std::vector<cppgc::internal::StatsCollector::AllocationObserver*>::iterator
Broadly the cause of the compile error is that the node v20.9.0 LTS code base (released 2023-10-24), breaks with GCC 14.1 (released 2024-5-6) or later. Specifically,
some refactoring of the standard headers (which I haven't bothered to fathom), means that whereas prior to GCC 14 the header file node-v20.9.0/deps/v8/src/heap/cppgc/stats-collector.h
implicitly (recursively) #include
-ed the standard header <algorithm>
, since GCC 14 that is not the case, with the result that the <algorithm>
template definitions of std::remove
are not found when the failing statement:
std::remove(allocation_observers_.begin(), allocation_observers_.end(),
nullptr),
allocation_observers_.end());
is to be compiled at line 401 of stats-collector.h
. Instead, the <cstdio>
declaration of remove
is arrived at (because <cstdio>
is
still implicitly included), as you can observe in the full diagnostic:
In file included from ../deps/v8/src/heap/cppgc/sweeper.h:14,
from ../deps/v8/src/heap/cppgc/sweeper.cc:5:
../deps/v8/src/heap/cppgc/stats-collector.h: In member function ‘void cppgc::internal::StatsCollector::ForAllAllocationObservers(Callback)’:
../deps/v8/src/heap/cppgc/stats-collector.h:402:48: error: cannot convert ‘std::vector<cppgc::internal::StatsCollector::AllocationObserver*>::iterator’ to ‘const char*’
402 | std::remove(allocation_observers_.begin(), allocation_observers_.end(),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| std::vector<cppgc::internal::StatsCollector::AllocationObserver*>::iterator
In file included from /usr/include/c++/14/cstdio:42,
from /usr/include/c++/14/ext/string_conversions.h:45,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/istream:40,
from /usr/include/c++/14/sstream:40,
from ../deps/v8/src/base/logging.h:10,
from ../deps/v8/src/base/macros.h:12,
from ../deps/v8/src/heap/cppgc/sweeper.h:10:
/usr/include/stdio.h:158:32: note: initializing argument 1 of ‘int remove(const char*)’
158 | extern int remove (const char *__filename) __THROW;
| ~~~~~~~~~~~~^~~~~~~~~~
The <cstdio>
signature of course is not satisfied by the call at line 401.
This failure is fixed in the current node v23.5.0 (and possibly intervening releases - I haven't checked) by adding <algorithim>
to the
standard headers in stats-collector.h
, as per:
#include <algorithm> // <- added
#include <atomic>
#include <vector>
You could apply the same fix to v20.9.0 but if you are committed to a pristine v20.9.0 build then you can install GCC 13.3 and build with that: CXX=g++-13 ./configure ...
.