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
changes to build for Android #1521
Conversation
Thank you for the PR. Would you mind elaborating why we need to include Other than that the changes look good to me. |
linux and ANDROID are both defined in an Android build. I'm excluding spawn.h only in the case of Android. This avoids having to include the sysroot/usr/include directory. I can add a variable to CMake like this, which avoids the #ifndef cases:
I like the CMake route if you're good with that. |
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.
Thank you for the answer. I missed the fact that n
was in the middle of ifndef
.
Could you please consider the following? I think that we do not need to include spawn.h at all, except for serverutil.h.
lib/common/serverutil.c
Outdated
@@ -25,7 +25,9 @@ | |||
#include <pthread.h> | |||
#include <pwd.h> | |||
#include <signal.h> | |||
#ifndef __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.
Could you please change this to #ifndef __linux__
? That's when we use our own implementation instead of posix_spawnp
.
lib/handler/access_log.c
Outdated
#include <spawn.h> | ||
#endif |
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.
Could you please remove #include <spawn.h>
as a whole and see what happens?
I believe that this is no longer needed; it was necessary when we called posix_spawnp
directly, but now we use h2o_spawnp
.
src/main.c
Outdated
#include <spawn.h> | ||
#endif |
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.
The same goes here as well.
Note with these build changes, it will produce a Uni-Proc server, as Android has a non-standard way of accessing CPU count. |
Thank you for the changes. Merged to master. And thank you for raising the concern about the number of CPU cores recognized. I think we can live with it; it's just be a matter of what the default value would be. |
Hello,
This PR enables building H2O for Android NDK r16 (Clang 5.0). Validated on devices in the range of 15 - 26 (armeabi-v7a, arm64-v8a, x86, x86_64).
Regards,
Joel