opam-repository icon indicating copy to clipboard operation
opam-repository copied to clipboard

Specifying where to find ppl and gmp in the build in case of macOS with homebrew

Open rtetley opened this issue 1 year ago • 3 comments

On my setup, trying to install conf-ppl results on the following error:

[ERROR] The compilation of conf-ppl.1 failed at "sh -c cc test.c -lppl_c -lppl".

#=== ERROR while compiling conf-ppl.1 =========================================#
# context     2.1.5 | macos/arm64 | ocaml-base-compiler.4.13.1 | https://opam.ocaml.org#c55e2f61
# path        ~/.opam/4.13.1/.opam-switch/build/conf-ppl.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build sh -c cc test.c -lppl_c -lppl
# exit-code   1
# env-file    ~/.opam/log/conf-ppl-63991-0708ed.env
# output-file ~/.opam/log/conf-ppl-63991-0708ed.out
### output ###
# test.c:1:10: fatal error: 'ppl_c.h' file not found
# #include <ppl_c.h>
#          ^~~~~~~~~
# 1 error generated.



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build conf-ppl 1
+-
- No changes have been performed
# Run eval $(opam env) to update the current shell environment

This is an attempt at addressing this issue.

rtetley avatar Mar 12 '24 14:03 rtetley

I believe the failure is due to not using the right -I (include directory) - it cannot find ppl_c.h. I suggest having a look at conf-gmp for inspiration, as it has a similar test.c file setup and includes other header file dirs to pass CI: https://github.com/ocaml/opam-repository/blob/master/packages/conf-gmp/conf-gmp.4/opam#L16

jmid avatar Mar 12 '24 21:03 jmid

This looks ok at least as a temporary solution and it is more precise than hardcoding the path as done for gmp, but it is still not working on macos arm64

mseri avatar Mar 13 '24 07:03 mseri

Yup I was trying to fix the include dir, sorry having a hard time using the correct env variables in the context of opam, it looks like the HOMEBREW_PREFIX variable is not working. I'll push an updated version later today

rtetley avatar Mar 13 '24 08:03 rtetley

I'm closing in favour of #25592 - please help review and test that other (simpler) PR.

samoht avatar Apr 02 '24 11:04 samoht