pantry icon indicating copy to clipboard operation
pantry copied to clipboard

+ocaml.org

Open rustdevbtw opened this issue 1 year ago • 6 comments

Adds a recipe for OCaml WITHOUT the Compiler Libraries, which are often unnecessary for everything but Opam. For Opam, we need that, btw.

rustdevbtw avatar Mar 31 '24 09:03 rustdevbtw

@jhheider @mxcl Any idea what's wrong? It builds and tests just fine locally. And seems like the bug isn't related to the recipe itself. So, I'm clueless.

rustdevbtw avatar Mar 31 '24 10:03 rustdevbtw

It can't find ocaml. Are you sure there's a bin/ocaml at the end, and it's not a broken symlink? Adding an ls should show it.

jhheider avatar Mar 31 '24 13:03 jhheider

It can't find ocaml. Are you sure there's a bin/ocaml at the end, and it's not a broken symlink? Adding an ls should show it.

Yep, that's the problem. OCaml has so many binaries, that I just copy-pasted all the bin names, and added a - at the beginning. But I forgot to add the bin/ part. bk test worked because I already had OCaml built before with PKGX (I just added bin/ocaml and bin/ocamlc as provides back then).

rustdevbtw avatar Mar 31 '24 15:03 rustdevbtw

Problem was prefix in the build twice: /opt/ocaml.org/v5.1.1+brewing/opt/ocaml.org/v5.1.1+brewing/lib/ocaml/compiler-libs

jhheider avatar Mar 31 '24 20:03 jhheider

it looks like some of the bins are probably shellscripts that need surgery for relocatability.

jhheider avatar Apr 01 '24 14:04 jhheider

this fixes the file-not-found issue:

    - run: |
        LENGTH=$[$(head -n1 ocaml | wc -c)-1]
        NEW_SHEBANG=$(printf "%-${LENGTH}s" "#!/usr/bin/env ocamlrun")
        for BIN in $SHEBANGD; do
          sed -i "1s|.*|$NEW_SHEBANG|" $BIN
        done
      working-directory: '{{prefix}}/bin'
  env:
    SHEBANGD:
      - ocaml
      - ocamlc.byte
      - ocamlcmt
      - ocamlcp
      - ocamldebug
      - ocamldep.byte
      - ocamldoc
      - ocamllex.byte
      - ocamlmklib
      - ocamlmktop
      - ocamlobjinfo.byte
      - ocamlopt.byte
      - ocamloptp
      - ocamlprof

but it still has relocatability issues. Homebrew's recipe suggests build paths are baked into the output, and https://ocaml.org/docs/arm64-fix suggests the only fix is to match install path to build path. if that's true, then this isn't going to work without potentially massive changes to the underlying binaries.

jhheider avatar Apr 01 '24 17:04 jhheider