Forum > Android-JVM
Compile to a tablet?
regressist:
--- Quote from: MarkMLl on November 20, 2021, 01:51:00 pm ---
--- Quote from: regressist on November 20, 2021, 12:52:33 pm ---Are you saying that with Termux I could take the precompiled file and change the execution rights without being root?
--- End quote ---
I quoted a message which said that explicitly earlier, and I've previously said that sftp preserved permissions. Why- have you tried it and found it didn't work? >:-)
Sorry to sound like a grouch, but I've got things to do and limited daylight to do them.
I've just checked VERY briefly, and if I run sftp on an Android "Phablet" to get a file from a local PC the *user's* rwx rights are preserved, but the group and other rights are masked out. However I was able to chmod the file to 777 without having to do anything special (i.e. no sudo etc.).
Note that I said VERY briefly there. I'd normally log into the device using ssh so that I had a decent keyboard and screen on the PC, but I need to refresh my memory of how to do it.
Note also that permission handling could possibly be changed by (the Linux kernel that is part of) different versions of Android.
MarkMLl
--- End quote ---
Thanks for your reply, I just read again the whole thread because I realized that it's a (safe) pity that I can not run easily a program already compiled on ANY android device without being root. But I can do it on any windows PC... damn it! Of course I did not try your solution because I do not even know where to start (!!), I transferred the executable to a 1+1 phone but I was not able to repeat what done on the tablet simply because it is not rooted (and even if so I do not know if I should recompile it for its processor, but this is another problem).
Please do NOT waste your time to reply, I will monitor the page every while in case someone is willing to reply to these questions:
1) which tools should I use to transfer the file (on pc virtual machines, XP or Vista; termux I guess on android)
2) can I do this via usb cable (I mean without connecting the VM to internet which I can not do)?
3) is this feasible without being an expert?
Thanks
engkin:
Just to clarify, one of my test phones is not rooted and it is able to run my terminal apps. I don't have su/superuser. I have to use data/local/tmp or a folder inside the terminal emulator app.
MarkMLl:
--- Quote from: regressist on November 20, 2021, 04:41:58 pm ---Please do NOT waste your time to reply, I will monitor the page every while in case someone is willing to reply to these questions:
1) which tools should I use to transfer the file (on pc virtual machines, XP or Vista; termux I guess on android)
2) can I do this via usb cable (I mean without connecting the VM to internet which I can not do)?
3) is this feasible without being an expert?
--- End quote ---
Time extending somebody's knowledge and experience is never wasted, particularly if zhe's keen and cooperative. I'll try to take a bit more of a look now that it's getting darker but (1) Putty (2) assume that both the Android device and your PC appear on the local LAN with addresses allocated via DHCP etc. and (3) yes, but you might need to start off by Googling for some simple texts on driving a Linux/unix shell over SSH.
Obligatory xkcd: https://xkcd.com/2542
MarkMLl
ojz0r:
--- Quote from: regressist on November 20, 2021, 04:41:58 pm ---1) which tools should I use to transfer the file (on pc virtual machines, XP or Vista; termux I guess on android)
2) can I do this via usb cable (I mean without connecting the VM to internet which I can not do)?
3) is this feasible without being an expert?
--- End quote ---
If you connect your phone to the usb you should get a promt if you want to charge, move photos, or move files - select files. Then your phone should show up in the computers file system as a drive (your phone needs to be unlocked) and you should be able to browse the phones folders. I would put the files in the "download" folder and then use Termux to move them to its ~/home.
MarkMLl:
OK, here's a very quick experiment. It's not comprehensive, and you'll need to read around a bit... sorry, but I don't have much time.
I've got a "phablet" here which (I find) already has Termux installed, I did this a couple of years ago but forget the detail.
If I login locally (i.e. Termux's own "console" shell session on the Android screen) and run this
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ whoamiu0_a86 $sshd $ netstat -an | grep 22tcp 0 0 0.0.0.0:8022 0.0.0.0:* LISTEN
Note the unix convention that a leading $ indicates the prompt. i.e. you don't type that.
That's showing you that the user Android/Termux has set up is called u0_a86, that you can start the ssh daemon (server) and that SSH is listening on port 8022 (I can't remember how I set that up, the standard one is 22).
If you now do this
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ netstat -an | grep :8022tcp 0 0 0.0.0.0:8022 0.0.0.0:* LISTEN tcp 0 0 172.27.16.176:8022 172.27.16.1:33104 ESTABLISHEDtcp6 0 0 :::8022 :::* LISTEN
you can see that it's listening on the dotted quad 172.27.16.176.
Finally, use passwd to give that user a password.
Now go to a PC, I'm using Linux. There's two things you can do:
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---~$ ssh -p 8022 u0_a86@172.27.16.176 u0_a86@172.27.16.176's password: X11 forwarding request failed on channel 0 Welcome to Termux! ... $ lspstalk-x86_64-linux-gtk2 $ rm pstalk-x86_64-linux-gtk2 $ exit
Let me explain what you're seeing. You've got a $ prompt on the PC, you're running ssh to connect to the Android device, you're getting various login screed from Termux on the Android device and then a prompt. At the prompt you're running ls to list the files stored in that user's home directory, you see one and remove it, and then you exit the shell session.
Back on the PC, switch to a directory with a compiled program in it. Then use the sftp command to copy that program to the Android device, then quit the transfer session.
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---~$ sftp -P 8022 u0_a86@172.27.16.176u0_a86@172.27.16.176's password: Connected to u0_a86@172.27.16.176. sftp> put pstalk-x86_64-linux-gtk2Uploading pstalk-x86_64-linux-gtk2 to /data/data/com.termux/files/home/pstalk-x86_64-linux-gtk2pstalk-x86_64-linux-gtk2 100% 24MB 4.8MB/s 00:05 sftp> quit ~$ ssh -p 8022 u0_a86@172.27.16.176u0_a86@172.27.16.176's password: X11 forwarding request failed on channel 0 Welcome to Termux! ... $ ls -ltotal 24628-rwx------ 1 u0_a86 u0_a86 25216312 Nov 20 19:10 pstalk-x86_64-linux-gtk2 $ exitlogoutConnection to 172.27.16.176 closed.
Note a couple of things. Despite being related, the ssh and sftp clients use a different option letter to specify the port: on unix case is significant. If you're using e.g. putty or Teraterm as a client things will be different: read the docs.
Once logged in, you use exit to leave a shell session and quit to leave a transfer session (exit might also work here, depending on variant).
That's all very fast I'm afraid, but is hopefully a taste that stuff /does/ work.
As I've said elsewhere, I've had FPC running under Termux /but/ some of the libraries are packaged differently which gave problems.
(Later:)
When I previously had FPC on a tablet it was x86_64 (amd64) rather than ARM. There's a whole lot of detail I can't remember, I might have needed to do a special build to work round some path issues.
On the phablet I've currently got I can see
--- Code: Text [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ cat /proc/cpuinfoProcessor : AArch64 Processor rev 2 (aarch64)processor : 0BogoMIPS : 26.00Features : fp asimd aes pmull sha1 sha2 crc32CPU implementer : 0x41CPU architecture: AArch64CPU variant : 0x0CPU part : 0xd03CPU revision : 2 Hardware : MT6795
I've quite simply not got the time to do much more but I'm fairly confident that a cross-compiled file could be moved between systems... in any event there's people here with far more experience than I.
The one thing I would warn about is that on Linux, library symlinks are- AIUI- fully resolved at linkage time. The implication of this is that if the development libraries differ substantially from the target system there's a risk of problems: from memory the one that brought me up short in the past was libpthreads (?) which is handled in an arguably non-standard fashion on Android.
MarkMLl
Navigation
[0] Message Index
[#] Next page
[*] Previous page