[go: up one dir, main page]

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

Building Scala Native 0.5.4 project on Termux #4024

Open
mio-19 opened this issue Aug 16, 2024 · 7 comments
Open

Building Scala Native 0.5.4 project on Termux #4024

mio-19 opened this issue Aug 16, 2024 · 7 comments

Comments

@mio-19
Copy link
Contributor
mio-19 commented Aug 16, 2024

Termux is an Linux environment on Android https://github.com/termux

Linking (multithreadingEnabled=true, disable if not used) (2903 ms
[info] Discovered 2249 classes and 16281 methods after classloading
[info] Checking intermediate code (quick) (87 ms)
[info] Discovered 1859 classes and 8093 methods after optimization
[info] Optimizing (release-fast mode) (9172 ms)
[error] /data/data/com.termux/files/home/chester-lang/chester-in-scala/cli/native/target/scala-3.5.0-RC7/native/dependencies/posixlib_native0.5_3-0.5.4-3/scala-native/unistd.c:74:37: error: use of undeclared identifier '_CS_PATH'
[error]    74 | int scalanative__cs_path() { return _CS_PATH; };
[error]       |                                     ^
[error] 1 error generated.
[error] /data/data/com.termux/files/home/chester-lang/chester-in-scala/cli/native/target/scala-3.5.0-RC7/native/dependencies/posixlib_native0.5_3-0.5.4-3/scala-native/pthread.c:9:12: error: use of undeclared identifier 'PTHREAD_CANCEL_ASYNCHRONOUS'
[error]     9 |     return PTHREAD_CANCEL_ASYNCHRONOUS;
[error]       |            ^
[error] /data/data/com.termux/files/home/chester-lang/chester-in-scala/cli/native/target/scala-3.5.0-RC7/native/dependencies/posixlib_native0.5_3-0.5.4-3/scala-native/pthread.c:12:50: error: use of undeclared identifier 'PTHREAD_CANCEL_ENABLE'
[error]    12 | int scalanative_pthread_cancel_enable() { return PTHREAD_CANCEL_ENABLE; }
[error]       |                                                  ^
[error] /data/data/com.termux/files/home/chester-lang/chester-in-scala/cli/native/target/scala-3.5.0-RC7/native/dependencies/posixlib_native0.5_3-0.5.4-3/scala-native/pthread.c:14:52: error: use of undeclared identifier 'PTHREAD_CANCEL_DEFERRED'
[error]    14 | int scalanative_pthread_cancel_deferred() { return PTHREAD_CANCEL_DEFERRED; }
[error]       |                                                    ^
[error] /data/data/com.termux/files/home/chester-lang/chester-in-scala/cli/native/target/scala-3.5.0-RC7/native/dependencies/posixlib_native0.5_3-0.5.4-3/scala-native/pthread.c:16:51: error: use of undeclared identifier 'PTHREAD_CANCEL_DISABLE'
[error]    16 | int scalanative_pthread_cancel_disable() { return PTHREAD_CANCEL_DISABLE; }
[error]       |                                                   ^
[error] /data/data/com.termux/files/home/chester-lang/chester-in-scala/cli/native/target/scala-3.5.0-RC7/native/dependencies/posixlib_native0.5_3-0.5.4-3/scala-native/pthread.c:18:47: error: use of undeclared identifier 'PTHREAD_CANCELED'
[error]    18 | void *scalanative_pthread_canceled() { return PTHREAD_CANCELED; }
[error]       |                                               ^
[error] /data/data/com.termux/files/home/chester-lang/chester-in-scala/cli/native/target/scala-3.5.0-RC7/native/dependencies/posixlib_native0.5_3-0.5.4-3/scala-native/pthread.c:46:49: error: use of undeclared identifier 'PTHREAD_PRIO_PROTECT'
[error]    46 | int scalanative_pthread_prio_protect() { return PTHREAD_PRIO_PROTECT; }
[error]       |                                                 ^
[error] 6 errors generated.
@mio-19
Copy link
Contributor Author
mio-19 commented Aug 16, 2024

_CS_PATH is not defined on termux see https://github.com/search?q=repo%3Atermux%2Ftermux-packages%20_CS_PATH&type=code

pthread on android doesn't implement some function see https://github.com/search?q=repo%3Atermux%2Ftermux-packages%20pthread&type=code

@ekrich
Copy link
Member
ekrich commented Aug 16, 2024

@mio-19
Copy link
Contributor Author
mio-19 commented Aug 16, 2024

On the C side, conditional compilation like ifdef on _CS_PATH and ifndef on __ANDROID__ could be used.
On scala side, what could be used to detect environment in the posixlib?

@mio-19
Copy link
Contributor Author
mio-19 commented Aug 24, 2024

What is the best to use to have different logic on Termux?

@mio-19
Copy link
Contributor Author
mio-19 commented Aug 24, 2024

With Scala Native 0.5.5 and multi threading default off I only saw the error about _CS_PATH

@mio-19
Copy link
Contributor Author
mio-19 commented Aug 29, 2024

_CS_PATH is resolved in #4037 Now what to do with PTHREAD?

@WojciechMazur
Copy link
Contributor
WojciechMazur commented Aug 29, 2024

We are not always using pthread. It is still is always required when using java.lang.Thread or Commix GC, but in the remaining cases we should be able to skip it from the linked libraries. I've made some initial PR to test this concept, but there is only 1 remaining thing - testing Android in the CI and for that we would need to integrate and automate setting up Android environment. I can link the binary, but I cannot run it yet.
WojciechMazur#59

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

3 participants