问题标签 [bionic]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c - 检查备用信号堆栈(分配它的不同方法)
我正在尝试备用信号堆栈(man sigaltstack
)。
两段代码以不同方式分配堆栈:
我只是在注册信号时使用了 SA_ONSTACK 。在调度信号线程时,在 pthread_create 中,如果设置了此标志,则按如下方式分配 8kb 的堆栈(SIGSTKSZ = 0x2000(8kb)):
另一种做同样事情的方法,都是在注册信号处理程序的同时。
在这种情况下,我不依赖仿生为我分配默认堆栈。我正在分配我自己的堆栈并使用它。
因此,在这两种情况下,我都分配了 8kb 的信号堆栈。
我已经放置了一个while(1)
内部信号处理程序,并proc/pid/maps
在向进程发送信号后进行了检查。
以下是结果:
方法一(pthread_create中仿生分配的栈):
方法 2(应用程序使用 malloc 分配的堆栈):
奇怪的是,虽然我在方法 2 中使用 malloc() 只分配了 8kb 的堆栈,但堆栈似乎已经分配了大约 2MB(0x200000)。
请就出了什么问题或预期的行为向我提出建议。
android - Using a new method in latest Android NDK libc
I'm using the latest version of the NDK (as of a few weeks ago), r10d, and using the build tools to build python and some extensions in python. Using the build tools, I create a shared object that then gets linked into my project in Android Studio. In my build environment outside of Android studio, where I build the embedded Python library, I use the latest platform automatically, so in this case it is using NDK_ROOT/platforms/android-21.
All built fine, but then it crashed on a device running 4.4.4 with the error: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "epoll_create1" referenced by "libMyNativeIntfc.so"...
So, doing some research, I see that one of my python extensions uses this method, and it is defined in the NDK's sys/epoll.h. However, it was added to bionic in platform android-21 (I'm surprised I haven't encountered this already as I've been building since API 16). In previous platform libraries, the method is not exported. So I believe this method was just added to the latest android-21 libc (I verified it exists in the android-21 libc.a library and headers but not android-19 and below.
I'm looking for a bit of advice for the best way forward. As it stands, I think there are a couple of options. 1) Build against android-20 NDK platform instead, in which case my configure scripts will cull out the use of the method in my extension, and all will be happy. 2) Change the extension code to call epoll_create() instead, but I really would like to keep it the same as the upstream repo. 3) Link against the static libc.a in the android-21 usr/lib directory...now this one I'm a bit wary of. Would this be okay?
Thanks, Chris
android - 仿生中缺少的功能
我交叉编译haskell以在Android上运行。经过几天的挣扎,我唯一剩下的问题是Android(仿生)上的libc缺少glibc中的一些功能。更准确地说,getnetent、setnetent、endnetent、getprotoent、setprotoent、endprotoent、sethostent 和 endhostent。
在我看来,我有两个选择。我要么尝试交叉编译 glibc 并将其静态链接到我的程序中。一些谷歌搜索表明这可能有效。一个更简单的解决方案可能是自己编写这些函数。但是我对 libc 不够熟悉,不知道这是否可能?我也找不到这些函数的 C 代码
android-ndk - 如何将libc添加到android应用程序?
我正在编写一个我希望使用 ndk 在 android 中运行的 C 代码。我在代码中有 glibc 库,据我所知很难直接移植。因此,我尝试从 github 的仿生存储库中改用 libc。我在构建它时遇到了许多错误。
任何人都可以解释如何在一步一步的过程中包含 libc(或引导我找到一些来源)。我进行了很多搜索,但无法在任何地方找到教程。
这些是我得到的错误:
如何解决?谢谢!
android - 如何停止 android 系统并在 Android 中启动特定应用程序
我用 C 编写了一个应用程序,静态链接而不使用任何 android 服务或框架。它只是使用内核和libc提供的API。我想停止所有 android 服务、框架并在发生某些事件时启动我的应用程序。有没有办法修改android的init.rc来做到这一点?
注意:我正在修改 AOSP,因此可以修改 android 的任何部分。
android - 在 x86_64 linux 机器上编译 gentoo-bionic
您可能知道,Bionic是 Google 用来运行 Android 应用程序的 C 库。有人努力在 Linux 机器上编译它,所以它可以很容易地在 Android 之外使用。这是最新努力的代码,最初称为 Gentoo-bionic。最初的项目是基于 Gentoo 的,但当前的源不是 Gentoo 特定的。我正在使用 Ubuntu。这是代码:
https://github.com/gentoobionic/bionic
这是关于它在 ELC2013 上的介绍:
- http://elinux.org/images/2/25/2013_elc_gentoo_bionic.pdf
- http://free-electrons.com/blog/elc-2013-videos/(声音不好)
我试图在 X86_64 Ubuntu 上编译它,但失败了。我试过了:
我有:
所以我尝试了:
它配置得很好,但我得到了:
有人可以提出解决方法吗?
android - 在 Android libc 中添加系统调用的问题
请帮忙。我正在使用 Android marshmallow (6.0) 源代码,我需要一个 linux 消息队列和共享内存相关的系统调用支持来支持要移植的应用程序。以前我使用的是 Kitkat 源代码并且它正在工作。
我为此做的步骤是:
- 在 /BSP/Bionic/libc/SYSCALLS.TXT 中添加了系统调用
- 使用 gensyscalls.py 脚本生成的 asm 存根。
- 编译没有错误 libc 但生成的 libc.so 不包含添加的符号。
提前致谢。
/BSP/Bionic/libc/SYSCALLS.TXT 中添加的系统调用:
- int semctl(int semid, int semnum, int cmd, ...) 所有
- int semget(key_t key, int nsems, int semflg) 所有
- int semop(int semid, struct sembuf* sops, size_t nsops) 所有
- void* shmat(int shmid, const void* shmaddr, int shmflg) 所有
- int shmctl(int shmid, int cmd, struct shmid_ds* buf) 所有
- int shmdt(const void* shmaddr) 所有
- int shmget(key_t key, size_t size, int shmflg) all
- int msgctl(int msqid, int cmd, struct msqid_ds *buf) 所有
- int msgget(key_t key, int msgflg) 所有
- int msgrcv(int msqid, void* msgp, size_t msgsz, long int msgtyp, int msgflg) 所有
- int msgsnd(int msqid, const void* msgp, size_t msgsz, int msgflg) 所有
android-ndk - Bionic 和 libc 的存根实现
我想运行一个 x86 共享库,它是从非 android linux 机器上的 apk 中获取的。
它与 android libc 相关联,所以我libc.so
从 android ndk 中获取了它。在调试了段错误一段时间后,我认为这libc.so
是“作弊”,并且只包含许多库函数的 nop 实现:
现在 ndk 还包含一个libc.a
包含这些函数的实际实现的函数,但是如何让我的进程加载这些函数并覆盖 libc.so 的 nop 函数?还会对有关 android 为何使用此技巧以及覆盖如何在那里工作的更多上下文感兴趣。
android - 仿生工具链 ld 可重定位目标文件问题
我正在尝试为 Arm-android 交叉编译 GRPC C++,在链接一些库期间,我从 ld 收到了这些错误:
有谁知道这个错误的原因是什么?.cc 文件都是用-fPIC
标志编译的。
android - 为什么只有静态构建在 Android 上运行?
我在不使用 Android Studio 和 NDK 的情况下为 android 构建了一些应用程序。
我注意到如果我在没有"-static"
参数的情况下构建它们,那么 Android 将无法运行它们。
我在任何地方都找不到记录的原因,尽管我猜这与 Android 使用 Bionic 而不是 glibc 的事实有关。
是不是因为 Bionic libc 需要静态构建,(与“标准 Linux”glibc 相比,它也可以处理动态构建)?如果是这样,那么文件系统中怎么会有 .so 文件。
谢谢你。