not found, but 2.1.7 installed

I get an error when running a test in my application.

I’m on Ubuntu 20.04 using Crystal v 1.7.3 and I have in my /usr/lib directory.

Why is crystal looking for 2.1.6 only and can I change that or should I install the 2.1.6 libs as well?

I installed my crystal binary through these instructions Install On Ubuntu - The Crystal Programming Language

My program for some reason insists on 2.1.6 existing

ldd bin/mysqldumpsplitter (0x00007ffe9ab1f000) => /lib/x86_64-linux-gnu/ (0x00007f161b9da000) => /lib/x86_64-linux-gnu/ (0x00007f161b967000) => /lib/x86_64-linux-gnu/ (0x00007f161b944000) => not found => /lib/x86_64-linux-gnu/ (0x00007f161b93a000) => /lib/x86_64-linux-gnu/ (0x00007f161b934000) => /lib/x86_64-linux-gnu/ (0x00007f161b917000) => /lib/x86_64-linux-gnu/ (0x00007f161b725000)
        /lib64/ (0x00007f161bedc000)

This is whats installed on my system

ldconfig -p | grep event (libc6,x86-64) => /lib/x86_64-linux-gnu/ (libc6,x86-64) => /lib/x86_64-linux-gnu/ (libc6,x86-64) => /lib/x86_64-linux-gnu/ (libc6,x86-64) => /lib/x86_64-linux-gnu/ (libc6,x86-64) => /lib/x86_64-linux-gnu/ (libc6,x86-64) => /lib/x86_64-linux-gnu/ (libc6,x86-64) => /lib/x86_64-linux-gnu/

Crystal uses the system linker to link the executable. It just passes -levent and the linker takes care of choosing the version.
So this looks like some kind of misconfiguration in your system.

You can pass --cross-compile to the compiler. This generates an object file and prints a linker command. You need to run this command to link the executable. This could be helpful for debugging your linker setup as you don’t need to run the Crystal build step every time you try the linker.

1 Like

So I made a mistake. I copied my codebase from an old machine and didn’t realise I was actually executing the dynamically linked binary.

1 Like