This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-23
Channels
- # announcements (18)
- # babashka (65)
- # bangalore-clj (14)
- # beginners (80)
- # bristol-clojurians (1)
- # calva (4)
- # chlorine-clover (3)
- # cider (39)
- # clj-kondo (5)
- # clojars (1)
- # clojure (134)
- # clojure-france (1)
- # clojure-losangeles (3)
- # clojure-nl (1)
- # clojure-uk (7)
- # clojurescript (17)
- # core-typed (22)
- # data-science (1)
- # datomic (6)
- # duct (9)
- # emacs (48)
- # fulcro (58)
- # graalvm (37)
- # kaocha (2)
- # nrepl (1)
- # reagent (8)
- # shadow-cljs (20)
- # specter (1)
- # tree-sitter (5)
- # xtdb (3)
Is babashka expected to work on alpine linux? I just tried and ran into some weird issues
/ # which bb
/usr/local/bin/bb
/ # bb
/bin/sh: bb: not found
open a fresh shell and try again just to confirm. I've seen this issue before with other bins where the which is called, then the file is deleted, then the which is called again in the same shell, and it reports the path as there when it is not. Maybe some kind of cache.
secondly check the /usr/local/bin/bb location yourself. Is it a symlink? or an actual bin.
@martinklepsch I don’t think it works on Alpine. See an issue about the Docker image
Maybe it could be made to work if we compiled it with the —static option on Linux. I haven’t tried
@martinklepsch That did appear to work:
apk add curl
curl -sL -o bb.zip
unzip bb.zip
./bb '(+ 1 2 3)'
6
@martinklepsch This release should now work on Alpine: https://github.com/borkdude/babashka/releases/tag/v0.0.72
Nice, it seems static linking makes the startup of bb even faster:
root@ae820df046fb:/# time ./bb '(+ 1 2 3)'
6
real 0m0.006s
user 0m0.002s
sys 0m0.004s
it's now 43821000
for linux. let me check the previous size
weirdly enough, it was 44339568
before on linux. whereas on MacOS it's smaller.
I guess adding 1 or 2 mbs to make it work on constrained enviroments like Alpine is worth it, but since it's even smaller and faster now, there is no disadvantage at all?
static linking on Win and Mac is rare, but they don't use alternative standard libraries usually, like Alpine does.
hmm, trying to move the Docker image to alpine:
/ # /usr/local/bin/bb --version
Segmentation fault
🤷I'm unable to build the image, this is what happen during docker build:
Compiling babashka.impl.clojure.core.server
Syntax error macroexpanding at (server.clj:12:1).
Execution error (FileNotFoundException) at babashka.impl.clojure.core.server/loading (server.clj:12).
Could not locate sci/core__init.class, sci/core.clj or sci/core.cljc on classpath.
@ales.najmann You need to git clone/pull the repo --recursive
I'm still not successful, I endup here:
[bb:148] classlist: 13,095.04 ms
[bb:148] (cap): 1,584.37 ms
[bb:148] setup: 3,906.97 ms
[Use -Dgraal.LogFile=<path> to redirect Graal log output to a file.]
[thread:18] scope: ForkJoinPool-4-worker-1
[thread:18] scope: ForkJoinPool-4-worker-1.registerResource
ServiceLoaderFeature: registerResource: META-INF/services/com.fasterxml.jackson.core.JsonFactory
[thread:18] scope: ForkJoinPool-4-worker-1.registerResource
ServiceLoaderFeature: registerResource: META-INF/services/java.nio.file.spi.FileSystemProvider
[thread:18] scope: ForkJoinPool-4-worker-1.registerResource
Resources have been added by ServiceLoaderFeature. Automatic registration can be disabled with -H:-UseServiceLoaderFeature
[thread:18] scope: ForkJoinPool-4-worker-1.registerResource
ResourcesFeature: registerResource: SCI_VERSION
[thread:18] scope: ForkJoinPool-4-worker-1.registerResource
ResourcesFeature: registerResource: BABASHKA_VERSION
Error: Image build request failed with exit status 137
com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 137
at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1482)
at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1260)
at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1222)
at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1181)
The command '/bin/sh -c ./script/compile' returned a non-zero code: 1
have you seen anything like this before?okay, that makes sense. I would rather see meaningful error message from native image 🙂 but it's what it is.
it would be really nice if bb had a built in http client, using stuff via deps is ok but it’s definitely less portable than just having it built in
@borkdude thanks for the alpine pointers, I’ll give that another try
@martinklepsch including an http client is certainly the plan - I am currently considering on including a JDK11-based http client (hato), but we'll have to wait for at least GraalVM 20.1 for this
sweet, i’ve started using hato for it’s support of PATCH requests, wich surprisingly is missing from clj-http-lite it seems
I haven't tested hato with graalvm yet btw, so there's still some research to be done
@martinklepsch btw, there is also the --uberscript
option to morph all your dependencies + script into one file
oh interesting
On windows, in powershell, with babashka installed via scoop, I'm getting the following when I try to use regexes:
ls | bb -i '(re-find #"hi" *input*)'
clojure.lang.ExceptionInfo: [line 1, col 21] No reader function for tag hi.
Is there something I'm missing?it might be something with Windows shell quoting. can you try this from a foo.clj file?
gotcha yeah it definitely seems to have to do with quoting you're right, having other issues with the clj file, but think I just need to play around a bit more, (or just use bash)
ls | bb -f tst.clj
clojure.lang.ExceptionInfo: java.lang.RuntimeException: Invalid token: Directory: [at C:\Users\justin\Downloads\tst.clj, line 1, column 1]
clojure.lang.ExceptionInfo: clojure.lang.Cons cannot be cast to java.lang.CharSequence [at C:\Users\justin\Downloads\tst.clj, line 1, column 1]
what usually looks like a detailed ls
output in linux i believe (file mode,last write, length, name)
ls on linux or mac only produces the filenames if you don't provide any other options
you can also just do (line-seq (io/reader *in*))
instead of *input*
, that makes it more explicit
@martinklepsch Note: I reverted the linux build for bb to a dynamically linked one and will provide a separate statically linked one that you can use in Alpine. See https://github.com/borkdude/babashka/#download
I was experiencing some weirdness when building the static image on Ubuntu, this cannot be run on Alpine, but if you start from Debian you can. I was further informed by @rahul080327 that static linking can lead to unforeseen trouble, this is why I reverted it and will now provide it separately.