#Is there a way to specify "-rpath" to zig cc?

1 messages · Page 1 of 1 (latest)

proper hemlock
#

On MacOS, ordinarily if I want to link to a dylib that's in a non-standard install directory, I can just pass the "-rpath /path/to/libs" arguments to clang, but it seems like this is not supported by zig cc. I know that this is possible in build.zig with addRPath.

rustic compass
#

Oh, I'm sorry, I read your question backwards!

#

zig cc --help shows a few things related to rpath but I'm not sure if one of them is equivalent to the clang flag

#

These flags are all automatically generated and look exactly the same as the output of clang --help. I just ran clang --help and don't see -rpath. From man ld it looks like a linker flag, not sure exactly how it decides which flags to pass to the linker

#

Maybe this is what you need

 -z <arg>                Pass -z <arg> to the linker
proper hemlock
#

Oh that makes sense that it’s a linker flag, so it needs special handling. I’ll try that, thanks!!

proper hemlock
#

Hm darn, zig cc complains about "error: unsupported linker extension flag: -z -rpath"

rustic compass
#

Man, I'm trying to follow the path of how command line flags are processed in src/main.zig... my head is spinning

#

If you use IRC you would probably get a quick answer on #zig on libera.chat

river grotto
#

does -Wl,-rpath,/does/not/exist not work?

rustic compass
river grotto
#

yep