zig c++
linker puts relative path into NEEDED section of dynamically linked executable breaking rpath resolution
#21219
Labels
bug
Observed behavior contradicts documented or intended behavior
Zig Version
0.14.0-dev.1320+492cc2ef8
Steps to Reproduce and Observed Behavior
I'm trying to link an executable dynamically against a shared library. The shared library and the output executable are located in separate
lib/
andbin/
directories, respectively. I'm further setting an rpath so the executable will point to the relative library location correctly:This is unexpected and not what I want! The executable now links against the entire relative path
lib/libfoo.so
rather than justlibfoo.so
. It also means that the rpath is useless when I try to invoke the executable from thebin/
directory:I'm reporting this on the latest 0.14.0-dev snapshot version to demonstrate that the problem is still there, however, the bug has been present since 0.11.0.
Expected Behavior
Zig 0.10.1 is the last released version that exhibits the correct behavior:
Note how the executable now depends on
libfoo.so
directly and makes correct use of the rpath no matter where it is executed from.The text was updated successfully, but these errors were encountered: