Skip to content

Upgrade to libuv 1.44.2 requires -D_GNU_SOURCE build flag on Android #46743

@nappy

Description

@nappy

Version

18.14.1

Platform

android

Subsystem

build / deps

What steps will reproduce the bug?

Crosscompiling for Android.

How often does it reproduce? Is there a required condition?

100%

What is the expected behavior?

Build succeeding.

What do you see instead?

/home/nappy/ndks/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi23-clang -o /home/nappy/node/out/Release/obj.target/libuv/deps/uv/src/unix/getnameinfo.o ../deps/uv/src/unix/getnameinfo.c '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DICU_NO_USER_DATA_OVERRIDE' '-D__STDC_FORMAT_MACROS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_GLIBCXX_USE_C99_MATH' -I../deps/uv/include -I../deps/uv/src  -Wall -Wextra -Wno-unused-parameter -fvisibility=hidden -g --std=gnu89 -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes -fno-strict-aliasing -O3 -fno-omit-frame-pointer -fPIC  -MMD -MF /home/nappy/node/out/Release/.deps//home/nappy/node/out/Release/obj.target/libuv/deps/uv/src/unix/getnameinfo.o.d.raw -I/home/nappy/openssl/include -fPIE -fPIC -c    
In file included from <built-in>:385:
../deps/uv/src/unix/core.c:1632:3: error: use of undeclared identifier 'cpu_set_t'
  cpu_set_t set;
  ^
../deps/uv/src/unix/core.c:1635:26: error: use of undeclared identifier 'set'
  memset(&set, 0, sizeof(set));
                         ^
../deps/uv/src/unix/core.c:1635:11: error: use of undeclared identifier 'set'
  memset(&set, 0, sizeof(set));
          ^
../deps/uv/src/unix/core.c:1641:12: warning: implicit declaration of function 'sched_getaffinity' [-Wimplicit-function-declaration]
  if (0 == sched_getaffinity(0, sizeof(set), &set))
           ^
../deps/uv/src/unix/core.c:1641:40: error: use of undeclared identifier 'set'
  if (0 == sched_getaffinity(0, sizeof(set), &set))
                                       ^
../deps/uv/src/unix/core.c:1641:47: error: use of undeclared identifier 'set'
  if (0 == sched_getaffinity(0, sizeof(set), &set))
                                              ^
../deps/uv/src/unix/core.c:1642:10: warning: implicit declaration of function 'CPU_COUNT' [-Wimplicit-function-declaration]
    rc = CPU_COUNT(&set);
         ^
../deps/uv/src/unix/core.c:1642:21: error: use of undeclared identifier 'set'
    rc = CPU_COUNT(&set);
                    ^
1 warning generated.
3 warnings and 6 errors generated

Additional information

Adding -D_GNU_SOURCE to the build flags, as proposed by libuv/libuv#3499 (comment) resolves the issue. @lpinca

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions