emersion / mrsh

A minimal POSIX shell
MIT License
493 stars 35 forks source link

After installation with meson/ninja: mrsh: error while loading shared libraries: libmrsh.so.0: cannot open shared object file: No such file or directory #114

Closed mkhl closed 5 years ago

mkhl commented 5 years ago

Contrary to what I said earlier, it seems to install the library, but fails to find or open it:

$ mrsh
mrsh: error while loading shared libraries: libmrsh.so.0: cannot open shared object file: No such file or directory
$ file ~/.local/bin/mrsh
/home/mkhl/.local/bin/mrsh: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=062fe8bb8295775cdc5ff52164417e428f8f4714, with debug_info, not stripped
$ ldd ~/.local/bin/mrsh
    linux-vdso.so.1 (0x00007ffcf76d5000)
    libmrsh.so.0 => not found
    libreadline.so.8 => /lib64/libreadline.so.8 (0x00007fb60484c000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fb604686000)
    libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fb604657000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb6048cd000)

The mrsh executable in build runs fine. Maybe the paths it looks for libraries in don't get set properly?

meson --prefix ~/.local build
The Meson build system
Version: 0.50.1
Source dir: /home/mkhl/src/git.sr.ht/~emersion/mrsh
Build dir: /home/mkhl/src/git.sr.ht/~emersion/mrsh/build
Build type: native build
Project name: mrsh
Project version: 0.0.0
Native C compiler: cc (gcc 9.2.1 "cc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1)")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Compiler for C supports arguments -Wundef: YES
Compiler for C supports arguments -Wlogical-op: YES
Compiler for C supports arguments -Wmissing-include-dirs: YES
Compiler for C supports arguments -Wold-style-definition: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Winit-self: YES
Compiler for C supports arguments -Wfloat-equal: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wredundant-decls: YES
Compiler for C supports arguments -Wimplicit-fallthrough=2: YES
Compiler for C supports arguments -Wendif-labels: YES
Compiler for C supports arguments -Wstrict-aliasing=2: YES
Compiler for C supports arguments -Woverflow: YES
Compiler for C supports arguments -Wformat=2: YES
Compiler for C supports arguments -Wno-missing-braces -Wmissing-braces: YES
Compiler for C supports arguments -Wno-missing-field-initializers -Wmissing-field-initializers: YES
Compiler for C supports arguments -Wno-unused-parameter -Wunused-parameter: YES
Library readline found: YES
Checking if "-Wl,--version-script" links: YES
Program ./harness.sh found: YES (/home/mkhl/src/git.sr.ht/~emersion/mrsh/test/./harness.sh)
Program sh found: YES (/usr/bin/sh)
Message: 
Features:
  readline: true
  examples: true
Build targets in project: 3
Found ninja-1.9.0 at /usr/bin/ninja
ninja -C build
ninja: Entering directory `build'
[58/58] Linking target mrsh.
ninja -C build install
ninja: Entering directory `build'
[0/1] Installing files.
Installing subdir /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/array.h to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/ast.h to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/entry.h to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/parser.h to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/builtin.h to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/hashtable.h to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/getopt.h to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/shell.h to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/buffer.h to /home/mkhl/.local/include/mrsh
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/include/mrsh/arithm.h to /home/mkhl/.local/include/mrsh
Installing libmrsh.so.0.0.0 to /home/mkhl/.local/lib64
Installing mrsh to /home/mkhl/.local/bin
Installing /home/mkhl/src/git.sr.ht/~emersion/mrsh/build/meson-private/mrsh.pc to /home/mkhl/.local/lib64/pkgconfig
find ~/.local -name '*mrsh*'
/home/mkhl/.local/bin/mrsh
/home/mkhl/.local/include/mrsh
/home/mkhl/.local/lib64/libmrsh.so
/home/mkhl/.local/lib64/pkgconfig/mrsh.pc
/home/mkhl/.local/lib64/libmrsh.so.0.0.0
/home/mkhl/.local/lib64/libmrsh.so.0
emersion commented 5 years ago

You need to install the lib to a path known by your ld.so installation. For instance: export LD_LIBRARY_PATH=/home/mkhl/.local/lib64.

Note that this has nothing to do with mrsh, it's the same for any other piece of software. ;)

mkhl commented 5 years ago

I see, thank you!

I think I would have expected meson to figure our the right directory, or determine that the one it's installing into won't work, but maybe my systems is broken in a way it presumes has to work.

Good to know anyway, I'll go ahead and close this issue.