Recent

Author Topic: Compile to a tablet?  (Read 15095 times)

regressist

  • New Member
  • *
  • Posts: 18
Re: Compile to a tablet?
« Reply #45 on: November 17, 2021, 07:01:52 pm »

Yes, the name of the file alone will not work, unlike Windows. You need to put period slash ./ before it's name.

Unfortunately I will not be around a computer for some hours. As soon as I get a  chance I'll try it on my side and give you a more accurate step.

At least now we know your device is rooted. :)

Sorry to bother you again: can I assume that there is no way to change the execution rights of the file (at least at my low level)?

Thanks

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Compile to a tablet?
« Reply #46 on: November 18, 2021, 03:58:57 pm »
Try to put the file in:
/data/local/tmp

And change its execution rights there.

regressist

  • New Member
  • *
  • Posts: 18
Re: Compile to a tablet?
« Reply #47 on: November 18, 2021, 08:25:00 pm »
Try to put the file in:
/data/local/tmp

And change its execution rights there.


WONDERFUL, it works. I appreciate a lot your support.

I think I was lucky: you must be a top class programmer!

Thanks a lot

Sergio
« Last Edit: November 18, 2021, 08:30:28 pm by regressist »

regressist

  • New Member
  • *
  • Posts: 18
Re: Compile to a tablet?
« Reply #48 on: November 20, 2021, 12:52:33 pm »
This certainly shouldn't be a killer, and I would urge you to watch out for late responses (it's a weekend, so there might not be as much activity here as normal).

In the worst case you might end up having to install something like Termux anyway, simply to allow you to run chmod or whatever is needed... that should also allow you to use e.g. sftp which doesn't mess around with file permissions in transit.

The fact that people (myself included) have run the compiler successfully on the target system using Termux suggests that this is solvable, allowing you to develop comfortably on a host PC.

MarkMLl

Are you saying that with Termux I could take the precompiled file and change the execution rights without being root?

MarkMLl

  • Hero Member
  • *****
  • Posts: 4745
Re: Compile to a tablet?
« Reply #49 on: November 20, 2021, 01:51:00 pm »
Are you saying that with Termux I could take the precompiled file and change the execution rights without being root?

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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

regressist

  • New Member
  • *
  • Posts: 18
Re: Compile to a tablet?
« Reply #50 on: November 20, 2021, 04:41:58 pm »
Are you saying that with Termux I could take the precompiled file and change the execution rights without being root?

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


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

  • Hero Member
  • *****
  • Posts: 3112
Re: Compile to a tablet?
« Reply #51 on: November 20, 2021, 04:59:49 pm »
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

  • Hero Member
  • *****
  • Posts: 4745
Re: Compile to a tablet?
« Reply #52 on: November 20, 2021, 05:31:25 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?

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
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ojz0r

  • New Member
  • *
  • Posts: 46
Re: Compile to a tablet?
« Reply #53 on: November 20, 2021, 07:22:36 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?

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.
Just trying to learn.

MarkMLl

  • Hero Member
  • *****
  • Posts: 4745
Re: Compile to a tablet?
« Reply #54 on: November 20, 2021, 08:19:47 pm »
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  [Select][+][-]
  1. $ whoami
  2. u0_a86
  3.  
  4. $sshd
  5.  
  6. $ netstat -an | grep 22
  7. tcp        0      0 0.0.0.0:8022            0.0.0.0:*               LISTEN    
  8.  

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  [Select][+][-]
  1. $ netstat -an | grep :8022
  2. tcp        0      0 0.0.0.0:8022            0.0.0.0:*               LISTEN    
  3. tcp        0      0 172.27.16.176:8022      172.27.16.1:33104       ESTABLISHED
  4. tcp6       0      0 :::8022                 :::*                    LISTEN    
  5.  

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  [Select][+][-]
  1. ~$ ssh -p 8022 u0_a86@172.27.16.176
  2.  
  3. u0_a86@172.27.16.176's password:
  4.  
  5. X11 forwarding request failed on channel 0
  6.  
  7. Welcome to Termux!
  8.  
  9. ...
  10.  
  11. $ ls
  12. pstalk-x86_64-linux-gtk2
  13.  
  14. $ rm pstalk-x86_64-linux-gtk2
  15.  
  16. $ exit
  17.  

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  [Select][+][-]
  1. ~$ sftp -P 8022 u0_a86@172.27.16.176
  2. u0_a86@172.27.16.176's password:
  3. Connected to u0_a86@172.27.16.176.
  4.  
  5. sftp> put pstalk-x86_64-linux-gtk2
  6. Uploading pstalk-x86_64-linux-gtk2 to /data/data/com.termux/files/home/pstalk-x86_64-linux-gtk2
  7. pstalk-x86_64-linux-gtk2                                                                                 100%   24MB   4.8MB/s   00:05    
  8.  
  9. sftp> quit
  10.  
  11. ~$ ssh -p 8022 u0_a86@172.27.16.176
  12. u0_a86@172.27.16.176's password:
  13. X11 forwarding request failed on channel 0
  14.  
  15. Welcome to Termux!
  16.  
  17. ...
  18.  
  19. $ ls -l
  20. total 24628
  21. -rwx------ 1 u0_a86 u0_a86 25216312 Nov 20 19:10 pstalk-x86_64-linux-gtk2
  22.  
  23. $ exit
  24. logout
  25. Connection to 172.27.16.176 closed.
  26.  

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  [Select][+][-]
  1. $ cat /proc/cpuinfo
  2. Processor       : AArch64 Processor rev 2 (aarch64)
  3. processor       : 0
  4. BogoMIPS        : 26.00
  5. Features        : fp asimd aes pmull sha1 sha2 crc32
  6. CPU implementer : 0x41
  7. CPU architecture: AArch64
  8. CPU variant     : 0x0
  9. CPU part        : 0xd03
  10. CPU revision    : 2
  11.  
  12. Hardware        : MT6795
  13.  

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
« Last Edit: November 20, 2021, 09:44:47 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

regressist

  • New Member
  • *
  • Posts: 18
Re: Compile to a tablet?
« Reply #55 on: November 20, 2021, 10:06:21 pm »
My friends, engkin, MarkMLI, ojz0r: UNBELIEVABLE. I started again the Terminal and made (just to see where it would go)

> cd

it went inside a long dir which ended in something like home-app (I do not remember now, see down); I made

> cp /sdcard/filename .
> chmod 755 ./filename

AND IT RUN! Without even recompilation! (This is why I can not give now the full path where it went, the screen is scrolling).

Mark thanks a lot for the long explanation, I will try to understand it, even though I am not happy on installing a tool in the pc (and the virtual machines can not go on internet...). I will see now if I can do it also on my new phone with the same steps... I will let you know if I manage to increase the array of devices running this stuff.

MarkMLl

  • Hero Member
  • *****
  • Posts: 4745
Re: Compile to a tablet?
« Reply #56 on: November 20, 2021, 10:21:00 pm »
Mark thanks a lot for the long explanation, I will try to understand it, even though I am not happy on installing a tool in the pc (and the virtual machines can not go on internet...). I will see now if I can do it also on my new phone with the same steps... I will let you know if I manage to increase the array of devices running this stuff.

The only extra thing you'd need on the PC would be an ssh client (which will generally include sftp), and in general I'd expect your corporate IT/MIS people to be have something appropriate.

Apart from that I'm anticipating that you'll read the somewhat-coherent stuff I posted and raise any points you want explained... I'm a fairly experienced technical author but sometimes one lacks the time to "do it right".

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018