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

compatibility for android with ndk toolchain #2289

Open
eventlOwOp opened this issue May 10, 2024 · 0 comments
Open

compatibility for android with ndk toolchain #2289

eventlOwOp opened this issue May 10, 2024 · 0 comments

Comments

@eventlOwOp
Copy link

problem

when cross compiling zerotier using ndk toolchain (for android)

it satisfied #if defined(__LINUX__) && ( (!defined(__GLIBC__)) || ((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 18)) ) on line 2097 and called pthread_setattr_default_np which is not supported in ndk

one.cpp:2097:2: error: use of undeclared identifier 'pthread_setattr_default_np'
        pthread_setattr_default_np(&tattr);
        ^
1 warning and 1 error generated.
make: *** [<builtin>: one.o] Error 1
make: *** Waiting for unfinished jobs....

to reproduce

make ZT_STATIC=1 ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 CC=aarch64-linux-android33-clang CXX=aarch64-linux-android33-clang++ LDFLAGS="-s -L../deps/aarch64" DEFS="-I../deps/include" ( in ubuntu with ndk toolchain, LDFLAGS and DEFS are set to link the natpmpc library built myself )
or
make ZT_STATIC=1 ZT_DEBUG=0 ZT_SSO_SUPPORTED=0 ( in termux after installing natpmpc apt-get install -y natpmpc )

possible solution

change that line into

#if defined(__LINUX__) && ( (!defined(__GLIBC__)) || ((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 18)) ) && (!defined(__ANDROID__))

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

No branches or pull requests

1 participant