How to use rpath with LLD linker (LLVM)

886 Views Asked by At

I recently managed to use the lld linker in a big cmake project. (LLVM 11, from this package) I do not use clang, I use G++ with LLD.

But I encounter the following issue: lld: error: unknown argument: -rpath

Following the clang documentation, -rpath should work, at least with clang I guess ?

Here is the g++ command generated by cmake:

g++.exe  [...] -fuse-ld=lld [...] -Wl,-rpath='$ORIGIN' [...]

I manually tried a lot of combinations:

-Wl,-rpath='$ORIGIN'
-Wl,-rpath,'$ORIGIN'
-Wl,-rpath '$ORIGIN'

... etc, nothing work.

Of what I understand, lld should behave exactly like ld ?, so -Wl,-rpath='$ORIGIN' should work ? Did I miss something ?

0

There are 0 best solutions below