Fork me on GitHub
#clj-kondo
<
2022-12-09
>
robert-stuttaford05:12:28

@borkdude please may we have the new clj-kondo in bb pod form? 😄

----- Error --------------------------------------------------------------------
Type:     java.io.FileNotFoundException
Message:  

borkdude09:12:42

I'll do this in an hour, sorry... again :)

Pratik09:12:47

clj-kondo: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by clj-kondo)
30clj-kondo: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by clj-kondo)
we are getting this error in our CI pipeline stage that runs clj-kondo, could it be due to latest clj-kondo version? moving to previous version(2022.11.02) fixes it

1
lispyclouds10:12:36

Is this the static binary? And which OS is this?

Pratik10:12:28

It runs under ubuntu 20.04 image

lispyclouds10:12:01

right and how is the clj-kondo binary downloaded? is it an script install or something else?

Pratik10:12:59

yep, I think we run this

bash <(curl -s )

borkdude10:12:53

I'm also getting this in a docker ubuntu image :/ root@f0047079433a:/# clj-kondo qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory

lispyclouds10:12:12

what does ldd <clj-kondo-binary> and file <clj-kondo-binary> say?

lispyclouds10:12:04

has graalvm increased base glibc version?

borkdude10:12:34

it does work for me when I do:

docker run --rm --platform linux/x86_64  -it ubuntu

borkdude10:12:53

@U01PG2LDYV8 Could it be you're running in docker as well?

lispyclouds10:12:33

yeah the above error you got is an arch mismatch @borkdude

Pratik10:12:48

yes, running it in docker

borkdude10:12:21

on wsl2 I also get:

$ /home/borkdude/.linuxbrew/bin/clj-kondo
/home/borkdude/.linuxbrew/bin/clj-kondo: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/borkdude/.linuxbrew/bin/clj-kondo)
/home/borkdude/.linuxbrew/bin/clj-kondo: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/borkdude/.linuxbrew/bin/clj-kondo)

lispyclouds10:12:44

could you tell what ldd clj-kondo says? not at a linux machine atm

borkdude10:12:05

$ ldd /home/borkdude/.linuxbrew/bin/clj-kondo
/home/borkdude/.linuxbrew/bin/clj-kondo: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/borkdude/.linuxbrew/bin/clj-kondo)
/home/borkdude/.linuxbrew/bin/clj-kondo: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/borkdude/.linuxbrew/bin/clj-kondo)
        linux-vdso.so.1 (0x00007ffc60758000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0a76c5a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0a76a68000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0a796e9000)

lispyclouds10:12:10

and ldd --version ?

lispyclouds10:12:24

there should be a glibc somewhere there

borkdude10:12:37

$ ldd --version
ldd (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31

lispyclouds10:12:11

well something has increased the base requirement, my suspicison is native-image

lispyclouds10:12:48

newer linux images might work. ubuntu 22 i think

borkdude10:12:56

I haven't heard about this problem with babashka

borkdude10:12:32

bb works just fine

borkdude10:12:43

could it be related to the alpine thing I "fixed" yesterday?

lispyclouds10:12:57

well thats only on the alpine image

borkdude10:12:11

I'm using the same graal version for bb

lispyclouds10:12:02

but this seems to be graal 17 and bb is 11 i guess?

borkdude10:12:39

graal 17...?

lispyclouds10:12:55

GRAALVM_HOME: /home/circleci/graalvm-ce-java17-22.3.0 java17

borkdude10:12:56

oh, I didn't even realize that

lispyclouds10:12:36

also i see a mix of 11 and 17 in the circle yaml

borkdude10:12:06

yeah I never intended to upgrade to 17

borkdude10:12:21

but this should work as well, right

borkdude10:12:26

so I'll ask in the graalvm chat

lispyclouds10:12:04

i think so, im just going on the hunch of something bumping the glibc version. reading the release notes

lispyclouds10:12:26

we could try setting it all to java11 as bb?

borkdude10:12:54

I see:

GraalVM will no longer run on some older Linux AMD64 distributions. It is now built against glibc 2.17 (instead of 2.12), and as a result it may not run on Oracle Linux 6 or other RHEL 6 derivatives.

lispyclouds10:12:43

well this is still older than whats here

borkdude10:12:58

Now I also get why the github action broke

borkdude10:12:38

even though it's not clear from the error message, I'm almost certain it has to do with this

borkdude10:12:05

perhaps if it detects a too new glibc version on the CI host machine it links against that?

lispyclouds10:12:02

yeah im thinking that too. could you try ldd --version on cimg/clojure:1.11.1-openjdk-17.0

borkdude10:12:45

I'm doing this in ssh in circleci now:

$ ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35

borkdude10:12:26

On the machine:

$ ldd ./clj-kondo
	linux-vdso.so.1 (0x00007ffcac1d4000)
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1bc2f19000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1bc2efd000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1bc2cd5000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1bc2bee000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f1bc5ba9000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1bc2bce000)

lispyclouds10:12:07

yeah but the error is about 2.32 and 2.34

borkdude10:12:21

makes no sense to me

lispyclouds10:12:06

could try a shell in a container of cimg/clojure:1.11.1-openjdk-17.0 and see the ldd version there?

lispyclouds10:12:20

thats where its built in ci

borkdude10:12:46

when I ssh into the machine, am I not logging into the running docker img then?

lispyclouds10:12:00

no, its the raw instance

borkdude11:12:30

$ ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35

borkdude11:12:54

looks exactly like the output above (so I think I'm in the same docker img, really)

lispyclouds11:12:31

yeah also the lower kernel is shared so doesnt matter much

borkdude11:12:50

Oh, here's a difference, you're right:

$ uname -a
Linux 3320512d8efc 5.15.0-1021-aws #25~20.04.1-Ubuntu SMP Thu Sep 22 13:59:08 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ uname -a
Linux b3097fb367af 5.10.76-linuxkit #1 SMP PREEMPT Mon Nov 8 11:22:26 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

lispyclouds11:12:27

ah, could be the container being scheduled on different machines?

borkdude11:12:43

anyway, let's focus on the libc thing

borkdude11:12:54

I can try to downgrade to the older stuff that bb uses

borkdude11:12:12

or just drop the dynamic binary and do static everywhere

borkdude11:12:22

except that isn't possible on aarch64

lispyclouds11:12:36

fully static should be better in kondo's case than bb

borkdude11:12:10

why so? > + > except that isn't possible on aarch64

lispyclouds11:12:56

yeah the aarch64 issue aside, iirc we do a mostly static build in bb due some issues right?

lispyclouds11:12:06

not fully static

borkdude11:12:18

the issue is just that musl doesn't work for aarch64

lispyclouds11:12:07

right, i guess we are talking about the same thing then

borkdude11:12:54

I'll port the install script to download the static binary on linux...

lispyclouds11:12:33

really trying to diff bb's and kondo's build, bb using circleci/clojure:openjdk-11-lein-2.9.8-bullseye vs cimg/clojure:1.11.1-openjdk-17.0 in kondo for docker builds and machines elsewhere. my thoughts are things couldve updated in the cimg base images and the binary links there

lispyclouds11:12:38

the circleci/... images are deprecated and possibly never got updated

lispyclouds11:12:58

i can try to have a deeper look on better machines a bit later in the day. downloading the static one should be a stop gap thing for now i think too

borkdude11:12:15

I know they're deprecated

borkdude11:12:48

@U01PG2LDYV8 Could you try the install script again? I now tweaked it so it uses the static binary always on linux

borkdude11:12:21

At least it works for me now in wsl2

lispyclouds11:12:26

> I know they're deprecated yeah thats one thought in my head how things could break

borkdude11:12:45

well, it still works with the deprecated images ;)

borkdude11:12:54

I didn't upgrade to cimg myself on clj-kondo, it was a PR

Pratik11:12:44

it’s working!

👍 1
borkdude11:12:09

I'll deprecate the non-static image in clj-kondo and babashka on linux in the future except on aarch64, saves maintaining another build too

👍 1
lispyclouds11:12:28

sounds good to me

kokada11:12:31

LGTM

👍 1
kokada11:12:21

> I'll deprecate the non-static image in clj-kondo and babashka on linux in the future except on aarch64, saves maintaining another build too Any news about static builds in aarch64-linux?

borkdude11:12:55

still same: mostly static except libc

kokada11:12:32

BTW, not related

kokada11:12:50

Probably will try to bump zlib to 1.2.13

kokada11:12:13

There are a few CVEs related to 1.2.11 and 1.2.12, and I think they fixed the issue that caused the errors in 1.2.12

lispyclouds11:12:28

I can have a look at it if you send a PR @UFDRD93RR

kokada11:12:03

Correct incorrect inputs provided to the CRC functions. This mitigates a bug in Java. 
Yeah, looks like they fixed the issue specially for Java lol

borkdude11:12:06

geez, it really helps to have mac + amd / aarch64 + windows + linux at home for these kinds of things.. I made a mistake on macos + static in the bash script which I could test on my older macbook which is still amd64

lispyclouds11:12:58

so much for Java's Write Once, Run Anywhere

kokada11:12:19

Write Once, Debug Anywhere more likely

borkdude11:12:21

that's the issue with distributing binaries

borkdude11:12:33

not java's problem, native image problem

lispyclouds11:12:48

yeah was sarcasm 😛

kokada11:12:51

Java does have a few issues with multi-platform though 😛

kokada11:12:07

I am trying to get openjdk inside nixpkgs up-to-date and it is a mess

borkdude11:12:12

I'll also update the brew formula to pick the static binary from now on

lispyclouds11:12:16

< Insert rewrite in Rust joke here >

borkdude11:12:58

brew formula also updated, works on my ubuntu now

borkdude11:12:29

the issue with the musl binaries was that their stack size is tiny except when you run them in a thread (which is then configurable) which caused issues for bb

borkdude11:12:48

so when in musl, the whole main program is running inside a "dummy" thread

borkdude11:12:38

the overhead for that is probably small enough to not worry about it

borkdude11:12:04

Going with this in the bb install script as well:

*) arch=amd64
       # always use static image on linux
       if [[ "$platform" == "linux" ]]; then
           static_binary="true"
       fi
       ;;

1
borkdude11:12:51

I hope that will prevent questions / confusions like these: https://github.com/babashka/babashka/issues/1434

borkdude11:12:36

done:

$  bash <(curl -s ) --dir /tmp
Downloading  to /tmp/tmp.yP24TUxaOO
Moving /tmp/bb to /tmp/bb.old
Successfully installed bb in /tmp

borkdude11:12:32

Brew bb formula also updated

borkdude11:12:48

I wonder if running the whole main program in a thread means bb could use less cores...

borkdude11:12:56

probably not right

kokada12:12:11

> I wonder if running the whole main program in a thread means bb could use less cores... It will use extra stack and there is a small overhead. Not really measurable, specially on Linux that is really efficient with Threads

kokada12:12:31

If this was in macOS or Windows (in WSL1 specially), you probably can measure some difference

kokada12:12:43

It seems the Dockerfile has a few issues...

kokada12:12:10

GraalVM only supports building static binaries on x86_64.

borkdude12:12:39

this is "our" message ;)

kokada12:12:49

Yeah I know

kokada12:12:05

We basically set BABASHKA_ARCH to amd64 somewhere in the process

kokada12:12:11

That is clearly wrong

borkdude12:12:36

@UFDRD93RR can you explain why those defaults are removed? it's been a while ... :) cc @U7ERLH6JX

kokada12:12:04

With the defaults I was having the issue above

kokada12:12:08

They're also clearly wrong

kokada12:12:28

Because TARGETARCH for amd64 should not set BABASHKA_ARCH to amd64 too

kokada12:12:06

(`BABASHKA_ARCH` should be x86_64)

lispyclouds12:12:14

Just fyi, I’ll try to have a look in a bit later today. Reaching to better machines and time hopefully 😅

borkdude12:12:01

ok @U7ERLH6JX I'll let you review + merge this when you have time

borkdude13:12:36

The advice from graalvm slack: build with the oldest ubuntu possible

borkdude09:12:55

I'm doing another clj-kondo release with a docker image that uses the SHA of the image that was used in the previous version

lispyclouds09:12:32

Great that you found the SHA! I'm semi glad too that glibc getting bumped externally hunch played out and we now know where too.

lispyclouds09:12:10

i looked at glibc version on ubuntu:22.04 docker now, its at 2.35. when they move everyone else is moved too i guess

borkdude09:12:00

but how quickly :)

lispyclouds10:12:46

well, annoying but useful learnings. at least for me 😛

borkdude10:12:59

I've had this problem before I think once

borkdude10:12:32

In graal we had a discussion on being able to set a lower glibc version in the native image despite the build env

borkdude10:12:47

hope they will support that, but I guess you'd also have to deal with zlib etc

lispyclouds10:12:27

at least zlib isnt fine grained into the OS like glibc. can control it better

borkdude10:12:55

I guess glibc is the most difficult one

lispyclouds10:12:55

well if youre google and you solve it by inventing a whole glibc free language to get around it 😅

lispyclouds10:12:30

> on being able to set a lower glibc version in the native image despite the build env thats some complex bin stubs and magic there i think

borkdude10:12:04

it's just a constant in the binary

borkdude10:12:31

remember that nixos tools can override this too using some tool which rewrites that constant in some table