Fork me on GitHub
#babashka
<
2022-10-10
>
psdp02:10:10

Hello. Trying to get bb running in Termux on Xiaomi Pad 4, I got an error, not sure why and how to fix that.

bash: /data/data/com.termux/files/usr/bin/bb: cannot execute: required file not found

lispyclouds02:10:45

did you download the amd64 version of the binary by any chance and not the arm64?

lispyclouds02:10:05

also what kind of a CPU does that device have?

psdp02:10:07

@U7ERLH6JX I just used bb installation script, it installed the aarch64 binary. No error output during installation. Couldn't execute bb after install. CPU is Qualcomm Snapdragon 660

lispyclouds02:10:19

could you tell me the output of uname -a and file <path-to-bb> in your system?

psdp02:10:54

Sure.

~ $ uname -a
Linux localhost 4.4.302-lineageos-g91a081bcae19 #1 SMP PREEMPT Sun Sep 11 10:00:51 JST 2022 aarch64 Android
~ $ file $PREFIX/bin/bb
/data/data/com.termux/files/usr/bin/bb: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=118cdc1ac9a17f39c1f110ab73e28b82b7677233, for GNU/Linux 3.7.0, with debug_info, not stripped

lispyclouds03:10:01

could you try the install script with --static=true?

lispyclouds03:10:17

i think one of the deps in the dynamic bin is missing on your system

psdp03:10:38

~/tmp $ ./install-bb --static
Downloading  to /data/data/com.termux/files/usr/tmp/tmp.kYkVVl6jb8
Moving /usr/bin/bb to /usr/bin/bb.old
Successfully installed bb in /usr/bin
~/tmp $ bb
bash: /data/data/com.termux/files/usr/bin/bb: cannot execute: required file not found
~/tmp $

psdp03:10:05

Doesn't seem to work :(

lispyclouds03:10:15

what does ldd <path-to-bb> say?

psdp03:10:57

~ $ ldd $PREFIX/bin/bb
libdl.so.2
libpthread.so.0
libc.so.6
ld-linux-aarch64.so.1

lispyclouds03:10:11

ah i see it, the static binary on arm isnt fully static as graalvm doesnt support musl builds on arm yet. and it seems one of the dynamic libs is missing on your OS

lispyclouds03:10:37

one or more of • libdl.so.2 • libpthread.so.0 • libc.so.6 is missing.

lispyclouds03:10:15

this is a limitation of the GraalVM unfortunately 😕

psdp03:10:02

@U7ERLH6JX Thanks for checking that for me. So nothing I can do about it, right?

lispyclouds03:10:58

dont think so as of now, we'll have a look again if something has changed and report back here

psdp03:10:04

Thanks! I understand

lispyclouds03:10:18

if you could try installing/make sure they are there, the 3 deps i mentioned before could help too

lispyclouds03:10:33

my suspicion is libdl.so.2

lispyclouds03:10:07

also could be a lineageos thing of whats included and not

borkdude06:10:56

Have you tried: https://github.com/babashka/babashka/releases/download/v0.10.163/babashka-0.10.163-linux-aarch64-static.tar.gz That is the static executable for linux aarch64 which is compiled with H:+StaticExecutableWithDynamicLibC

borkdude07:10:21

Ah yes, you tried that one. Well that should work iff you have libc.so

psdp11:10:57

yes, libc.so is located at both /system/lib and /system/lib64

lispyclouds11:10:25

could you maybe try symlinking libc.so to libc.so.6? it may get picked up then?

borkdude11:10:54

is 6 the version number? what could possibly go wrong? :)

lispyclouds11:10:19

well cant be worse than what it is now 😛

lispyclouds11:10:15

or maybe try finding the package that provides it, not sure what lineage uses

borkdude11:10:15

> The libc.so.6 file is present in the libc6 package.

lispyclouds11:10:40

depends on the package manager and the distro i think

borkdude11:10:45

symlink might work

lispyclouds11:10:09

yeah its one of the dirty tricks ive used to get by 😅

psdp11:10:42

tried that already, symlink didn't work :( I need to find a package which contains libc.so.6 for termux

lispyclouds11:10:34

ah we do have a brave person to experiment with then 😛

lispyclouds11:10:33

seems to be The One 😎

psdp11:10:25

I have just tried that one, doesn't work either :(

borkdude11:10:30

Normally ldd will say which files it found right? It seems it didn't find any of the requires libraries?

psdp12:10:29

Output of ldd is different now

$ ldd $PREFIX/bin/bb
libstdc++.so.6
libz.so.1
libdl.so.2
libpthread.so.0
libc.so.6
ld-linux-aarch64.so.1
I added symlinks for all those missing in $PREFIX/lib, I believe the only missing is ld-linux-aarch64.so.1 which couldn't be found in /system/lib or /system/lib64

lispyclouds12:10:07

its interesting that with the mostly static binary it still needs so many things. graalvm said it should only need libc

Crispin05:10:36

also interesting is that ldd here doesn't print after each library the full path of what it found.

Crispin05:10:38

@U5SB58RLZ can you show us what ldd --version prints? And what ld --version prints aswell while we are at it.

Crispin05:10:29

also /etc/ld.so.conf would be useful, and whats in /etc/ld.so.conf.d directory if it exists. There is something strange about this termux platform...

Crispin05:10:12

There appears to be a tool ndk-depends on android that may help here. Do you have ndk-depends on your system? https://android.googlesource.com/platform/ndk/+/426f4ee8a8c3be97122c1a6bf5f58dbd9486bbc9/docs/text/NDK-DEPENDS.text

psdp04:10:19

@U1QQJJK89 Only ld --version is available.

GNU ld (GNU Binutils) 2.39
Copyright (C) 2022 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
How ndk-depends may help? I couldn't find a package call ndk-depends for termux.

Crispin05:10:46

It's interesting that the linker is a quite up to date version of GNU ld, but ldd (which is actually a wrapper script) is not your standard binutils ldd. I'm trying to ascertain why the list of linked files doesn't show their resolved paths. Can you see if running the following gives you the same output as your ldd invocation: LD_TRACE_LOADED_OBJECTS=1 ld /path/to/bb

psdp06:10:43

hmm..that doesn't work

~ $ LD_TRACE_LOADED_OBJECTS=1 ld $PREFIX/bin/bb
ld: cannot use executable file '/data/data/com.termux/files/usr/bin/bb' as input to a link

Crispin08:10:22

so the OS on your xiaomi is MUI or lineage? I saw lispyclouds mention lineage but I don't see you mention it.

Crispin08:10:17

ah gotcha. I have an old mobile device with lineage on it. I will dig it out an have a try

lispyclouds08:10:43

on a side note, getting bb to run in such devices would be cool too!

borkdude08:10:31

We do have reports here of people having bb work on their tablet: https://github.com/babashka/babashka/issues/241

lispyclouds08:10:08

i guess we switched to mostly static for ARM after that?

borkdude08:10:46

I converted that issue into a discussion: https://github.com/babashka/babashka/discussions/1392?converting=1 If you have any new info that is useful in the future, please put it there too

borkdude08:10:06

You could try re-compiling without the mostly static option, or compile bb on the device itself

psdp14:10:03

Will try again later. Thank you all!

Annaia Danvers21:10:08

I'm not sure if this is the right place to ask or #quickdoc, but I'm writing a script that scrapes our team's github repos and generates docs from them with quickdoc. The somewhat hacky way I'm doing this at the moment is to clone a repo and run quickdoc against it, but this has hit a little snag with the source links in the output. To get quickdoc to see the source of the newly cloned repo, I have to prepend the newly cloned repo's directory name to all my target source paths, but this results in an extra directory in the path, and the Github source links break. This seems to be due to where the clj-kondo pod thinks it is when it's invoked by quickdoc, but I can't figure out how or if it can be retargeted properly. Code example in the thread.

borkdude21:10:40

There is a #C03EC4DD26S channel where you can post these questions, but let's continue here for now

👍 1
Annaia Danvers21:10:51

Yeah, I wasn't sure if this was an issue with quickdoc or just me not understanding how to work with babashka file paths yet

borkdude21:10:07

ok yeah, that makes sense

Annaia Danvers21:10:05

ie. if this were Bash, I'd cd to the cloned dir, run there, then cd back. But that didn't obviously track to how fs/`process` work

borkdude21:10:17

process supports this via the :dir option, but that doesn't really help you here, I think.

1
borkdude22:10:09

I'm not sure how to solve this without e.g. adding an explicit :dir argument to quickdoc which then strips off that dir part

borkdude22:10:51

I'm going to bed now, but feel free to play around with this and submit an issue and/or PR

Annaia Danvers22:10:54

Yeah, it seems like quickdoc would need to be able to be told an explicit root dir to invoke itself from.

Annaia Danvers22:10:15

OK, I will take a look and see if I can come up with anything tomorrow.

borkdude22:10:27

quickdoc can't invoke itself from another dir, but it can rewrite some stuff before emitting markdown

👍 1
borkdude10:10:56

@U03TPPC0R0T I think this might be a good solution: https://github.com/borkdude/quickdoc/blob/a94ab9d46b0e5f787096b49a653b39e9ed3fd47a/bb/tasks.clj#L11 So using :filename-fn you can transform the filename, e.g. strip the root, before it's rendered to markdown.

Annaia Danvers13:10:29

Ahh, yeah, that could work. I presume this function applies before it's turned into a URL?

Annaia Danvers14:10:47

Hah! This worked great, thank you!

:filename-fn #(str/replace % (re-pattern (str name "/")) "")

👍 1
borkdude14:10:58

You might want to throw this in:

user=> (clojure.string/re-quote-replacement "$foo")
"\\$foo"

👀 1
borkdude14:10:18

no sorry, that didn't make sense

borkdude14:10:27

nice to hear that it worked :)