Nodejs未在buildroot中生成,因为尚未声明“va_list”

eoigrqb6  于 2023-01-30  发布在  Node.js
关注(0)|答案(1)|浏览(164)

我尝试为Radxa Zero SBC构建一个带有nodejs的嵌入式Linux。我通过Target packages ---> Interpreter languages and scripting > nodejsNPM for the target包含了nodejs。在构建过程中,我得到了一个错误,因为缺少一些变量。因此编译失败。我有一个没有nodejs的可引导映像。如果我调整包buildroot-2022.11/package/nodejs/nodejs.mk以下载和编译nodejs 18,也会发生完全相同的错误。在Ubuntu 20.04和Fedora 37上试过。我试过使用其他binutils和gcc版本。
构建过程失败于:

...
FAILED: obj/deps/v8/src/base/numbers/v8_libbase.bignum.o
...
In file included from ../../deps/v8/src/base/numbers/bignum.cc:7:
../../deps/v8/src/base/strings.h:23:53: error: ‘va_list’ has not been declared
   23 |     VSNPrintF(Vector<char> str, const char* format, va_list args);
      |                                                     ^~~~~~~

以及

...
FAILED: obj/deps/v8/src/base/v8_libbase.strings.o
...
In file included from ../../deps/v8/src/base/strings.cc:5:
../../deps/v8/src/base/strings.h:23:53: error: ‘va_list’ has not been declared
   23 |     VSNPrintF(Vector<char> str, const char* format, va_list args);
      |                                                     ^~~~~~~

我完全不知道该怎么办。似乎有些宏没有设置,所以有些东西不见了。
全输出:

aarch64-buildroot-linux-uclibc-gcc.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[44/2686] CXX obj/deps/v8/src/base/numbers/v8_libbase.dtoa.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[45/2686] CXX obj/deps/v8/src/base/numbers/v8_libbase.bignum.o
FAILED: obj/deps/v8/src/base/numbers/v8_libbase.bignum.o 
/home/andreas/buildroot_radxa/buildroot-2022.11/output/host/bin/aarch64-buildroot-linux-uclibc-g++ -MMD -MF obj/deps/v8/src/base/numbers/v8_libbase.bignum.o.d -D_GLIBCXX_USE_CXX11_ABI=1 -DNODE_OPENSSL_CONF_NAME=nodejs_conf -DV8_GYP_BUILD -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -D__STDC_FORMAT_MACROS -DV8_TARGET_ARCH_ARM64 -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_LINUX '-DV8_EMBEDDER_STRING="-node.22"' -DENABLE_DISASSEMBLER -DV8_PROMISE_INTERNAL_FIELD_COUNT=1 -DENABLE_MINOR_MC -DOBJECT_PRINT -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ATOMIC_MARKING_STATE -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_USE_SIPHASH -DDISABLE_UNTRUSTED_CODE_MITIGATIONS -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_SNAPSHOT_COMPRESSION -DV8_ENABLE_WEBASSEMBLY -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DBUILDING_V8_BASE_SHARED -I../../deps/v8 -I../../deps/v8/include -msign-return-address=all -pthread -Wno-unused-parameter -Wno-return-type -fno-strict-aliasing -O3 -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -fno-rtti -fno-exceptions -std=gnu++14  -c ../../deps/v8/src/base/numbers/bignum.cc -o obj/deps/v8/src/base/numbers/v8_libbase.bignum.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
In file included from ../../deps/v8/src/base/numbers/bignum.cc:7:
../../deps/v8/src/base/strings.h:23:53: error: ‘va_list’ has not been declared
   23 |     VSNPrintF(Vector<char> str, const char* format, va_list args);
      |                                                     ^~~~~~~
[46/2686] CXX obj/deps/v8/src/base/v8_libbase.bounded-page-allocator.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[47/2686] CXX obj/deps/v8/src/base/platform/v8_libbase.platform-posix-time.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[48/2686] CXX obj/deps/v8/src/base/numbers/v8_libbase.fixed-dtoa.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[49/2686] CXX obj/deps/v8/src/base/v8_libbase.ieee754.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[50/2686] CXX obj/deps/v8/src/base/numbers/v8_libbase.strtod.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[51/2686] CXX obj/deps/v8/src/base/platform/v8_libbase.condition-variable.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[52/2686] CXX obj/deps/v8/src/base/v8_libbase.logging.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[53/2686] CC obj.host/deps/v8/third_party/zlib/v8_zlib.deflate.o
aarch64-buildroot-linux-uclibc-gcc.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[54/2686] CXX obj/deps/v8/src/base/platform/v8_libbase.semaphore.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[55/2686] CXX obj/deps/v8/src/base/platform/v8_libbase.mutex.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[56/2686] CXX obj/deps/v8/src/base/numbers/v8_libbase.fast-dtoa.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[57/2686] CXX obj/deps/v8/src/base/numbers/v8_libbase.bignum-dtoa.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[58/2686] CXX obj/deps/v8/src/base/sanitizer/v8_libbase.lsan-page-allocator.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[59/2686] CXX obj/deps/v8/src/base/v8_libbase.vlq-base64.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[60/2686] CXX obj/deps/v8/src/base/v8_libbase.page-allocator.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[61/2686] CXX obj/deps/v8/src/base/v8_libbase.strings.o
FAILED: obj/deps/v8/src/base/v8_libbase.strings.o 
/home/andreas/buildroot_radxa/buildroot-2022.11/output/host/bin/aarch64-buildroot-linux-uclibc-g++ -MMD -MF obj/deps/v8/src/base/v8_libbase.strings.o.d -D_GLIBCXX_USE_CXX11_ABI=1 -DNODE_OPENSSL_CONF_NAME=nodejs_conf -DV8_GYP_BUILD -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -D__STDC_FORMAT_MACROS -DV8_TARGET_ARCH_ARM64 -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_LINUX '-DV8_EMBEDDER_STRING="-node.22"' -DENABLE_DISASSEMBLER -DV8_PROMISE_INTERNAL_FIELD_COUNT=1 -DENABLE_MINOR_MC -DOBJECT_PRINT -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ATOMIC_MARKING_STATE -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_USE_SIPHASH -DDISABLE_UNTRUSTED_CODE_MITIGATIONS -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_SNAPSHOT_COMPRESSION -DV8_ENABLE_WEBASSEMBLY -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DBUILDING_V8_BASE_SHARED -I../../deps/v8 -I../../deps/v8/include -msign-return-address=all -pthread -Wno-unused-parameter -Wno-return-type -fno-strict-aliasing -O3 -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -fno-rtti -fno-exceptions -std=gnu++14  -c ../../deps/v8/src/base/strings.cc -o obj/deps/v8/src/base/v8_libbase.strings.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
In file included from ../../deps/v8/src/base/strings.cc:5:
../../deps/v8/src/base/strings.h:23:53: error: ‘va_list’ has not been declared
   23 |     VSNPrintF(Vector<char> str, const char* format, va_list args);
      |                                                     ^~~~~~~
[62/2686] CXX obj/deps/v8/src/base/v8_libbase.sys-info.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[63/2686] CXX obj/deps/v8/src/base/platform/v8_libbase.time.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[64/2686] CXX obj/deps/v8/src/base/utils/v8_libbase.random-number-generator.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[65/2686] CXX obj/deps/v8/src/base/v8_libbase.region-allocator.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
[66/2686] CXX obj/deps/v8/src/base/platform/v8_libbase.platform-posix.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
ninja: build stopped: subcommand failed.
make[2]: *** [Makefile:128: node] Error 1
make[1]: *** [package/pkg-generic.mk:293: /home/andreas/buildroot_radxa/buildroot-2022.11/output/build/nodejs-16.18.1/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2

我尝试使用其他binutils和gcc版本。

xdyibdwo

xdyibdwo1#

来自@robertklep的评论帮助解决了这个问题。不幸的是产生了另一个错误(FAILED: obj/src/node.node_main.o)。
按照注解中的建议修改文件:

vim buildroot-2022.11/output/build/nodejs-16.18.1/deps/v8/src/base/strings.h

修改:

[...]
#ifndef V8_BASE_STRINGS_H_
#define V8_BASE_STRINGS_H_

#include <cstdarg> // <-- Add this line 

#include "src/base/base-export.h"
#include "src/base/macros.h"
#include "src/base/vector.h"
[...]

我仍然很好奇为什么这个错误发生,因为源代码是从上游下载的Buildroot。

    • 新错误:**
[9/23] CXX obj/src/node.node_main.o
FAILED: obj/src/node.node_main.o 
/home/andreas/buildroot_radxa/buildroot-2022.11/output/host/bin/aarch64-buildroot-linux-uclibc-g++ -MMD -MF obj/src/node.node_main.o.d -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -D_GLIBCXX_USE_CXX11_ABI=1 -DNODE_OPENSSL_CONF_NAME=nodejs_conf -D__STDC_FORMAT_MACROS '-DNODE_ARCH="arm64"' '-DNODE_PLATFORM="linux"' -DNODE_WANT_INTERNALS=1 -D__POSIX__ -DNODE_USE_V8_PLATFORM=1 -DHAVE_OPENSSL=1 -DOPENSSL_API_COMPAT=0x10000000L -I../../src -I../../deps/v8/include -I../../deps/histogram/src -I../../deps/uvwasi/include -I../../deps/llhttp/include -I../../deps/brotli/c/include -Wall -Wextra -Wno-unused-parameter -msign-return-address=all -pthread -Wall -Wextra -Wno-unused-parameter -O3 -fno-omit-frame-pointer -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O1 -g0 -fno-rtti -fno-exceptions -std=gnu++14  -c ../../src/node_main.cc -o obj/src/node.node_main.o
aarch64-buildroot-linux-uclibc-g++.br_real: warning: switch ‘-msign-return-address=all’ is no longer supported
../../src/node_main.cc:92:10: fatal error: sys/auxv.h: No such file or directory
   92 | #include <sys/auxv.h>
      |          ^~~~~~~~~~~~

当我在我的主文件夹中编写一个"Hello World"程序并使用#include <sys/auxv.h>时,它使用g ++编译,VSCode解析它。

相关问题