nodejs / nodejs/node

nodejs 26.8.2 fails to build with clang/LLVM

Open Beginner friendly
#66,076 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

26.8.2

Platform
Linux (Gentoo with LLVM profile)
Subsystem

LIEF (or forzen)

What steps will reproduce the bug?
  1. Build nodejs version 26.8.2 with clang
  2. Observe failure
How often does it reproduce? Is there a required condition?

Always while building with clang

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

Successful build with clang

What do you see instead?

Build failure while building with Clang

A snippet from the build log:

...
In file included from ../../deps/LIEF/src/platforms/android/version.cpp:17:
In file included from ../../deps/LIEF/src/frozen.hpp:22:
../../deps/LIEF/third-party/frozen/include/frozen/map.h:40:20: error: implicit instantiation of undefined template 'std::less<LIEF::Android::ANDROID_VERSIONS>'
   40 |   Comparator const comparator_;
      |                    ^
../../deps/LIEF/third-party/frozen/include/frozen/map.h:75:29: note: in instantiation of template class 'frozen::impl::CompareKey<std::less<LIEF::Android::ANDROID_VERSIONS>>' requested here
   75 |   impl::CompareKey<Compare> less_than_;
      |                             ^
../../deps/LIEF/src/platforms/android/version.cpp:22:47: note: in instantiation of template class 'frozen::map<LIEF::Android::ANDROID_VERSIONS, const char *, 8>' requested here
   22 |   CONST_MAP(ANDROID_VERSIONS, const char*, 8) version2code {
      |                                               ^
/usr/include/c++/v1/__fwd/functional.h:25:8: note: template is declared here
   25 | struct less;
      |        ^
In file included from ../../deps/LIEF/src/platforms/android/version.cpp:17:
In file included from ../../deps/LIEF/src/frozen.hpp:22:
../../deps/LIEF/third-party/frozen/include/frozen/map.h:110:20: error: implicit instantiation of undefined template 'std::less<LIEF::Android::ANDROID_VERSIONS>'
  110 |       : map{items, Compare{}} {}
      |                    ^
../../deps/LIEF/src/platforms/android/version.cpp:22:47: note: in instantiation of member function 'frozen::map<LIEF::Android::ANDROID_VERSIONS, const char *, 8>::map' requested here
   22 |   CONST_MAP(ANDROID_VERSIONS, const char*, 8) version2code {
      |                                               ^
/usr/include/c++/v1/__fwd/functional.h:25:8: note: template is declared here
   25 | struct less;
      |        ^
../../deps/LIEF/src/platforms/android/version.cpp:22:47: error: constexpr variable 'version2code' must be initialized by a constant expression
   22 |   CONST_MAP(ANDROID_VERSIONS, const char*, 8) version2code {
...
Additional information

I think this is due to stricter include requirements on clang
I was able to build by adding #include <functional> in deps/LIEF/third-party/frozen/include/frozen/map.h

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with deps/LIEF/third-party/frozen/include/frozen/map.h, then reproduce the Node.js 26.8.2 build on Linux with Clang. Check the standard-library dependency reported in the error and verify that the build completes successfully with Clang without the undefined std::less errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux, nodejs
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.