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

android binary 64bit #19

Closed
zpimp opened this issue Jan 31, 2018 · 30 comments
Closed

android binary 64bit #19

zpimp opened this issue Jan 31, 2018 · 30 comments

Comments

@zpimp
Copy link

zpimp commented Jan 31, 2018

are you still releasing android binaries ?
it seems newer androids are 64bit

CANNOT LINK EXECUTABLE: "/data/data/com.termux/files/usr/lib/libtermux-exec.so" is 64-bit instead of 32-bit
page record for 0xf727a04c was not found (block_size=64)

is it hard to setup lazarus and cross-compile from linux i386 to arm64?

@benibela
Copy link
Owner

benibela commented Feb 1, 2018

are you still releasing android binaries ?

Occasionally

CANNOT LINK EXECUTABLE: "/data/data/com.termux/files/usr/lib/libtermux-exec.so" is 64-bit instead of 32-bit

Perhaps you can use an older Termux?

is it hard to setup lazarus and cross-compile from linux i386 to arm64?

The hard part is to compile the correct freepascal cross compiler

For android 64 bit, it might be completely unsupported: http://forum.lazarus.freepascal.org/index.php/topic,36914.msg270101.html#msg270101

@zpimp
Copy link
Author

zpimp commented Feb 1, 2018

i have managed to run the androidarm binary, downloading and unpacking straight from sourceforge
time ./xidel --help still takes 6-7 seconds, and time says 0.09s
last time it was the hosts file but now the hosts file is 2 lines, maybe its cause aarch64

its working i extracted data from a downloaded html
pc(i386): 0.053s
android(aarch64):0.2s
performance seems about right

actually showing the help takes 3 times as much compared to doing actually work
i assume fpc bug

2nd edit:
according to termux github, unset LD_PRELOAD its needed, before running 32bit binaries
termux/termux-app#567

thanks again for all your help

@Invictaz
Copy link

@zpimp @benibela Is this binary the 0.9.7 5706 development version for Android ARM you have?
Can you share it please?

@benibela
Copy link
Owner

I have uploaded a new 32 bit build

@zpimp
Copy link
Author

zpimp commented Mar 10, 2018

thank you

@Invictaz
Copy link

@zpimp How did you get Xidel working on a 64bit Android device? Chmod+x doesn't work. It seems it has also a problem with OpenSSL

@zpimp
Copy link
Author

zpimp commented Mar 10, 2018

use termux
i have put it in /data/data/com.termux/files/home
from there chmod works
before running xidel, you have to type the command "unset LD_PRELOAD"
then to run xidel : "./xidel the rest of yout command"

for downloading i use wget/curl with parameter to ignore certificates
curl -L -k -H "accept-encoding: gzip" -o file2.html --compressed http://youtube.com

after using "unset LD_PRELOAD", if you try to pkg update (termux command) and gives error, you have to change it back "set LD_PRELOAD" , iirc

post back if you have more problems

@Invictaz
Copy link

Invictaz commented Mar 10, 2018

@zpimp it seems to work from that directory, great 👍

64 bit phone

But how to run it as command? Because the install.sh does not install it to that /files/home directory.

sidesync_capture_20180310221748_1

@zpimp
Copy link
Author

zpimp commented Mar 10, 2018

just run it from there, even with root, i dont know if you can copy it to bin, cause system partition is mounted as readonly

@Invictaz
Copy link

I had the install.sh running but unsure if it is able to install in the $HOME directory. Maybe I need to modify it.

@Invictaz
Copy link

It needs to run from the directory Zpimp suggested. Then it runs

@zpimp
Copy link
Author

zpimp commented Sep 18, 2018

0.9.8 and 0.9.6 dont work on android 8.1 oreo 64 bit

with error
an unhandled exception occurred at $E854C0B2:
EAccessViolation: Access violation

i looked it up and seems to be an fpc issue

https://www.google.ro/search?q=free+pascal+compiler+android+oreo+unhandled+exception+occurred+at

it seems to be a syntax thing?

@benibela
Copy link
Owner

Pretty much any crash is reported as unhandled exception/access violation. The address $E854C0B2 is the important part.

Can you run it with gdb? Or strace xidel ?

@zpimp
Copy link
Author

zpimp commented Sep 20, 2018

https://transfer.sh/EDJpd/stxd.log

its 6k lines, i dont use hosts, now i use dns66 dont know if thats the cause
(block ads by dns queries)

@benibela
Copy link
Owner

Is that with xidel 0.9.8?

open("/proc/self/maps", O_RDONLY|O_LARGEFILE) = 3
read(3, "b4ce5000-b4f1a000 r-xp 00000000 "..., 256) = 256
...
read(3, "00000 00:00 0 \nef510000-ef68b000"..., 256) = 256

So b4ce5000 and ef510000 are the offsets

EAccessViolation: Access violation
$EF5B40B2
$B4DA0A70
$B4D32860

Subtracting b4ce5000 or ef510000 gives A40B2, BBA70 and 4D860, latter two which should mean CWSTRING_$$_ANSI2WIDEMOVE$PCHAR$WORD$WIDESTRING$LONGINT and SYSTEM_$$_ASSIGN$TEXT$RAWBYTESTRING in xidel 0.9.8, which would mean it crashes in /system/lib/libicui18n.so when trying to convert a file name to unicode

Are you loading a file? Can you call addr2line -f -e /system/lib/libicui18n.so 0xA40B2 ?

@zpimp
Copy link
Author

zpimp commented Sep 22, 2018

addr2line -f -e /system/lib/libicui18n.so 0xA40B2

it says
_ZNK6icu_5821CollationRootElements5findPEj
??:?

@zpimp
Copy link
Author

zpimp commented Sep 25, 2018

this is what i got from gdb/run/bt

db) run
Starting program: /data/data/com.termux/files/home/xd/xidel
warning: Unable to determine the number of hardware watchpoints available.
warning: Unable to determine the number of hardware breakpoints available.

Program received signal SIGSEGV, Segmentation fault.
0xf6ff00b2 in icu_58::Collator::createInstance(icu_58::Locale const&, UErrorCode&) ()
from /system/lib/libicui18n.so
(gdb) bt
#0 0xf6ff00b2 in icu_58::Collator::createInstance(icu_58::Locale const&, UErrorCode&) ()
from /system/lib/libicui18n.so
#1 0xf70879b4 in ucol_open_58 ()
from /system/lib/libicui18n.so
#2 0xaab649d0 in CWSTRING_$$INITTHREADDATA ()
#3 0xaab64a88 in CWSTRING
$$GETCONVERTER$WORD$$POINTER ()
#4 0xaab64e58 in CWSTRING
$$ANSI2UNICODEMOVE$PCHAR$WORD$UNICODESTRING$LONGINT ()
#5 0xaab65a70 in CWSTRING
$$ANSI2WIDEMOVE$PCHAR$WORD$WIDESTRING$LONGINT ()
#6 0xaaaef0c4 in fpc_ansistr_to_widechararray
()
#7 0xaaaf7860 in SYSTEM
$$ASSIGN$TEXT$RAWBYTESTRING ()
#8 0xaaaf78e8 in SYSTEM
$$ASSIGN$TEXT$SHORTSTRING ()
#9 0xaab66dbc in DL
$$DLADDR$POINTER$PDL_INFO$$--Type for more, q to quit, c to continue without paging--
LONGINT ()
#10 0xaab61268 in SYSUTILS
$$INITANDROID ()
#11 0xaab61320 in SYSUTILS
$$_init$ ()
#12 0xaaaf3e2c in fpc_initializeunits ()
#13 0xaaade430 in main () at xidel.pas:77
(gdb)

@benibela
Copy link
Owner

That is a much better trace than strace.

But still the only thing I can gather from it is some trouble with libicui18n

@benibela
Copy link
Owner

I do not think I even use libicui. Perhaps you could just break it

 dd if=xidel bs=1 skip=2051484 count=10 status=none

should print libicui, if you have the same xidel version as I (otherwise use grep -b -ao libicui xidel and use that number rather than 2051484)

Then do

 dd of=xidel bs=1 seek=2051484 count=10 status=none

to override it with something else (type something). Then the file name is removed from xidel, and without file name it cannot load the .so, and if the .so is not loaded, the .so cannot crash

@zpimp
Copy link
Author

zpimp commented Nov 2, 2018

i can confirm it is working by removing libcui18n.so through hexedit

i used bless on pc, couldnt get dd to work as described

thank you for the solution

@benibela
Copy link
Owner

benibela commented Nov 8, 2018

fpc has been changed to not load libcui automatically ( https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=40198 ), so I will try to use that one for the next version

@benibela benibela closed this as completed Nov 8, 2018
@Reino17
Copy link

Reino17 commented Dec 27, 2018

For the first time I've been trying to get Xidel to work on my Android phone.

#19 (comment):

i have put it in /data/data/com.termux/files/home

Or $HOME for short.

#19 (comment):

I had the install.sh running but unsure if it is able to install in the $HOME directory. Maybe I need to modify it.

In Termux all the binaries reside in /data/data/com.termux/files/usr/bin.
'install.sh' can take an argument for a prefix. So ./install.sh $HOME/../usr/bin will install Xidel to the right place.

@benibela However,... despite having installed openssl-dev (openssl was already installed) and libcrypt, I'm constantly getting:

Error:
Internet Error: -4 
when talking to: [...]

Not only on https-, but also on http-urls!
Piping curl's output to Xidel does work, but it looks like I can't open any url at all with Xidel 0.9.8 on my smartphone. Am I forgetting something?

@benibela
Copy link
Owner

benibela commented Jan 4, 2019

I have updated to freepascal 3.3.1 that can build an actual 64 bit version (not tested)

@Reino17
Copy link

Reino17 commented Jan 6, 2019

Thanks for the Android binary.
I've tried to get it to work on my smartphone, but I constantly get Permission denied or Operation not permitted even trying to do basic stuff like moving files around.

I'm still new to Termux, but at least I've used termux-setup-storage. I can confirm "Storage" is enabled in the apps control panel to grant Termux permission to use all storage. I've also used chmod +x on xidel as well as install.sh, but all to no avail. I have no idea what I'm doing wrong.

I can't test your binary. Sorry.

@Invictaz
Copy link

Invictaz commented Jan 6, 2019

@Reino17 Perhaps it is because you are not rooted?

@Reino17
Copy link

Reino17 commented Jan 13, 2019

For that I need tsu, right? I installed it (pkg install tsu), but simply running tsu gives me: /data/data/com.termux/files/usr/bin/tsu: 139: exec: : Permission denied.

@benibela
Copy link
Owner

No, tsu does not root. tsu just makes it easier to use su on an already rooted device, see cswl/tsu#19

@Reino17
Copy link

Reino17 commented Jan 23, 2019

Then I don't know how to root my phone. But, never mind.
Doing that is risky and I was just curious to get Xidel working on it. It was my first experience with Termux (or any terminal on Android)... and it was awful.
Imo, smartphones aren't designed for terminal usage. Computers are. I'll stick to the latter.

@Invictaz
Copy link

@Reino17 Root is only possible from flashing it. For example flash a different recovery (TWRP) and then flash SuperSU to it to have root access. Afterwards install the SuperSU apk to control which app gets superuser access (Root). You need a phone with unlocked bootloader to flash it.

@Invictaz
Copy link

I have manually copied xidel into /data/data/com.termux/files/usr/bin and then chmod 777 on the file. However this gives problems executing it as non root. You have to enter root with "su" and then 'restorecon xidel' in /data/data/com.termux/files/usr/bin

Other option is to turn the SELinux status from Enforcing to Permissive via this app
https://forum.xda-developers.com/showthread.php?t=2524485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants