diff --git a/common.gypi b/common.gypi index 78a57d929198be..a934b4e626ec51 100644 --- a/common.gypi +++ b/common.gypi @@ -156,8 +156,8 @@ 'ldflags': [ '-Wl,-bbigtoc' ], }], ['OS == "android"', { - 'cflags': [ '-fPIE' ], - 'ldflags': [ '-fPIE', '-pie' ] + 'cflags': [ '-fPIC' ], + 'ldflags': [ '-fPIC' ] }], ], 'msvs_settings': { @@ -216,8 +216,8 @@ ], },], ['OS == "android"', { - 'cflags': [ '-fPIE' ], - 'ldflags': [ '-fPIE', '-pie' ] + 'cflags': [ '-fPIC' ], + 'ldflags': [ '-fPIC' ] }], ], 'msvs_settings': { diff --git a/configure.py b/configure.py index f1badfdb932bb9..d8e27a2231f1fd 100755 --- a/configure.py +++ b/configure.py @@ -1103,14 +1103,17 @@ def configure_node(o): o['variables']['node_shared'] = b(options.shared) node_module_version = getmoduleversion.get_version() - if sys.platform == 'darwin': + if options.dest_os == 'android': + shlib_suffix = 'so' + elif sys.platform == 'darwin': shlib_suffix = '%s.dylib' elif sys.platform.startswith('aix'): shlib_suffix = '%s.a' else: shlib_suffix = 'so.%s' + if '%s' in shlib_suffix: + shlib_suffix %= node_module_version - shlib_suffix %= node_module_version o['variables']['node_module_version'] = int(node_module_version) o['variables']['shlib_suffix'] = shlib_suffix diff --git a/src/node_errors.cc b/src/node_errors.cc index d3a409b1ab455a..4fe7edea8a8886 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -10,6 +10,10 @@ #include "node_v8_platform-inl.h" #include "util-inl.h" +#ifdef __ANDROID__ +#include +#endif + namespace node { using errors::TryCatchScope; @@ -413,6 +417,8 @@ void PrintErrorString(const char* format, ...) { // Don't include the null character in the output CHECK_GT(n, 0); WriteConsoleW(stderr_handle, wbuf.data(), n - 1, nullptr, nullptr); +#elif defined(__ANDROID__) + __android_log_vprint(ANDROID_LOG_ERROR, "nodejs", format, ap); #else vfprintf(stderr, format, ap); #endif