0

In makefile I'm passing rpath to the linker like this

-Wl,-rpath,/absolute_path_to_folder_with_lib

Everything works, but when I do

-Wl,-rpath,~/symlink

Where ~/symlink -> /absolute_path_to_folder_with_lib The library is not loaded Can value of rpath be a symbolic link ?

szydan
  • 2,318
  • 1
  • 15
  • 16

1 Answers1

0

Can value of rpath be a symbolic link?

It sure can, but you misunderstood your problem, which is not about symbolic link, but about ~ expansion.

When you link your binary with -Wl,-rpath,~/symlink, you end up with RPATH that is literally ~/symlink. Such a directory (or a symlink) does not exist.

When you type e.g. ls ~/symlink into your shell, what actually happens is that your shell expands ~ to whatever $HOME is set to, and then does a readdir on the expanded result.

But dynamic linker does not perform any such expansion, and literally looks for ./~/symlink, which of course doesn't exist.

What you want then is: -Wl,-rpath,$HOME/symlink.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362