ignore_nested tests fail if dependencies are in non-standard directory
- capnp built from source and installed -> /usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib- other tests run, but these two don't:
test 958
Start 958: ignore_nested
958: Test command: /usr/bin/bash "source_dir/src/test/ignore_nested.run" "ignore_nested" "" "bin_dir" "120"
958: Test timeout computed to be: 10000000
958: Test 'ignore_nested' FAILED: : error during recording:
958: --------------------------------------------------
958: /home/opc/rr/build/bin/rr: error while loading shared libraries: libcapnp-0.10.3.so: cannot open shared object file: No such file or directory
958: --------------------------------------------------
958: record.out:
958: --------------------------------------------------
958: --------------------------------------------------
958: Test ignore_nested failed, leaving behind /tmp/rr-test-ignore_nested-NziQHtT7g
958: To replay the failed test, run
958: _RR_TRACE_DIR=/tmp/rr-test-ignore_nested-NziQHtT7g rr replay
1/2 Test #958: ignore_nested ....................***Failed Error regular expression found in output. Regex=[FAILED] 0.28 sec
Test 'ignore_nested' FAILED: : error during recording:
--------------------------------------------------
/home/opc/rr/build/bin/rr: error while loading shared libraries: libcapnp-0.10.3.so: cannot open shared object file: No such file or directory
--------------------------------------------------
record.out:
--------------------------------------------------
--------------------------------------------------
Test ignore_nested failed, leaving behind /tmp/rr-test-ignore_nested-NziQHtT7g
To replay the failed test, run
_RR_TRACE_DIR=/tmp/rr-test-ignore_nested-NziQHtT7g rr replay
test 959
Start 959: ignore_nested-no-syscallbuf
959: Test command: /usr/bin/bash "source_dir/src/test/ignore_nested.run" "ignore_nested" "-n" "bin_dir" "120"
959: Test timeout computed to be: 10000000
959: Test 'ignore_nested' FAILED: : error during recording:
959: --------------------------------------------------
959: /home/opc/rr/build/bin/rr: error while loading shared libraries: libcapnp-0.10.3.so: cannot open shared object file: No such file or directory
959: --------------------------------------------------
959: record.out:
959: --------------------------------------------------
959: --------------------------------------------------
959: Test ignore_nested failed, leaving behind /tmp/rr-test-ignore_nested-dRnibfGur
959: To replay the failed test, run
959: _RR_TRACE_DIR=/tmp/rr-test-ignore_nested-dRnibfGur rr replay
2/2 Test #959: ignore_nested-no-syscallbuf ......***Failed Error regular expression found in output. Regex=[FAILED] 0.25 sec
Test 'ignore_nested' FAILED: : error during recording:
--------------------------------------------------
/home/opc/rr/build/bin/rr: error while loading shared libraries: libcapnp-0.10.3.so: cannot open shared object file: No such file or directory
--------------------------------------------------
record.out:
--------------------------------------------------
--------------------------------------------------
Test ignore_nested failed, leaving behind /tmp/rr-test-ignore_nested-dRnibfGur
To replay the failed test, run
_RR_TRACE_DIR=/tmp/rr-test-ignore_nested-dRnibfGur rr replay
0% tests passed, 2 tests failed out of 2
Total Test time (real) = 0.56 sec
The following tests FAILED:
958 - ignore_nested (Failed)
959 - ignore_nested-no-syscallbuf (Failed)
(same when doing export LD_PRELOAD=/usr/local/lib/libcapnp-0.10.3.so, which is definitely recognized in this system)
I think there was something about rr and LD_PRELOAD, but I'm not sure - any hints about debugging this?
Still an issue. When istalling capnproto into /usr then everything works, when installing under /usr/local and having LD_LIBRARY_PATH setup accordingly all other tests run, but this one fails.
Hello @GitMensch, I tried to reproduce this issue. But it worked for me with a Debian Bookworm amd64 qemu VM, current git and capnproto in version 0.10.3 and 1.0.1. Also cmake found needed files in /usr/local by itself, and giving LD_LIBRARY_PATH was not needed at all.
Could you please provide some more information about the system where you observe this issue?
I also have a Debian environment - this has /usr/local included by default (you don't need to set LD_LIBRARY_PATH for running and possibly even not PKG_CONFIG_PATH during cmake) - and it works there fine, too.
I could reproduce that using RHEL environments in the past and yesterday using Oracle Linux 9 (which, as you likely know is based on RHEL9).
I have not much contact to other distributions other than Debian. But could reproduce it now with a OracleLinux 9.2.
OracleLinux-R9-U2-x86_64-boot.iso
sudo dnf install cmake make gcc gcc-c++ gdb libgcc libgcc.i686 glibc-devel glibc-devel.i686 libstdc++-devel libstdc++-devel.i686 libstdc++-devel.x86_64 python3-pexpect man-pages zlib-devel git
curl -O https://capnproto.org/capnproto-c++-0.10.3.tar.gz
tar -zxf capnproto-c++-0.10.3.tar.gz
cd capnproto-c++-0.10.3
./configure
make -j16
sudo make install
git clone https://github.com/rr-debugger/rr.git
mkdir obj && cd obj
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
cmake -DCMAKE_BUILD_TYPE=Release ../rr
make -j8
[benutzer@localhost obj]$ export LD_LIBRARY_PATH=/usr/local/lib
[benutzer@localhost obj]$ bin/ignore_nested bin/rr
bin/rr: error while loading shared libraries: libcapnp-0.10.3.so: cannot open shared object file: No such file or directory
And following lines look like the environment for the child process get removed,
therefore rr is called without the LD_LIBRARY_PATH:
https://github.com/rr-debugger/rr/blob/1afb318f1b8965b96ab9fe525a6b8807aa3c4be0/src/test/ignore_nested.c#L13-L14
Therefore this child rr process fails.
This test could probably be fixed by copying just LD_LIBRARY_PATH into the new environment,
if that defeats the purpose of this test I cannot say.
I noticed following information from make install of capnp, which seem important here:
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
Maybe as a workaround - does it help if you use following flags with a new clean build?
export CFLAGS="-Wl,-rpath -Wl,/usr/local/lib"
export CXXFLAGS=${CFLAGS}
Both options solves the issue.
For the second one (LDFLAGS seems the right variable) that would be something which cmake would need to pick up for any dependencies it finds. This would make running rr more easy, too (not sure if it has any downsides). Therefore that definitely would be useful but my experience with adjusting cmake is nearly zero...
The adjusting of the test seems quite reasonable, and as this is only about a Linux kernel, copying LD_LIBRARY_PATH should be enough. The originating commit d011c5bb2cfeb3ec2bd04e71e9e76ef32b328b66 was about not relying on variables that "tell" rr something, so I think that shouldn't defeat the purpose of the test either. I'm creating a PR for that...