scalapb/protoc-bridge

Nix dynamic linker on Mac is not executable

Closed this issue · 1 comments

On Mac, $NIX_CC/nix-support/dynamic-linker is /usr/lib/dyld which unlike ld-linux is not executable. Which means this command results in /usr/lib/dyld: /usr/lib/dyld: cannot execute binary file.

command = (maybeNixDynamicLinker().toSeq :+ executable) ++ args,

It looks like sbt-protoc contains the same problem:

https://github.com/thesamet/sbt-protoc/blob/20b2a2a75a4c336511a16c6b5f58423ef1d3bcc2/src/main/scala/sbtprotoc/ProtocPlugin.scala#L483

One workaround is to unset NIX_CC in the shell hook, but that introduces its own problems. Not sure what a proper fix will look like.

We should probably make maybeNixDynamicLinker return None if it's not Linux.