Skip to content

Commit

Permalink
Add documentation of binary modification
Browse files Browse the repository at this point in the history
Signed-off-by: Tanner <[email protected]>
  • Loading branch information
tstirrat15 authored and ghaskins committed May 17, 2022
1 parent 916fe08 commit 9ab7ff2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,24 @@ Download the latest [Release](https://github.com/protojure/protoc-plugin/release
sudo curl -L https://github.com/protojure/protoc-plugin/releases/download/v2.0.0/protoc-gen-clojure --output /usr/local/bin/protoc-gen-clojure
sudo chmod +x /usr/local/bin/protoc-gen-clojure
```

### Usage with non-`protoc` clients
To use this plugin with other build systems (such as [buf](https://github.com/bufbuild/buf)), you'll need to modify the binary, as the binary is actually a shell wrapper around a `.jar` file. If you see an error that looks like this:

```console
Failure: plugin clojure: fork/exec /Users/me/.local/bin/protoc-gen-clojure: exec format error
```
It's because of this shell wrapper.

In order for `exec` calls to work properly (on a \*nix system), you'll need to prepend a hashbang to the shell block. An example of how to do this:

```sh
cd /path/to/containing/folder
mv protoc-gen-clojure protoc-gen-clojure-other
echo "#!/bin/sh" > protoc-gen-clojure
cat protoc-gen-clojure-other >> protoc-gen-clojure
chmod +x protoc-gen-clojure
rm protoc-gen-clojure-other
```

Note that your editor may reformat the binary in such a way that it doesn't work anymore; hence the above approach.

0 comments on commit 9ab7ff2

Please sign in to comment.