I am working on an embedded Linux target, gcc 9.2. If I link with -rpath=/usr/local/lib, the readelf utility shows me the RPATH entry, as expected. If I link with -rpath=$ORIGIN, readelf shows no RAPTH, and nothing involving ORIGIN. The link command appears to be correct: x86_64-poky-linux-g++ ... -Xlinker -rpath=$ORIGIN .... Any ideas?
Link with -rpath=/usr/local/lib works, -rapth=$ORIGIN does not
817 views Asked by Phillip At
1
Simply typing
$ORIGNwas causing your shell to expand the variable before the value was passed to the linker. Since you likely had noORIGINenvironment variable, you were getting nothing.You need to prevent shell expansion so that
$ORIGINliterally is passed to the linker - to do that, one uses single quotes. Double quotes won't work because variables are interpolated in double quotes.