Problem to use crystal under virtualbox

Hello, I have an annoying trouble. Actually I’m working on a package manager for Linux. But when I try to compile it or run it in for example a Manjaro virtual machine, I have this error, and I can’t fix it: libLLVM-13.so no such file or directory. And the funniest thing is, this library is installed.

I’m very annoying because I can’t test this type of software under my own system

Try running ldd or libtree on it. You will find that libllvm in turn has dependencies which may be missing but instead the error just says that “some file in regards to libllvm is missing”

1 Like

Okay now I installed all needed libraries, but I have this error when I tried again to launch my program:


    ~/ISM    master  ldd /usr/bin/crystal                                                                                                                                                                                        ✔ 
        linux-vdso.so.1 (0x00007ffd74171000)
        libLLVM-13.so => /usr/lib/libLLVM-13.so (0x00007f666aa14000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f666a7fe000)
        libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f666a787000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007f666a643000)
        libgc.so.1 => /usr/lib/libgc.so.1 (0x00007f666a5d6000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f666a5b5000)
        libevent-2.1.so.7 => /usr/lib/libevent-2.1.so.7 (0x00007f666a55a000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f666a553000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f666a538000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f666a36c000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6671db6000)
        libffi.so.8 => /usr/lib/../lib/libffi.so.8 (0x00007f666a360000)
        libedit.so.0 => /usr/lib/../lib/libedit.so.0 (0x00007f666a325000)
        libz.so.1 => /usr/lib/../lib/libz.so.1 (0x00007f666a309000)
        libncursesw.so.6 => /usr/lib/../lib/libncursesw.so.6 (0x00007f666a296000)
        libxml2.so.2 => /usr/lib/../lib/libxml2.so.2 (0x00007f666a128000)
        libicuuc.so.70 => /usr/lib/../lib/libicuuc.so.70 (0x00007f6669f2c000)
        liblzma.so.5 => /usr/lib/../lib/liblzma.so.5 (0x00007f6669f03000)
        libicudata.so.70 => /usr/lib/../lib/libicudata.so.70 (0x00007f66682e5000)
    ~/ISM    master  crystal Main.cr                                                                                                                                                                                             ✔ 
--: ligne 1: cc : commande introuvable
Error: execution of command failed with code: 127: `cc "${@}" -o /home/zohran/.cache/crystal/crystal-run-Main.tmp  -rdynamic -L/usr/bin/../lib/crystal -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lpcre -lm -lgc -lpthread -levent -lrt -ldl`

I installed gcc, and now I had that as well (on Manjaro VirtualBox)

usr/bin/ld : _main.o : dans la fonction « __crystal_main » :
/usr/lib/crystal/openssl/lib_ssl.cr:261 : référence indéfinie vers « SSL_library_init »
/usr/bin/ld : /usr/lib/crystal/openssl/lib_ssl.cr:261 : référence indéfinie vers « SSL_load_error_strings »
/usr/bin/ld : /usr/lib/crystal/openssl/lib_ssl.cr:261 : référence indéfinie vers « OPENSSL_add_all_algorithms_noconf »
/usr/bin/ld : /usr/lib/crystal/openssl/lib_ssl.cr:261 : référence indéfinie vers « ERR_load_crypto_strings »
collect2: erreur: ld a retourné le statut de sortie 1
Error: execution of command failed with code: 1: `cc "${@}" -o /home/zohran/.cache/crystal/crystal-run-Main.tmp  -rdynamic -L/usr/bin/../lib/crystal -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lpcre -lm -lgc -lpthread -levent -lrt -ldl`

https://www.openssl.org/docs/man1.1.1/man3/ERR_load_crypto_strings.html
Seems the Crystal binary was linked against OpenSSL < 1.1.0 but your installed OpenSSL version is ≥ 1.1.0.

I’m sorry to say, but in order to be working on a package manager for Linux you need to know how to figure out those things yourself :(

2 Likes

Did you make already a package manager ?

What do you mean by package manager?

Something like “apt” on debian? Or “rpm” on redhat?
Or do you mean for the language ecosystem like “gem” for Ruby and “npm” for node?

Because the latter already exists and is called “shard”.

For writing something like “apt”, there are probably better places to look for help?

Like apt or rpm. I’m talking about software managing a linux system

I believe if you want to make a “distributable” binary using crystal is to build it in Alpine Static Linking - Crystal