leleliu008 / ndk-pkg-formula-repository-official-core

the formula repository for ndk-pkg
Apache License 2.0
13 stars 6 forks source link

Can you add libtalloc and proot? #1

Closed ghost closed 3 years ago

ghost commented 3 years ago

I have wasted a week of my life, and didn't go to sleep one night, first trying to get openjdk9 working, but getting crashed by constant clang and gcc flags intertwining with my host CC and target CC.

And recently getting proot to link right.

I just can't tell this god damn linker, to fucking look at multiple Library paths at once, it annoys me immensely looking at this clang, refusing to look for a library at specified paths, when searching for libraries that are linked to libraries.

I am immensely pissed off and tired of NDK. Next time I will pick an android project, where I never ever touch native linux libraries.

I would rather make a thousand unique AUR and kiss linux packages than ever have to look at android native development kit development ever again.

If you give me your monero donation address, I will pay you around 0.037 XMR for adding it in for me.(because that's how much XMR I hold currently).

leleliu008 commented 3 years ago

@kubast2 I'm porting proot and talloc, and talloc have been successfully ported. I will commit it in a while.

ghost commented 3 years ago

Oh I see, thank a lot, I will wait patiently then. It is slowly getting late in Pekin, don't compromise on sleep. And have a goodnight.

leleliu008 commented 3 years ago

I have add talloc and proot, but proot facing following problem:

error: undefined reference to 'get_current_dir_name'
error: undefined reference to 'prlimit'

these functions not exists in Android libc. we need to write some stubs.

ghost commented 3 years ago

I assume prlimit is just a thin wrapper from what I saw on glibc/musl, here's a stub:

//prlimit(2)
//Return Value
//On success, these system calls return 0.
//Only for root users, or for users with a capability the syscall doesn't have a kernel defconfig option to disable it, always on
#DEFINE RET_VAL 0
//#DEFINE ERRNO_OVERRIDE

int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit)
{
#ifdef ERRNO_OVERRIDE
    errno = ERRNO_OVERRIDE;
    #undef ERRNO_OVERRIDE
#endif
    return RET_VAL;
}
#undef RET_VAL

Musl MIT license https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT

char *get_current_dir_name(void) {
    struct stat a, b;
    char *res = getenv("PWD");
    if (res && *res && !stat(res, &a) && !stat(".", &b)
        && (a.st_dev == b.st_dev) && (a.st_ino == b.st_ino))
        return strdup(res);
    return getcwd(0, 0);
}
ghost commented 3 years ago

I will provide a repository for it if that will make it cleaner for you. https://github.com/kubast2/proot_stubs

leleliu008 commented 3 years ago

yes, your workaround works. but new problem is coming:

./loader/assembly.S:17:1: error: unknown directive
.type syscall_6, @function
^
./loader/assembly.S:44:1: error: unknown directive
.type syscall_3, @function
^
./loader/assembly.S:54:1: error: unknown directive
.type syscall_1, @function
ghost commented 3 years ago

From what I can tell this piece of assembly is only supposed to compile for 32bit x86 platform.

"The .type directive sets the type of a symbol." Looks like a problem with the assembler? Or maybe some other component of NDK? Maybe google have disabled this feature and the NDK just doesn't come with it. But if it tries to compile it for other targets than x86 then we definitely have a problem.

This directive is part of the (maybe closed) armclang assembler from arm corporation. And of gas(gnu assembler).

I can't seem to find what causes exactly lack of this very directive.

leleliu008 commented 3 years ago

you can try:

ndk-pkg install proot2
ghost commented 3 years ago

I will try integrating it to a project tomorrow/today. I need to do some basic house chores today.