From 2e946901396ee30364a943eccc94be9a14b03881 Mon Sep 17 00:00:00 2001 From: Keyhan Vakil Date: Mon, 13 Mar 2023 02:54:21 +0000 Subject: [PATCH] src: fix clang 14 linker error Compiling with clang 14 on Ubuntu was failing with the following error: ```bash $ CXX=clang++ CC=clang ./configure --ninja $ make [7/14] LINK cctest FAILED: cctest clang++ /usr/bin/ld: obj/src/inspector/libnode.node_string.o: in function `node::inspector::protocol::StringUtil::StringViewToUtf8[abi:cxx11](v8_inspector::StringView)': node_string.cc:(.text+0x2ce): undefined reference to `node::MaybeStackBuffer::AllocateSufficientStorage(unsigned long)' /usr/bin/ld: obj/src/inspector/libnode.node_string.o: in function `node::inspector::protocol::StringUtil::fromUTF16[abi:cxx11](unsigned short const*, unsigned long)': node_string.cc:(.text+0xad9): undefined reference to `node::MaybeStackBuffer::AllocateSufficientStorage(unsigned long)' clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` I bisected it to the referenced PR. This change includes the header file which defines `node::MaybeStackBuffer::AllocateSufficientStorage`. Refs: https://github.com/nodejs/node/pull/46817 --- src/inspector/node_string.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/inspector/node_string.cc b/src/inspector/node_string.cc index 441d9a352eaca8..171ba04bef113b 100644 --- a/src/inspector/node_string.cc +++ b/src/inspector/node_string.cc @@ -2,6 +2,7 @@ #include "node/inspector/protocol/Protocol.h" #include "node_util.h" #include "simdutf.h" +#include "util-inl.h" namespace node { namespace inspector {