-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Android support #374
Add Android support #374
Conversation
@@ -157,6 +162,10 @@ include_directories( | |||
${UTEMPTER_INCLUDE_DIR} | |||
) | |||
|
|||
IF(NOT ANDROID) | |||
include_directories( external/UniversalStacktrace/ust ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No libexecinfo on Android.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ust uses libunwind now, can you try latest master and tell me what error you get if any?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to work, as Android uses the LLVM libunwind but UniversalStacktrace seems to expect the nongnu one? I get errors about missing symbols like UNW_REG_IP
when compiling, after changing external/UniversalStacktrace/ust/ust.hpp
to include unwind.h
instead of libunwind.h
.
@@ -288,7 +296,7 @@ inline string GetTempDirectory() { | |||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> > converter; | |||
std::string tmpDir = converter.to_bytes(wstring(buf, retval)); | |||
#else | |||
string tmpDir = "/tmp"; | |||
string tmpDir = _PATH_TMP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds a trailing slash, the Windows one may need to be checked for that.
@@ -12,7 +12,7 @@ int TcpSocketHandler::connect(const SocketEndpoint &endpoint) { | |||
memset(&hints, 0, sizeof(addrinfo)); | |||
hints.ai_family = AF_UNSPEC; | |||
hints.ai_socktype = SOCK_STREAM; | |||
#if __NetBSD__ | |||
#if defined(__NetBSD__) || defined(__ANDROID__) | |||
hints.ai_flags = (AI_CANONNAME | AI_ADDRCONFIG); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted on SO, Android doesn't support these flags just like BSD, which is where its source comes from.
@@ -34,6 +34,8 @@ | |||
#include <sys/time.h> | |||
#endif /* HAVE_SYS_TIME_H */ | |||
|
|||
#include "Headers.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was missing when cross-compiling to Android, but is reproducible on linux too if cotire is turned off. I guess precompiling the headers pulls in other headers that weren't included originally.
@@ -157,6 +162,10 @@ include_directories( | |||
${UTEMPTER_INCLUDE_DIR} | |||
) | |||
|
|||
IF(NOT ANDROID) | |||
include_directories( external/UniversalStacktrace/ust ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ust uses libunwind now, can you try latest master and tell me what error you get if any?
@@ -64,9 +64,9 @@ int main(int argc, char** argv) { | |||
el::Loggers::setVerboseLevel(3); | |||
// default max log file size is 20MB for etserver | |||
string maxlogsize = "20971520"; | |||
LogHandler::setupLogFile(&defaultConf, "/tmp/htm.log", maxlogsize); | |||
LogHandler::setupLogFile(&defaultConf, GetTempDirectory() + "htm.log", maxlogsize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up!
Updated to replace |
I found the cause of |
Works both completely locally in Termux without root, and when connecting to a linux server. Only remaining issue is that
etserver --help
doesn't work: I think that's becausecxxopts
is incompatible with LLVM libc++, as this patch runs fine on linux x86_64 with GNU libstdc++. I will look into that and patch that last bug later.