Pkg.update() results in segfault error

I decided to change installed julia 4.7(everything were fine) to julia 5.1(both are generic linux tarballs unpacked in /opt with PATH set accordingly) and this resulted in error about missing libgit2, so i couldn`t run julia. To fix it i installed this library(libgit2-0.24.6) and julia launches now without problems, i can use it as expected. But then i tried to install additional packages, and got error. When i try to simply run Pkg.update() problem is the same - segfault. This is the output:

INFO: Cloning METADATA from GitHub - JuliaLang/METADATA.jl: Metadata for registered Julia packages up to Julia v0.6. No longer maintained. Please see https://github.com/JuliaRegistries/General instead.

signal (11): Segmentation fault
while loading no file, in expression starting on line 0
unknown function (ip: 0x7f1a51465940)
iconv_close at /lib64/libc.so.6 (unknown line)
unknown function (ip: 0x7f184269097d)
unknown function (ip: 0x7f184265ec7e)
unknown function (ip: 0x7f1842660853)
unknown function (ip: 0x7f18426b8bf0)
unknown function (ip: 0x7f184269b57f)
git_reference_iterator_new at /usr/lib64/libgit2.so (unknown line)
git_reference_foreach_name at /usr/lib64/libgit2.so (unknown line)
git_repository_is_empty at /usr/lib64/libgit2.so (unknown line)
git_clone at /usr/lib64/libgit2.so (unknown line)
macro expansion at ./libgit2/error.jl:97 [inlined]
clone at ./libgit2/repository.jl:191
#clone#112 at ./libgit2/libgit2.jl:327
unknown function (ip: 0x7f183faf9169)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
#clone at ./:0
#4 at ./pkg/dir.jl:49
cd at ./file.jl:59
init at ./pkg/dir.jl:47
#cd#1 at ./pkg/dir.jl:28
update at ./pkg/pkg.jl:210
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
do_call at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:66
eval at /home/centos/buildbot/slave/package_tarball64/build/src/interpreter.c:190
jl_toplevel_eval_flex at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:558 [inlined]
jl_toplevel_eval at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:580
jl_toplevel_eval_in_warn at /home/centos/buildbot/slave/package_tarball64/build/src/builtins.c:590
eval at ./boot.jl:234
unknown function (ip: 0x7f1a4cb2029f)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
eval_user_input at ./REPL.jl:64
unknown function (ip: 0x7f183faf7f66)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
macro expansion at ./REPL.jl:95 [inlined]
#3 at ./event.jl:68
unknown function (ip: 0x7f183faeef0f)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1392 [inlined]
start_task at /home/centos/buildbot/slave/package_tarball64/build/src/task.c:254
unknown function (ip: 0xffffffffffffffff)
Allocations: 1256956 (Pool: 1256072; Big: 884); GC: 0
Segmentation fault

My distro is Slackware 14.2 x64(not multilib). I dont have a single idea why this happens and not managed to find solution by searching. Sorry if its wrong place to ask about it. Github suggests to ask here.

You shouldn’t need to install a system copy of libgit2. There should be a libgit2.so in the binary, under lib/julia. Run ldd on it, what does it say?

ldd returns this:

linux-vdso.so.1 (0x00007ffcad900000)
libcurl.so.4 => /opt/julia/lib/julia/./libcurl.so.4 (0x00007fd67c5dd000)
libz.so.1 => /lib64/libz.so.1 (0x00007fd67c38d000)
libssl.so.6 => /opt/julia/lib/julia/./libssl.so.6 (0x00007fd67c13f000)
libcrypto.so.6 => /opt/julia/lib/julia/./libcrypto.so.6 (0x00007fd67bded000)
libssh2.so.1 => /opt/julia/lib/julia/./libssh2.so.1 (0x00007fd67bbbc000)
librt.so.1 => /lib64/librt.so.1 (0x00007fd67b9b4000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd67b797000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd67b3cd000)
libmbedtls.so.10 => /opt/julia/lib/julia/./libmbedtls.so.10 (0x00007fd67b1a6000)
libmbedx509.so.0 => /opt/julia/lib/julia/./libmbedx509.so.0 (0x00007fd67af93000)
libmbedcrypto.so.0 => /opt/julia/lib/julia/./libmbedcrypto.so.0 (0x00007fd67ad40000)
libgssapi_krb5.so.2 => not found
libkrb5.so.3 => not found
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fd67ab3b000)
libk5crypto.so.3 => not found
libdl.so.2 => /lib64/libdl.so.2 (0x00007fd67a937000)
/lib64/ld-linux-x86-64.so.2 (0x0000557159de4000)

When i delete system library and launch julia:

fatal: error thrown and no exception handler available.
Base.InitError(mod=:LibGit2, error=ErrorException(“could not load library “libgit2”
/usr/lib64/libgit2.so: cannot open shared object file: No such file or directory”))
rec_backtrace at /home/centos/buildbot/slave/package_tarball64/build/src/stackwalk.c:84
record_backtrace at /home/centos/buildbot/slave/package_tarball64/build/src/task.c:233
jl_throw at /home/centos/buildbot/slave/package_tarball64/build/src/task.c:551
jl_errorf at /home/centos/buildbot/slave/package_tarball64/build/src/builtins.c:78
jl_dlerror at /home/centos/buildbot/slave/package_tarball64/build/src/dlload.c:69 [inlined]
jl_load_dynamic_library_ at /home/centos/buildbot/slave/package_tarball64/build/src/dlload.c:209
jl_get_library at /home/centos/buildbot/slave/package_tarball64/build/src/runtime_ccall.cpp:152
jl_load_and_lookup at /home/centos/buildbot/slave/package_tarball64/build/src/runtime_ccall.cpp:163
unknown function (ip: 0x7efdb4106ce6)
init at ./libgit2/libgit2.jl:539
unknown function (ip: 0x7efdb41074e8)
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:210 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1950
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1392 [inlined]
jl_module_run_initializer at /home/centos/buildbot/slave/package_tarball64/build/src/toplevel.c:83
_julia_init at /home/centos/buildbot/slave/package_tarball64/build/src/init.c:742
julia_init at /home/centos/buildbot/slave/package_tarball64/build/src/task.c:284
unknown function (ip: 0x40143a)
__libc_start_main at /lib64/libc.so.6 (unknown line)
unknown function (ip: 0x40148c)

You’ll need to install something for these, krb5 probably? The binaries of 0.5 are unfortunately not completely self-contained. This should be fixed on nightly but I considered it a bit of a risky internal change to backport.

Yes, now everything works! Thank you for your help.