Preface: I found the solution / problem while describing the issue π€¦. In a nutshell: please make a release so that I can benefit from the fix that you already have in master. Please close the issue when the release is done.
Nonetheless, I will keep the issue description below for others to find it while searching the π.
Problem description
I try installing this package on an M1 mac. One of the key differences here is that homebrew does not install itself in /usr/local and hence doesn't link all things to previously well known places. I get the following failure during installation:
β― opam install ocaml-protoc-plugin
The following actions will be performed:
β install ocaml-protoc-plugin 4.2.0
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><> π«
β¬ retrieved ocaml-protoc-plugin.4.2.0 (https://opam.ocaml.org/cache)
[ERROR] The compilation of ocaml-protoc-plugin.4.2.0 failed at "dune build -p ocaml-protoc-plugin -j 7".
#=== ERROR while compiling ocaml-protoc-plugin.4.2.0 ==========================#
# context 2.1.2 | macos/arm64 | ocaml.4.14.0 | https://opam.ocaml.org#4d2fbd56
# path ~/.opam/default/.opam-switch/build/ocaml-protoc-plugin.4.2.0
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ocaml-protoc-plugin -j 7
# exit-code 1
# env-file ~/.opam/log/ocaml-protoc-plugin-80671-87983c.env
# output-file ~/.opam/log/ocaml-protoc-plugin-80671-87983c.out
### output ###
# File "src/google_types/dune", line 12, characters 0-1057:
# 12 | (rule
# 13 | (targets any.ml api.ml descriptor.ml duration.ml empty.ml field_mask.ml
# 14 | source_context.ml struct.ml timestamp.ml type.ml wrappers.ml)
# ....30 | %{read-lines:google_include}/google/protobuf/type.proto
# 31 | %{read-lines:google_include}/google/protobuf/wrappers.proto
# 32 | )))
# (cd _build/default/src/google_types && /opt/homebrew/bin/protoc -I /usr/local/include --plugin=protoc-gen-ocaml=../plugin/protoc_gen_ocaml.exe --ocaml_out=. /usr/local/include/google/protobuf/any.proto /usr/local/include/google/protobuf/api.proto /usr/local/include/google/protobuf/descriptor.proto /usr/local/include/google/protobuf/duration.proto /usr/local/include/google/protobuf/empty.proto[...]
# /usr/local/include: warning: directory does not exist.
# Could not make proto path relative: /usr/local/include/google/protobuf/any.proto: No such file or directory
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> π«
ββ The following actions failed
β Ξ» build ocaml-protoc-plugin 4.2.0
ββ
βΆβ No changes have been performed
Essentially, it tries to find the .proto headers (like any.proto) in /usr/local/include/google/protobuf/. However, on my system they are installed to for instance /opt/homebrew/Cellar/protobuf/3.19.4/include/google/protobuf and then linked to /opt/homebrew/include/google/protobuf. FYI: calling brew --prefix yields /opt/homebrew. Also, calling
Preface: I found the solution / problem while describing the issue π€¦. In a nutshell: please make a release so that I can benefit from the fix that you already have in
master
. Please close the issue when the release is done.Nonetheless, I will keep the issue description below for others to find it while searching the π.
Problem description
I try installing this package on an M1 mac. One of the key differences here is that
homebrew
does not install itself in/usr/local
and hence doesn't link all things to previously well known places. I get the following failure during installation:Essentially, it tries to find the
.proto
headers (likeany.proto
) in/usr/local/include/google/protobuf/
. However, on my system they are installed to for instance/opt/homebrew/Cellar/protobuf/3.19.4/include/google/protobuf
and then linked to/opt/homebrew/include/google/protobuf
. FYI: callingbrew --prefix
yields/opt/homebrew
. Also, callingSeeing this line https://github.com/issuu/ocaml-protoc-plugin/blob/3d8b3eeb48e2a58dc80fbfdf9d749e69676625ab/src/google_types/dune#L11 would make me guess that the installation routine should have found it π€.
Ok, the latest release from 16th of May 2022 is
v4.2.0
which still has the following code: https://github.com/issuu/ocaml-protoc-plugin/blob/542e7741549b851162793fcb9179557ff69ac810/src/google_types/dune#L8-L10 Hence, it doesn't askpkg-config
for the correct include path. Problem solved β