Bug 12826

Summary: nodejs-12.16.1: error: 'uv_sleep' was not declared in this scope
Product: buildroot Reporter: Aleksandr Makarov <seems.deviant>
Component: OtherAssignee: Martin <martin>
Status: RESOLVED WORKSFORME    
Severity: normal CC: buildroot
Priority: P5    
Version: 2020.02.1   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Aleksandr Makarov 2020-04-29 10:18:14 UTC
Unable to build nodejs-12.16.1 package due to a compilation error.

For arm target, config is following:

BR2_arm=y
BR2_cortex_a8=y
BR2_ARM_FPU_NEON=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_NODEJS=y

And the error message is:

  /home/oleksandr/buildroot-git/output/nodejs-arm/host/bin/arm-buildroot-linux-gnueabihf-g++ -o /home/oleksandr/buildroot-git/output/nodejs-arm/build/nodejs-12.16.1/out/Release/obj.target/libnode/src/node_util.o ../src/node_util.cc '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNODE_ARCH="arm"' '-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' '-DHAVE_INSPECTOR=0' '-DNODE_REPORT' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DHAVE_OPENSSL=0' '-DHTTP_PARSER_STRICT=0' -I../src -I/home/oleksandr/buildroot-git/output/nodejs-arm/build/nodejs-12.16.1/out/Release/obj/gen -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/v8/include -I../deps/http_parser -I../deps/llhttp/include -I../deps/brotli/c/include  -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /home/oleksandr/buildroot-git/output/nodejs-arm/build/nodejs-12.16.1/out/Release/.deps//home/oleksandr/buildroot-git/output/nodejs-arm/build/nodejs-12.16.1/out/Release/obj.target/libnode/src/node_util.o.d.raw -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os   -c
../src/node_util.cc: In function 'void node::util::Sleep(const v8::FunctionCallbackInfo<v8::Value>&)':
../src/node_util.cc:176:3: error: 'uv_sleep' was not declared in this scope
   uv_sleep(msec);

Same happens if x86_64 target arch is set:

BR2_x86_64=y
BR2_x86_steamroller=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_NODEJS=y

Compilation fails with:

  /home/oleksandr/buildroot-git/output/nodejs-failure/host/bin/x86_64-buildroot-linux-gnu-g++ -o /home/oleksandr/buildroot-git/output/nodejs-failure/build/nodejs-12.16.1/out/Release/obj.target/libnode/src/node_util.o ../src/node_util.cc '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNODE_ARCH="x64"' '-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' '-DHAVE_INSPECTOR=0' '-DNODE_REPORT' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DHAVE_OPENSSL=0' '-DHTTP_PARSER_STRICT=0' -I/home/oleksandr/buildroot-git/output/nodejs-failure/host/x86_64-buildroot-linux-gnu/sysroot/home/oleksandr/buildroot-git/output/nodejs-failure/host/include -I../src -I/home/oleksandr/buildroot-git/output/nodejs-failure/build/nodejs-12.16.1/out/Release/obj/gen -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/v8/include -I../deps/http_parser -I../deps/llhttp/include -I../deps/brotli/c/include  -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /home/oleksandr/buildroot-git/output/nodejs-failure/build/nodejs-12.16.1/out/Release/.deps//home/oleksandr/buildroot-git/output/nodejs-failure/build/nodejs-12.16.1/out/Release/obj.target/libnode/src/node_util.o.d.raw -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os   -c
../src/node_util.cc: In function 'void node::util::Sleep(const v8::FunctionCallbackInfo<v8::Value>&)':
../src/node_util.cc:176:3: error: 'uv_sleep' was not declared in this scope
   uv_sleep(msec);
Comment 1 Thomas Petazzoni 2020-04-29 12:23:57 UTC
Thanks for the bug report. Is this with Buildroot master? Are you after commit 7d9ed0a19d8e88b56b389187c38b44563e33e5ab ? If so, could you revert 7d9ed0a19d8e88b56b389187c38b44563e33e5ab and try again ? Thanks!
Comment 2 Aleksandr Makarov 2020-04-29 18:08:27 UTC
Reverting the 7d9ed0a19d8e88b56b389187c38b44563e33e5ab does help to fix the issue 
 so that nodejs 12.16.1 builds
Comment 3 Thomas Petazzoni 2020-04-29 20:06:32 UTC
Thanks for testing! I have reported the issue back to the develop who contributed the libuv update that broke nodejs. Hopefully we will have a solution soon.
Comment 4 Thomas Petazzoni 2020-05-16 14:20:25 UTC
So, commit 7d9ed0a19d8e88b56b389187c38b44563e33e5ab is not the culprit, I'm not sure how it can have fixed the problem for you.

Are you sure this issue happens from a clean build ?
Comment 5 Peter Seiderer 2020-05-16 15:56:23 UTC
Add references to the libuv/uvw version bump (commit7d9ed0a19d8e88b56b389187c38b44563e33e5ab) mailing list discussion:

[1] http://lists.busybox.net/pipermail/buildroot/2020-April/281597.html
[2] http://lists.busybox.net/pipermail/buildroot/2020-May/281746.html
Comment 6 Thomas Petazzoni 2020-05-17 18:52:38 UTC
I am sorry, but neither Peter Seiderer nor myself have been able to reproduce the issue on 2020.02.1. I tested exactly the first defconfig you posted, and it builds fine.

The libuv version 2020.02.1 does implement uv_sleep(), both the libuv package and the libuv shipped with nodejs, so I don't see how your build failure could happen.

Are you sure you did a full rebuild with 2020.02.1 ?