Skip to content
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

[FR] provides liblog.a in official Android NDK #1879

Open
leleliu008 opened this issue May 2, 2023 · 6 comments
Open

[FR] provides liblog.a in official Android NDK #1879

leleliu008 opened this issue May 2, 2023 · 6 comments

Comments

@leleliu008
Copy link

Description

some command-line tools can not be built as fully statically linked executable due to lack of liblog.a.

as a workaround, can I build it from AOSP?

@enh-google
Copy link
Collaborator

https://man7.org/linux/man-pages/man3/syslog.3.html would be the portable way to log from libc (and ends up in the same place).

@DanAlbert
Copy link
Member

The only downsides to syslog is that iirc you can only have one log tag per process, and that it'll only work (i.e. end up in logcat) for... M+? It's been a long time, but I think in the absolute oldest devices we support it won't work.

For the use case of static executables those don't actually sound like a problem. There may not be any point in providing liblog.a.

@leleliu008
Copy link
Author

leleliu008 commented May 3, 2023

Android L reimplement the loging system, the new implemention doesn't adapt to the old android devices, that's why they do not provide liblog.a

It seems that I have to implement it by myself.

@leleliu008
Copy link
Author

@enh-google
Copy link
Collaborator

if you're worried about pre-L like that golang code, note that the next release of the NDK won't support pre-L anyway...

@enh-google
Copy link
Collaborator

The only downsides to syslog is that iirc you can only have one log tag per process

(for the record, that's not strictly correct --- syslog() will use whatever tag the latest openlog() used. but of course if you have multiple threads trying to use multiple tags, you'll need to add some synchronization there, which may or may not be worth it.)

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

No branches or pull requests

3 participants