Maratyszcza / Maratyszcza/pthreadpool

Termux compilation tips

Open
#48 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
396
Forks
153
PR merge metrics
No merged PRs in 30d

Description

I needed it for pytorch compilation. Spent half a day trying to compile this, as dependency. Tips for Termux users only:
1. If you're compiling this code on Termux and encounter an error about the missing 'unistd.h' file, you might need to install the 'ndk-sysroot'. It has it natively, one of very few apt packages that does not get installed to /opt or .local/lib
2. Remove this code security cruft first, as it gets stuck eith smth Google. Yes. Thus :
```
alias cmakeinstall='rm CMakeCache.txt && echo "Removing silly Werror 🪲 directives en masse..." & time find . -type f -exec sed -i "s/-Werror//g" {} \; && export CFLAGS="-fuse-ld=lld -pthread -g -march=armv8-a -mtune=cortex-a53 -Wall -Wextra" && echo "Starting compilation 👩‍💻 proper... "&& cmake -DCMAKE_INSTALL_PREFIX=$PREFIX . && time make -j4 && make install'
```
is my newest one liner.

Ref:
```
~/downloads/pthreadpool $ uname -a Linux localhost 4.14.186+ #1 SMP PREEMPT Thu Mar 17 16:28:22 CST 2022 aarch64 Android ~/downloads/pthreadpool $
```

PS. You may test it with:
```
#include #include void task(void* arg, size_t i) { printf("Hello from task %zu\n", i); } int main() { pthreadpool_t pool = pthreadpool_create(4); pthreadpool_parallelize_1d(pool, (pthreadpool_task_1d_t)task, NULL, 10, 0); pthreadpool_destroy(pool); return 0; }
```
with : `gcc -o test4 test4.c -pthread -lpthreadpool` :
~/.../pytorch/build $ ./test4 Hello from task 3 Hello from task 4 Hello from task 5 Hello from task 2 Hello from task 1 Hello from task 9 Hello from task 7 Hello from task 0 Hello from task 6 Hello from task 8 ~/.../pytorch/build $

...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No documentation file or target is named. Start by checking the repository's existing build documentation and CMake setup against the Termux commands, then use the pthreadpool.h sample and gcc test as a validation path. Done means the relevant Termux compilation guidance is placed in the appropriate documentation and can be followed successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cmake, cpp
Domain
build-system, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.