Skip to content

Conversation

drjdn
Copy link
Contributor

@drjdn drjdn commented Oct 11, 2025

p5scm.0.5.0

Scheme via camlp5
This a simple scheme implementation using pa_schemer from camlp5



🐫 Pull-request generated by opam-publish v2.7.0

@drjdn
Copy link
Contributor Author

drjdn commented Oct 13, 2025

Some of the errors are because of dependencies both cyclical and otherwise. The errors on FreeBSD are due to the following code:

let get_version () =
  let vers = Stdlib.Sys.ocaml_version in
  if (String.length vers) > 5 then
    let vers0 = (String.sub vers 0 5) ^ "X" in
    Printf.printf "%s\n" vers0; flush stdout
  else
    let vers0 = (String.sub vers 0 4) ^ "X" in
    Printf.printf "%s\n" vers0; flush stdout
    
let _ = get_version ()

I'm not sure how to make this more portable. It should return 4.12.X, 5.3.X, 5.4.X etc. however on FreeBSD it returns 5.4.0X which causes the failure. I don't have a machine running FreeBSD to test.

@mseri
Copy link
Member

mseri commented Oct 14, 2025

we can make it unavailable on freebsd, or merge as is, maybe some interested user can suggest a fix in a future PR

@mseri
Copy link
Member

mseri commented Oct 14, 2025

It does also fail on the alpha/beta/rc compilers with the same issue:

#=== ERROR while compiling p5scm.0.5.0 ========================================#
# context              2.4.1 | linux/x86_64 | ocaml-base-compiler.5.4.0~alpha1 | pinned(https://github.com/drjdn/p5scm/archive/refs/tags/0.5.0.tar.gz)
# path                 ~/.opam/5.4~alpha1/.opam-switch/build/p5scm.0.5.0
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune build -p p5scm -j 255 @install
# exit-code            1
# env-file             ~/.opam/log/p5scm-7-617ca0.env
# output-file          ~/.opam/log/p5scm-7-617ca0.out
### output ###
# File "src/lib/dune", lines 18-21, characters 0-167:
# 18 | (rule
# 19 |   (targets pa_scheme.ml pr_o.ml o_keywords.ml pr_dump.ml exparser.ml exparser.mli pconfig.ml)
# 20 |   (deps (source_tree camlp5))
# 21 |   (action (chdir camlp5 (run make))))
# (cd _build/default/src/lib/camlp5 && /usr/bin/make)
# cppo pa_schemer.cppo.ml -o pa_schemer.ml
# not-ocamlfind preprocess -package camlp5.extend,camlp5.quotations,camlp5.pr_o -syntax camlp5r pa_schemer.ml > ../pa_scheme.ml
# cppo pr_o.cppo.ml -o pr_o.ml
# not-ocamlfind preprocess -package camlp5.extend,camlp5.macro,camlp5.quotations,camlp5.extfun,camlp5.extprint,camlp5.pprintf,camlp5.pr_o -syntax camlp5r pr_o.ml > ../pr_o.ml
# not-ocamlfind preprocess -package camlp5.pr_o -syntax camlp5r o_keywords.ml > ../o_keywords.ml
# cppo pr_dump.cppo.ml -o pr_dump.ml
# not-ocamlfind preprocess -package camlp5.pr_o -syntax camlp5r pr_dump.ml > ../pr_dump.ml
# not-ocamlfind preprocess -package camlp5.quotations,camlp5.pr_o -syntax camlp5r exparser.ml > ../exparser.ml
# not-ocamlfind preprocess -package camlp5.quotations,camlp5.pr_o -syntax camlp5r exparser.mli > ../exparser.mli
# cp ./ocaml_stuff/5.4.0X/utils/pconfig.ml ../pconfig.ml
# cp: cannot stat './ocaml_stuff/5.4.0X/utils/pconfig.ml': No such file or directory
# make: *** [Makefile:33: pconfig] Error 1

@drjdn
Copy link
Contributor Author

drjdn commented Oct 14, 2025

The call to Stdlib.Sys.ocaml_version must produce different results on FreeBSD (trailing characters). I can confirm that on my Debian system p5scm 0.5.0 compiles with OCaml 5.4.0. I'd be happy to see this merged as is, would be great to get a pull request from someone running FreeBSD. Hard for me to fix something I can't replicate.

@mseri
Copy link
Member

mseri commented Oct 15, 2025

The failure that I pasted above is on linux. It is for pre-release compilers, e.g. 5.4.0~alpha1

@mseri
Copy link
Member

mseri commented Oct 15, 2025

FreeBSD failure is different:

  • /usr/local/bin/opam: "create_process" failed on /home/opam/.opam/4.14.2/.opam-switch/build/camlp5.8.04.00/./configure: No such file or directory
  • /usr/local/bin/opam: "create_process" failed on /home/opam/.opam/5.3.0/.opam-switch/build/camlp5.8.04.00/./configure: No such file or directory

I am fine to merge it as is, I just wanted to point out that the trailing character issue is from debian when using release candidate versions of the compiler.

@mseri mseri added the question label Oct 15, 2025
@drjdn
Copy link
Contributor Author

drjdn commented Oct 15, 2025

I have tested this on Debian with the current 5.4.0 release and it works fine. I'm just guessing as to what is causing the error. In theory it should work but there has to be a hidden escape or something. Have no idea how to fix it as I can't replicate it. The code pasted above is the same code that is in version 0.4.0 currently on opam.

@jmid
Copy link
Member

jmid commented Oct 15, 2025

With any kind of release candidate, alpha, or beta the version string becomes longer than 5 chars, hits the first branch, and thus fails. It is easy to reproduce, here on Linux with 5.4.0~alpha1:

$ opam switch 5.4.0~alpha1
$ ocaml
OCaml version 5.4.0~alpha1
Enter #help;; for help.

[...]

# Stdlib.Sys.ocaml_version;;
- : string = "5.4.0~alpha1"
# let get_version () =
    let vers = Stdlib.Sys.ocaml_version in
  if (String.length vers) > 5 then
    let vers0 = (String.sub vers 0 5) ^ "X" in
    Printf.printf "%s\n" vers0; flush stdout
    else
    let vers0 = (String.sub vers 0 4) ^ "X" in
    Printf.printf "%s\n" vers0; flush stdout;;
val get_version : unit -> unit = <fun>
# get_version ();;
5.4.0X
- : unit = ()

@drjdn
Copy link
Contributor Author

drjdn commented Oct 15, 2025

Thanks Jan. I can fix this by searching for the second decimal. How best to handle this for you guys? Do I just close this request, fix and make a new one? Definitely not a git expert so that would be a route I could handle. Thanks.

@jmid
Copy link
Member

jmid commented Oct 15, 2025

Some folks close, roll a fix, bump the version number, and roll a new release PR with the next version.

Others fix in the release branch, update the git version tag, and rerun opam publish (this will automatically reuse this existing PR, as long as it is still open and the version number is the same).

As both approaches are accepted, I think it boils down to how hard one sticks to a git version tag... 🤷

@drjdn
Copy link
Contributor Author

drjdn commented Oct 15, 2025

Here is the new more robust version. Not sure if this will fix the FreeBSD fails.

let get_version () =
  let vers = Stdlib.Sys.ocaml_version in
  let indx = String.index_from vers 2 '.' in 
  let vers0 = (String.sub vers 0 (indx+1)) ^ "X" in
  Printf.printf "%s\n" vers0; flush stdout
    
let _ = get_version ()

@drjdn
Copy link
Contributor Author

drjdn commented Oct 15, 2025

Thanks Jan. I'll update my tag and opam publish.

@drjdn drjdn force-pushed the opam-publish-p5scm.0.5.0 branch from 56cf4f0 to 83404e2 Compare October 15, 2025 21:21
@drjdn
Copy link
Contributor Author

drjdn commented Oct 15, 2025

The FreeBSD error messages are now different and seem to be camlp5 related. Not sure how p5scm failed previously without it building...

Copy link
Member

@jmid jmid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now down to just opam-2.0, FreeBSD, and Windows failures.

@mseri mseri merged commit 5bf5702 into ocaml:master Oct 16, 2025
1 of 4 checks passed
@mseri
Copy link
Member

mseri commented Oct 16, 2025

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants