Radare2: Meson build: error while loading shared libraries

Created on 22 Nov 2020  路  7Comments  路  Source: radareorg/radare2

Work environment

| Questions | Answers
|------------------------------------------------------|--------------------
| OS/arch/bits (mandatory) | Ubuntu 20.10 x64
| File format of the file you reverse (mandatory) | NA
| Architecture/bits of the file (mandatory) | NA
| r2 -v full output, not truncated (mandatory) | radare2 4.6.0-git 25280 @ linux-x86-64 git.4.4.0-943-gc83d0e0c5 commit: c83d0e0c5f96aa8b01ca85b8df035c59452ed78d build: 2020-11-22__17:02:45

Expected behavior

bin/r2 prompts usage.

Actual behavior

bin/r2: error while loading shared libraries: libr_util.so.4.6.0-git: cannot open shared object file: No such file or directory

ldd bin/r2 outputs

    linux-vdso.so.1 (0x00007ffd1a75f000)
    libr_util.so.4.6.0-git => not found
    libr_main.so.4.6.0-git => not found
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0aa0e80000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0aa0c96000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f0aa0edb000)

Steps to reproduce the behavior

pip3 install meson ninja
export PATH=~/.local/bin:$PATH
git clone https://github.com/radareorg/radare2
cd radare2
sys/meson.py --prefix=/home/liumeo/r2meson --shared --install
cd ~/r2meson
bin/r2

LD_LIBRARY_PATH=lib/x86_64-linux-gnu bin/r2 works.

Additional Logs, screenshots, source-code, configuration dump, ...

Drag and drop zip archives containing the Additional info here, don't use external services or link.

Most helpful comment

Also... _don't use sys/meson.py_. Just use meson directly. Additional scripts are useless.

Why useless? I have limited knowledge about meson, and the command in README really helps people like me to test whether their modification works on meson build. Yes I'll definitely learn more about meson, but for now the script is the easiest way I suppose.

Useless because documenting how to use a script that runs meson could be replaced with documenting how to run meson directly. You don't need particular knowledge about meson to run the script nor to run meson directly.

In particular, ./sys/meson.py --prefix=/usr --shared --install can be replaced with meson --prefix=/usr build; cd build; ninja ; sudo ninja install. Which is mostly the same as doing ./configure --prefix=/usr; make; sudo make install or mkdir build; cd build; cmake ..; make; sudo make install. And you don't really need to remember all these things 20 times every day, because you just need to run ninja after the first time (or ninja install if you really want to install, though this is not necessary after the first install, because you can run radare2 directly from the build directory without having to set any LD_LIBRARY_PATH nor anything).

The reason I say they are not useful is that saying people to run meson (or cmake or whatever) directly is not harder than saying to run a script and it is much cleaner and understandable for people already familiar with the build system (e.g. maybe sys/meson.py or sys/install.sh do other things on top of meson/ninja/configure/make, so I'm forced to read their code if something does not work). Morover, you have less unexpected behaviour. For example, I find it quite strange that if you don't specify --shared it compiles everything statically.

Anyway, just use what you find easier to use ;)

All 7 comments

OK I noticed this
https://github.com/radareorg/radare2/blob/c83d0e0c5f96aa8b01ca85b8df035c59452ed78d/.github/workflows/ci.yml#L173-L180
LD_LIBRARY_PATH is manually set. Should have been documented though.

It should work without LD_LIBRARY_PATH overrides if you use --local(-Dlocal=true) option

It should work without LD_LIBRARY_PATH overrides if you use --local(-Dlocal=true) option

It works. I'll update the README and r2book and close this.

Also... don't use sys/meson.py. Just use meson directly. Additional scripts are useless.

Also... _don't use sys/meson.py_. Just use meson directly. Additional scripts are useless.

Why useless? I have limited knowledge about meson, and the command in README really helps people like me to test whether their modification works on meson build. Yes I'll definitely learn more about meson, but for now the script is the easiest way I suppose.

Additional scripts are not useless. They are very useful to avoid having to type the same unnecessary commands 20 times every day or do mistakes just because of a typo. We are clearly not as smart as @ret2libc, and we don't know all the undocumented flags to workaround some build issues and this is why i don't use meson and run the scripts in sys/.

Also... _don't use sys/meson.py_. Just use meson directly. Additional scripts are useless.

Why useless? I have limited knowledge about meson, and the command in README really helps people like me to test whether their modification works on meson build. Yes I'll definitely learn more about meson, but for now the script is the easiest way I suppose.

Useless because documenting how to use a script that runs meson could be replaced with documenting how to run meson directly. You don't need particular knowledge about meson to run the script nor to run meson directly.

In particular, ./sys/meson.py --prefix=/usr --shared --install can be replaced with meson --prefix=/usr build; cd build; ninja ; sudo ninja install. Which is mostly the same as doing ./configure --prefix=/usr; make; sudo make install or mkdir build; cd build; cmake ..; make; sudo make install. And you don't really need to remember all these things 20 times every day, because you just need to run ninja after the first time (or ninja install if you really want to install, though this is not necessary after the first install, because you can run radare2 directly from the build directory without having to set any LD_LIBRARY_PATH nor anything).

The reason I say they are not useful is that saying people to run meson (or cmake or whatever) directly is not harder than saying to run a script and it is much cleaner and understandable for people already familiar with the build system (e.g. maybe sys/meson.py or sys/install.sh do other things on top of meson/ninja/configure/make, so I'm forced to read their code if something does not work). Morover, you have less unexpected behaviour. For example, I find it quite strange that if you don't specify --shared it compiles everything statically.

Anyway, just use what you find easier to use ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PaquitoRiviera picture PaquitoRiviera  路  7Comments

securitykitten picture securitykitten  路  4Comments

RazviAlex picture RazviAlex  路  4Comments

YugoCode picture YugoCode  路  6Comments

crowell picture crowell  路  8Comments