Hello,
I have observed strange behaviour when I tried to use LinkerSettings.unsafeFlags(_:)
.
I have built a C++ library from source and I wanted to add a custom -rpath
with my hand-built .dylib
s.
However, when I added following argument to my manifest:
linkerSettings: [.unsafeFlags(["-rpath", "\(libraryRoot)/lib",])]
and used swift build
, the SPM returned following error: error: unknown argument: '-rpath'
.
Using swift build --verbose
I have observed, that all LinkerSettings.unsafeFlags
are passed to swiftc
without the -Xlinker
option.
I have therefore updated my manifest as follows:
linkerSettings: [.unsafeFlags(["-Xlinker", "-rpath", "-Xlinker", "\(libraryRoot)/lib",])]
and everything works right.
It seems a little strange to me, that I would need to prepend commands for linker with -Xlinker
when using LinkerSettings.unsafeFlags
. Isn't this a bug?