termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.08k stars 3k forks source link

Package Request: R (r-base) #250

Open tomtom opened 8 years ago

tomtom commented 8 years ago

Several users of GnuRoot Debian reported that R works on arm. Currently there is no other way to run R on Android.

SDRausty commented 6 years ago

@ConorIA your thread has been shared here.

fkgruber commented 5 years ago

Hi I tried the instructions on that website and many others so far I have been unable to install tidyverse on a Android tablet (Samsung sm-p355) running Android 7.1.1

The first package that tries to install fs gives the following error: id.cc:73:17 error: use of undeclared identifier 'getpwent'; did you mean 'getgrent'?

I have tried installing Rcpp from r-cran-rcpp, and using install.packages. Also tried all versions of clang that were available (setupclang, setupclang-gfort-8, ..., setupclang-gfort-6) but I still get the same error when installing the fs package.

by the way what is that setup-patchforgcc for? thanks F

fkgruber commented 5 years ago

I also tried installing dplyr after using setupclang and it compiles without error. However at the end I get the following error:

** testing if installed package can be loaded Error: package or namesapce load failed for 'dplyr' in dyn.load(file,DLLpath=DLLpath,...): unable to load shared object '/data/data/com.termux/files/usr/lib/R/library/dplyr/libs/dplyr.so': dlopen failed: cannot locate symbol "__atomic_fetch_sub_4" referenced by "/data/data/com.termux/files/usr/lib/R/library/dplyr/libs/dplyr.so"... Error: loading failed Execution halted

Grimler91 commented 5 years ago

@fkgruber

The first package that tries to install fs gives the following error: id.cc:73:17 error: use of undeclared identifier 'getpwent'

You need to patch fs to not use getpwent. That function doesn't exist on android as it is a single user environment. See for example here for another package that patches it.

dlopen failed: cannot locate symbol "__atomic_fetch_sub_4"

Might be fixable by adding -latomic to a suitable compiler flag. Some other packages need this for the i686 architecture, for example imagemagick. The error might also be related to issue https://github.com/termux/termux-packages/issues/3092, if you are on arm

fkgruber commented 5 years ago

thanks. I will take a look at those links. I'm surprised that there is not quick fix right now. Specially since it appears that many android users have been able to install tidyverse with termux.

@fkgruber

The first package that tries to install fs gives the following error: id.cc:73:17 error: use of undeclared identifier 'getpwent'

You need to patch fs to not use getpwent. That function doesn't exist on android as it is a single user environment. See for example here for another package that patches it.

dlopen failed: cannot locate symbol "__atomic_fetch_sub_4"

Might be fixable by adding -latomic to a suitable compiler flag. Some other packages need this for the i686 architecture, for example imagemagick. The error might also be related to issue #3092, if you are on arm

its-pointless commented 5 years ago

yeah things change within R packages as well. I am looking for a better solution now.

its-pointless commented 5 years ago

k managed to compile tidyverse.

its-pointless commented 5 years ago

"33M r-cran-tidyverse_1.0.0_aarch64.deb" this would make things easier i guess?

fkgruber commented 5 years ago

you mean so we can do pkg install r-cran-tidyverse? That would be fantastic.

its-pointless commented 5 years ago

Yes uploading now

fkgruber commented 5 years ago

just installed it thanks a lot.

jiazhenzhu commented 5 years ago

Yes uploading now

I am Chinese students,not good at English,When I use termux run R program have error,my phone is oneplus3T,Could you give me solve?This problem is about use R to install packages.

When I run R (not use root),use library() command,will report is problems,

sh: /data/data/com.termux/files/usr/lib/R/bin/pager: can't execute: Permission denied

I try use like chmod 777 command ,but is not useful. And then I try tsu(use root),When I input R,will report is problems,

Fatal error: cannot create 'R_TempDir'

I try google or baidu is not useful. Please help me,thanks~

starlinq commented 5 years ago

New issue after termux updates $ R

CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/lib/R/bin/exec/R": library "libicuuc.so.63" not found Aborted

its-pointless commented 5 years ago

I will get around to it today.

starlinq commented 5 years ago

@its-pointless Thank you for your work. The issue has been fixed.

qinhaolan commented 5 years ago

I cannot install IRkernel Error : .onLoad failed in loadNamespace() for 'pbdZMQ', details: call: fun(libname, pkgname) error: Could not load /data/data/com.termux/files/usr/lib/R/library/pbdZMQ/libs/libzmq.so : Error in dyn.load(dn.file, local = FALSE) : unable to load shared object '/data/data/com.termux/files/usr/lib/R/library/pbdZMQ/libs/libzmq.so': dlopen failed: cannot locate symbol "R_registerRoutines" referenced by "/data/data/com.termux/files/usr/lib/R/library/pbdZMQ/libs/libzmq.so"...

ERROR: lazy loading failed for package ‘IRkernel’

The downloaded source packages are in ‘/data/data/com.termux/files/usr/tmp/RtmpiuQQaD/downloaded_packages’ Updating HTML index of packages in '.Library' Making 'packages.html' ... done

ghost commented 5 years ago

@qinhaolan You are hitting https://github.com/android-ndk/ndk/issues/201 which is Android's linker issue with RTLD_GLOBAL dlopen flag.

starlinq commented 5 years ago

New errors after recent R update to version 3.6.0

` $ R R version 3.6.0 (2019-04-26) -- "Planting of a Tree" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: armv7-unknown-linux-androideabi (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

Error: package or namespace load failed for ‘utils’: .onLoad failed in loadNamespace() for 'utils', details: call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE) error: error in running command Error: package or namespace load failed for ‘stats’: .onLoad failed in loadNamespace() for 'utils', details: call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE) error: error in running command During startup - Warning messages: 1: package ‘utils’ in options("defaultPackages") was not found 2: package ‘stats’ in options("defaultPackages") was not found `

its-pointless commented 5 years ago

@Starlinq that is caused by using the wrong repo Instead of https://its-pointless.github.io/files Use https://its-pointless.github.io/files/24 in etc/apt/source.list or in etc/apt/source.list.d/

its-pointless commented 5 years ago

error can also caused by a screw up by me will fix in a bit.

naveedpash commented 5 years ago

@its-pointless any update? still getting the same error...

its-pointless commented 5 years ago

if you could show me output from the command termux-info that would help

naveedpash commented 5 years ago

oh, sorry, here you go:

$ termux-info All packages up to date Subscribed repositories: https://dl.bintray.com/xeffyr/x11-packages-21 x11/main https://dl.bintray.com/grimler/science-packages-21 science/stable https://dl.bintray.com/grimler/termux-root-packages-21 root/stable https://its-pointless.github.io/files termux/extras https://its-pointless.github.io/files termux/extras https://dl.bintray.com/grimler/game-packages-21 games/stable https://termux.net stable/main https://termux.net stable/main System information: Linux localhost 4.9.59-16141281 #1 SMP PREEMPT Mon Jul 1 21:34:34 KST 2019 aarch64 Android Termux-packages arch: aarch64 Android version: 9 Device manufacturer: samsung Device model: SM-N960F

linusjf commented 5 years ago

I'm unable to run Rscript on Termux. You specify a file, yet it displays no output. R CMD BATCH works as expected. Additionally, gfortan's unavailability led me to install R on Arch Linux on Termux. Rscript works as expected there.

its-pointless commented 5 years ago

Gfortran is available. R wouldn't compile without it without it. Installing gcc-8 or gcc-9 etc comes with gfortran.

linusjf commented 5 years ago

On Arch Linux on Termux, it is. Try installing package igraph on Termux R. It falls over with a message that gfortran is not available. Additionally, the help on R Termux in the R console is askew. The first page or so displays perfectly but when you scroll down, the screen narrows down to 1/3rd of the column size and characters to the right are no longer visible.

I've installed all three versions of libgfortran. gfortran is still not available.

linusjf commented 5 years ago

There's also this. https://github.com/termux/termux-packages/issues/702 If R is not to be supported fully, it might as well be dropped from the termux repo. Or you should port the packages that require gfortran to C or C++.

Julia is available on Termux. Perversely, it's not on Arch Linux for Termux.

its-pointless commented 5 years ago

apt install gcc-8 or 9 will install it.

its-pointless commented 5 years ago

also apt install r-cran-tidyverse

its-pointless commented 5 years ago

also to switch to a specific compiler as default: setupclang-gfort-9 or setupgcc-9 etc if you intend on trying to use gcc as c compiler setup-patchforgcc to patch headers so it will mostly work...

linusjf commented 5 years ago

Thanks. That worked.

lintr and igraph are now installed cleanly.

igraph compilation fails with setupgcc-8 with the patch installed.

Setting clang to the default works for compilation of the above packages.

linusjf commented 5 years ago

I still can't get Rscript, the command, to work as expected. It does nothing without or with a script as parameter. Is this broken? Do I need to reinstall R?

linusjf commented 5 years ago

Rscript No output Rscript {R script} No output.

its-pointless commented 5 years ago

so no output at all with the command Rscript?

linusjf commented 5 years ago

Not on Termux. I'm running the scripts via: R CMD BATCH --slave {script} Stackoverflow says that's not the preferred method of running scripts any more.

https://stackoverflow.com/questions/21969145/why-or-when-is-rscript-or-littler-better-than-r-cmd-batch

linusjf commented 5 years ago

Rscript appears to be an ELF executable. If its not working, Termux could simply wrap the above in a script and output the .Rout file to stdout. That's how ecj is defined on Termux, anyway.

linusjf commented 5 years ago

Am I missing something? I haven't the time to troubleshoot this issue myself. R works fine on Arch Linux (Termux) for me and I'm just getting started with the R environment.

its-pointless commented 5 years ago

Rscript works for me...

linusjf commented 5 years ago

It doesn't for me and it never has.

termux-info

Updatable packages: nodejs/stable 12.9.1 aarch64 [upgradable from: 12.9.0] Subscribed repositories: https://dl.bintray.com/xeffyr/x11-packages-24 x11/main https://dl.bintray.com/xeffyr/unstable-packages-24 unstable/main https://dl.bintray.com/grimler/science-packages-24 science/stable https://dl.bintray.com/grimler/termux-root-packages-24 root/stable https://its-pointless.github.io/files termux/extras https://its-pointless.github.io/files termux/extras https://dl.bintray.com/grimler/game-packages-24 games/stable https://dl.bintray.com/termux/termux-packages-24 stable/main System information: Linux localhost 3.18.31-perf-ga8bf568 #1 SMP PREEMPT Tue Jul 9 11:22:23 WIB 2019 aarch64 Android Termux-packages arch: aarch64 Android version: 7.1.2

its-pointless commented 5 years ago

Use https://its-pointless.github.io/files/24 for apt url.

linusjf commented 5 years ago

Is this to be updated in /data/data/com.termux/files/usr/etc/apt/sources.list?

linusjf commented 5 years ago

Reading package lists... Done E: The repository 'https://its-pointless.github.io/files/24 stable Release' does not have a Release file.

I updated the sources.list with the above url but have the above error.

On Fri, 30 Aug 2019, 02:24 its-pointless, notifications@github.com wrote:

Use https://its-pointless.github.io/files/24 for apt url.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/termux/termux-packages/issues/250?email_source=notifications&email_token=AF4R3PIGKROAS5PTKIFRQKTQHAZRNA5CNFSM4CC4LLCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5PZGPI#issuecomment-526357309, or mute the thread https://github.com/notifications/unsubscribe-auth/AF4R3PJJKCPTVXWOR35QW6LQHAZRNANCNFSM4CC4LLCA .

ghost commented 5 years ago

E: The repository 'https://its-pointless.github.io/files/24 stable Release'

The correct sources.list line should be:

deb https://its-pointless.github.io/files/24 termux extras

as repository doesn't have deb distribution "stable".

linusjf commented 5 years ago

So should I retain the original line and append this?

On Sat, 31 Aug 2019, 16:46 Leonid Plyushch, notifications@github.com wrote:

E: The repository 'https://its-pointless.github.io/files/24 stable Release'

The correct sources.list line should be:

deb https://its-pointless.github.io/files/24 termux extras

as repository doesn't have deb distribution "stable".

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/termux/termux-packages/issues/250?email_source=notifications&email_token=AF4R3PIIRX6EGTTHNURPMWLQHJHIPA5CNFSM4CC4LLCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5TKXDY#issuecomment-526822287, or mute the thread https://github.com/notifications/unsubscribe-auth/AF4R3PMIIRB2SULBHQYWKYTQHJHIPANCNFSM4CC4LLCA .

ghost commented 5 years ago

Remove all existing occurrences of https://its-pointless.github.io and put line posted above.

linusjf commented 5 years ago

Adding the line works. But Rscript still doesn't.

linusjf commented 5 years ago

There was only one line in the original file.

The main termux repository:

deb https://dl.bintray.com/termux/termux-packages-24 stable main

On Sat, 31 Aug 2019, 19:55 Leonid Plyushch, notifications@github.com wrote:

Remove all existing occurrences of https://its-pointless.github.io and put line posted above.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/termux/termux-packages/issues/250?email_source=notifications&email_token=AF4R3PKVSW5PJTBXTCVP2DLQHJ5OPA5CNFSM4CC4LLCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5TNXNA#issuecomment-526834612, or mute the thread https://github.com/notifications/unsubscribe-auth/AF4R3PP5HYPXKNLVUO34OKLQHJ5OPANCNFSM4CC4LLCA .

ghost commented 5 years ago

Ok. What content of file $PREFIX/etc/apt/sources.list.d/pointless.list then ? If it exist, then you need to fix it instead.

linusjf commented 5 years ago

OK. What's supposed to happen? A whole set of packages including R-base, Julia and scipy were downloaded earlier by changing the sources.list file. Updating the pointless.list produces a duplicate configuration error. So I reverted the sources.list to the original one and tried a pkg up. No new packages are downloaded. Rscript is the same.

ghost commented 5 years ago

Remove the its-pointless repo from original sources.list and update the line in pointless.list.

So what should happen: