Skip to content

Android build fails for android when sdk < 33, due to missing symbols in execinfo.h #46952

Description

@wiresnips

Version

18.12.1

Platform

#1 SMP PREEMPT_DYNAMIC Wed Dec 21 23:21:50 UTC 2022

(I'd be surprised if this is what it ought to be, but it's what uname -v spat out.)

DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=22.0.0
DISTRIB_CODENAME=Sikaris
DISTRIB_DESCRIPTION="Manjaro Linux"

Subsystem

No response

What steps will reproduce the bug?

./android-configure <path-to-android-ndk> 30 arm64
make -j4

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

happens consistently

What is the expected behavior?

the build succeeds

What do you see instead?

  /home/ben/projects/owndir/android/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang++ -o /home/ben/projects/owndir/android/node/out/Release/obj.host/v8_libbase/deps/v8/src/base/platform/platform-linux.o ../deps/v8/src/base/platform/platform-linux.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DV8_TARGET_ARCH_ARM64' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_ANDROID' '-DV8_EMBEDDER_STRING="-node.12"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DOBJECT_PRINT' '-DV8_INTL_SUPPORT' '-DV8_ATOMIC_OBJECT_FIELD_WRITES' '-DV8_ENABLE_LAZY_SOURCE_POSITIONS' '-DV8_USE_SIPHASH' '-DV8_SHARED_RO_HEAP' '-DV8_WIN64_UNWINDING_INFO' '-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH' '-DV8_SNAPSHOT_COMPRESSION' '-DV8_ENABLE_WEBASSEMBLY' '-DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS' '-DV8_ALLOCATION_FOLDING' '-DV8_ALLOCATION_SITE_TRACKING' '-DV8_SCRIPTORMODULE_LEGACY_LIFETIME' '-DV8_ADVANCED_BIGINT_ALGORITHMS' '-DBUILDING_V8_BASE_SHARED' -I../deps/v8 -I../deps/v8/include  -msign-return-address=all -Wno-unused-parameter -Wno-return-type -pthread -fno-omit-frame-pointer -fPIC -fdata-sections -ffunction-sections -O2 -fno-rtti -fno-exceptions -std=gnu++17 -MMD -MF /home/ben/projects/owndir/android/node/out/Release/.deps//home/ben/projects/owndir/android/node/out/Release/obj.host/v8_libbase/deps/v8/src/base/platform/platform-linux.o.d.raw   -c
../deps/v8/src/base/debug/stack_trace_posix.cc:156:9: error: use of undeclared identifier 'backtrace_symbols'
        backtrace_symbols(trace, static_cast<int>(size)));
        ^
../deps/v8/src/base/debug/stack_trace_posix.cc:371:32: error: use of undeclared identifier 'backtrace'; did you mean 'StackTrace'?
  count_ = static_cast<size_t>(backtrace(trace_, arraysize(trace_)));
                               ^
../deps/v8/src/base/debug/stack_trace.h:41:22: note: 'StackTrace' declared here
class V8_BASE_EXPORT StackTrace {
                     ^
2 errors generated.
make[1]: *** [tools/v8_gypfiles/v8_libbase.host.mk:180: /home/ben/projects/owndir/android/node/out/Release/obj.host/v8_libbase/deps/v8/src/base/debug/stack_trace_posix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
rm a9ded5739176ee9e83e81dedc0bbd224599dadb5.intermediate a45bc5cdfe96f942e403387862c877f01229a97f.intermediate
make: *** [Makefile:134: node] Error 2

Additional information

in deps/v8/src/base/debug/stack_trace_posix.cc, there is the following:

#if V8_LIBC_GLIBC || V8_LIBC_BSD || V8_LIBC_UCLIBC || V8_OS_SOLARIS
#define HAVE_EXECINFO_H 1
#endif

#if HAVE_EXECINFO_H
#include <cxxabi.h>
#include <execinfo.h>
#endif
#if V8_OS_DARWIN
#include <AvailabilityMacros.h>
#endif

// ...

#if HAVE_EXECINFO_H
  // a bunch of code that relies on symbols from execinfo.h
#endif  // HAVE_EXECINFO_H

whereas, in android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/urs/include/execinfo.h, I see this:

#if __ANDROID_API__ >= 33
int backtrace(void** buffer, int size) __INTRODUCED_IN(33);
// ...
char** backtrace_symbols(void* const* buffer, int size) __INTRODUCED_IN(33);
// ...
void backtrace_symbols_fd(void* const* buffer, int size, int fd) __INTRODUCED_IN(33);
#endif /* __ANDROID_API__ >= 33 */

And so, if (one way or another), you end up with HAVE_EXECINFO_H, but NOT __ANDROID_API__ >= 33, it breaks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    androidIssues and PRs related to the Android platform.v8 engineIssues and PRs related to the V8 dependency.wrong repoIssues that should be opened in another repository.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions