On Tue, Apr 26, 2022 at 10:02:09PM +0200, info at maximka.de
wrote:> Download libnbd from github and compiled successfully, but for some
> reason golang-executable created by `make` failed to find libnbd:
>
> ? ~/git/github/libguestfs/libnbd [master|?]
> 21:24 $ ./golang/examples/get_size/get_size
> ./golang/examples/get_size/get_size: /lib/x86_64-linux-gnu/libnbd.so.0:
version `LIBNBD_1.12' not found (required by
./golang/examples/get_size/get_size)
> ./golang/examples/get_size/get_size: /lib/x86_64-linux-gnu/libnbd.so.0:
version `LIBNBD_1.8' not found (required by
./golang/examples/get_size/get_size)
> ./golang/examples/get_size/get_size: /lib/x86_64-linux-gnu/libnbd.so.0:
version `LIBNBD_1.6' not found (required by
./golang/examples/get_size/get_size)
> ./golang/examples/get_size/get_size: /lib/x86_64-linux-gnu/libnbd.so.0:
version `LIBNBD_1.4' not found (required by
./golang/examples/get_size/get_size)
>
> Could anyone explain, why go compiles executable without any issue,
> but it fails to run? I'll appreciate any feedback!
If you want to run programs from the build directory you would
normally have to use ?./run ...? which sets up environment variables
like LD_LIBRARY_PATH so that it uses the locally built library.
For example:
$ nbdkit memory 1G
$ ./run ./golang/examples/get_size/get_size nbd://localhost
size of nbd://localhost = 1073741824
$ killall nbdkit
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top