Open haxiomic opened 3 years ago
Hi, you're right that these packages are required to build the new release-stream (8.xx) of Camlp5. On most UNIX-derived distros, they seem to be available, but I don't know how to get them for MacOS. Sadly, that means that it's not possible to build the new Camlp5 on MacOS.
Since I don't have a Mac, I can't figure out how to fix this. If you wanted to collaborate on doing so, I'd be happy to try to work with you. Basically, we need to figure out how to install these two Perl modules. I'm a very, very proficient Perl programmer, and these are very standard Perl packages, so the problem is MacOS package-management. Do you know much about MacOS package-management?
Hi, still interested in trying to get this working on MacOS ?
After your message I had another shot at trying to install those modules but still no luck; for ShellQuote I tried
perl -MCPAN -e 'install -force MString::ShellQuote'
which did -something- (big newb I'm afriad) but then the opam install camlp5
failed with the same Can't locate String/ShellQuote.pm in @INC (you may need to install the String::ShellQuote module)
It looks like the two modules in question are only used for the testsuite - is it possible to separate the testsuite dependencies from the main code when running opam install camlp5
?
(I'm using the perl (v5.18) install included with macOS)
I started writing a long, long reply, but I think, at this point, it might be better to have a call ? B/c this is a complex issue: it touches on how OSX manages packages, and as it turns out there are at least two different ways: "brew" and "homebrew". I don't know which was used to install your perl distribution, and maybe it was neither of the above. In any case, since I don't have access to a Mac, I can't actually test anything.
This discussion thread is probably useful to read: https://discuss.ocaml.org/t/opam-depexts-on-macos-darwin-how-to-specify-perl-packages/6515/6
If you can have a con-call about this, maybe send me a direct message on the OCaml discussion forum? I'm "Chet_Murthy" (or maybe it's "Chet Murthy" without the underscore) over there.
I'm down for a call to work through things – I'll get in touch on discuss.ocaml.org. Does the end of next week work for you? (I'm on a project in crunch-mode this week)
I am 100% indifferent to when: please choose whatever works best for you. Truthfully, you are the gating resource here, b/c you actually have and use a Mac. So, y'know, whenever you want to work on this, is all good with me.
(I'm using the perl (v5.18) install included with macOS)
it is usually not a good idea to use any interpreter came with macOS because they're often outdated.
In your particular case, the perl
came with macOS needs sudo
to have rights to write into protected directories otherwise it won't actually install anything.
However it is still desirable (maybe "mandatory") to use brew
because that's how the depexts
thing supposed to work.
"brew" and "homebrew"
They refer to the same thing. Maybe you mean "macport", which is the other package manager supported by ocaml-depexts
? There are some other alternatives, but no one cares :P
End of any week works -- we're all in a Groundhog Day movie, right?
Seems like it! I wasn't able to find a DM feature over at discuss.ocaml.org but happy to continue on email, I'm haxiomic@gmail.com If Friday works, I'm on GMT and can do anytime from 2pm to 9pm this Friday, but can also do any other day
Howdy! I maintain ocaml for MacPorts. If a version of camlp5 that supports 4.12.0 comes out, I will try to update it to work on MacPorts. No promises though.
Perry, the problem seems to be not with ocaml -- it seems like once opam is installed, it's easy enough to get versions of ocaml built. The problem is with some perl modules that I use in the latest versions of camlp5 and some of the packages built on top of it.
Neither me nor haxiomc@ are sufficiently well-versed in Mac development [I'm a UNIX jock, but I don't have access to a Mac commandline environment where I can figure out what's going wrong] to be able to get these perl-dependent opam modules to work correctly.
Sure, but as it stands, there isn't a 4.12.0 version of camlp5 so I can't start the work, since MacPorts has 4.12.0 as its supported version. Once there's a version that supports 4.12.0, I'll try to figure out how to make it build.
BTW, just to be clear: 7.14 does support 4.12, but I had the impression 8.x does not. Am I correct on this?
As of version 8.00, camlp5 should support ocaml 4.12.0 syntax. The alpha versions did not (b/c 4.12's alpha wasn't out yet).
The 7.xx stream is maintained only for compatibility, since the 8.00 stream entails .... big, big changes to support new ocaml syntax completely. The .7.xx stream will (hopefully) always work work with new versions of ocaml, but it won't support new ocaml syntax at all -- which is basically what the 7.xx stream did for a long time, before I took over maintenance.
The 8.xx stream is where I'm adding full support for all ocaml syntax, including PPX, etc.
Is it backwards compatible? Should I attempt to upgrade MacPorts to 8.00?
If you are asking "does Camlp5 8.00 support previous versions of Ocaml", then the answer is "yes, any version >= 4.02.3". That is the point at which PPX was introduced, and supporting both PPX and not-PPX versions of the AST was .... well, I found it too onerous, esp. when that's already a pretty old version of ocaml. But everything new should work, and I test all such versions that are available in opam, before each release.
The test is simply to do a build of Campl5 (which is bootstrapped) so it's a little limited. For version >= 4.10.0, I also run the new testsuite, which is quite a bit more extensive and tests a lot of internal interfaces, testing both positive (accepting good input) and negative (rejecting bad input) behaviour.
My question was "does Camlp5 8.00 support software that used Camlp5 v7 and before", not "does it support earlier versions of OCaml."...
Aha. OK. So typically it does, and when it doesn't, I'm happy to work with the owner of the software to fix any bugs. It's not possible to be fully-backward-compatible, b/c of the introduction of all this new syntax: some of it required significant reorganization to the grammars, so if somebody had extended those grammars (a common way of using camlp5), then when the grammars got reorganized, their extensions might not work, or produce crazily paradoxical results.
Typically it's not hard to fix, which is why I always offer to fix whatever the discrepancy is. I've done this for a number of projects that use camlp5, and are also hosted on opam. Do you have any projects in mind that I should have a look at?
So I maintain OCaml for MacPorts; there are very few packages that currently depend on camlp5, but there are a couple. They're old and probably have no active maintainer. Perhaps the pragmatic solution is to stay on 7 for now; typically MacPorts is not for people developing code but only for people trying to use prepackaged software.
Can you tell me what those packages are, that depend on camlp5, in macports ?
On Sun, Mar 7, 2021 at 3:14 PM Perry E. Metzger notifications@github.com wrote:
So I maintain OCaml for MacPorts; there are very few packages that currently depend on camlp5, but there are a couple. They're old and probably have no active maintainer. Perhaps the pragmatic solution is to stay on 7 for now; typically MacPorts is not for people developing code but only for people trying to use prepackaged software.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/camlp5/camlp5/issues/78#issuecomment-792372118, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANMU66X6WEECJF5SOO27KTTCQCDZANCNFSM4W6Z2KZQ .
So far as I can tell, we're down to libCUDF
, geneweb
, and ledit
, none of which appear to be very actively developed.
So far as I can tell, we're down to
libCUDF
,geneweb
, andledit
, none of which appear to be very actively developed.
I just want to correct this : geneweb
is very actively developed https://github.com/geneweb/geneweb (I don;t know about MacPorts packages)
FTR I managed to get an OSX github action install camlp5 here https://github.com/LPCIC/elpi/pull/110
NB: This used to work on appveyor on appveyor as well, but it stopped working few days ago https://ci.appveyor.com/project/geneweb/geneweb/branch/master/job/bb43xv7vwmbcyaw6#L490
(appveyor file here: https://github.com/geneweb/geneweb/blob/master/appveyor.yml#L44)
@gares : OK, so you're a MacOS hacker! Excellent! [I'm not, and have not even remote access to MacOS, so to fix anything there involves ... well, typing random text into commits and rollin the dice of the opam-ci gods]
the place such a patch (to install relevant perl modules) would go, is in opam modules
conf-perl-ipc-system-simple and conf-perl-string-shellquote .
can you have a look at those? Once those have been updated to do the right thing, then camlp5 should install fluidly.
P.S. I'm not trying to put you off. I wrote those two opam packages (at the suggestion of the OPAM maintainers) to properly modularize the dependency on these Perl modules. I just don't know how to make them work on MacOS, is all.
I use linux, sorry. Google tells me that macports has packages for these perl modules, so maybe that is the way to go.
Oh, that's to bad. In any case, I went thru some of these combination with the OPAM maintainers, back when we created these two packages. And basically we couldn't figure out how to set things up for MacOS. So at this point, I think it really will require having somebody with live access to MacOS. Ah, well.
Are these perl modules really important for the build process? Do you really need them for a released version?
They allow to write a "launcher" script that can properly quote arguments. I use that in tests, and heavily in the follow-on modules built on camlp5: pa_ppx, pappx{hashcons,unique,migrate,q_ast,ag} . And besides, on MacOS the user can just install them: it's not very hard to do manually.
Eventually, some MacOS user will ask about this, and I can ask them to work out how to make these two conf-perl packages work.
In case you were going to ask: yes, I could rewrite in OCaml. But the point is that I'm using the right tool for the right task: Perl is the right tool when doing UNIX scripting and string manipulation. In OCaml the code would be much larger, and there might be errors.
I agree, I was just looking for a different solution to the problem.
After checking how the haxe team solves this it looks like this can be solved with the following; replacing the built-in perl install in macOS
brew install perl
brew install cpanminus
Restart shell
cpanm IPC::System::Simple
cpanm String::ShellQuote
Now this works for me :)
opam install camlp5
Testing on macOS 10.14
George, yes, this should work. If only someone could figure out how to make opam do these things in its idiomatic way, on MacOS.
How hard would it to port Camlp5 7.x to build on newer OCaml? I don't care for the new OCaml syntax, just for the things that work on older OCaml to keep working (I'm only upgrading OCaml because it builds a faster Coq).
I'm a Mac user, I have some clue on packaging and I'd be happy to help, especially if 1 fails, since I need this to use the latest OCaml compilers; but opam's sandbox on Mac essentially only lets you write to $OPAM_SWITCH_PREFIX
(see https://gist.github.com/Blaisorblade/1f564b2702ea586ffccf75d4ab078198). So I don't think anything Mac-specific is needed, only a way to install those packages inside the opam switch; you'd then need to use opam's setenv
(https://opam.ocaml.org/doc/Manual.html#opamfield-setenv) to extend Perl's library search path.
In https://github.com/camlp5/camlp5/issues/78#issuecomment-912911467 you wrote:
In any case, I went thru some of these combination with the OPAM maintainers, back when we created these two packages. And basically we couldn't figure out how to set things up for MacOS. So at this point, I think it really will require having somebody with live access to MacOS.
Got a link on that discussion and what was the problem? In the logs I found https://github.com/ocaml/opam-repository/pull/17886, https://github.com/ocaml/opam-repository/pull/17987 and https://github.com/camlp5/camlp5/issues/66, but I don't see anywhere anything close to "I wrote the perl -M CPAN
line in the conf package, but it fails because of X".
@gares wrote:
Google tells me that macports has packages for these perl modules, so maybe that is the way to go.
Not quite. Opam considers homebrew and macports as distinct distributions, which is a very good way to think about it. For Homebrew users, supporting Macs via Macports is as good as supporting Fedora via Ubuntu packages. But it's true the fix is a one-liner for Macports.
For instance, conf-adwaita-icon-theme
has the following lines,
depexts: [
["adwaita-icon-theme"] {os-family = "debian"}
...
["adwaita-icon-theme"] {os-family = "homebrew"}
["adwaita-icon-theme"] {os-family = "macports"}
["x11-themes/adwaita-icon-theme"] {os-family = "gentoo"}
["adwaita-icon-theme"] {os = "freebsd"}
["x11/gnome/adwaita-icon-theme"] {os = "openbsd"}
["graphics/adwaita-icon-theme"] {os = "netbsd"}
]
However, homebrew does not seem to package cpan modules, so I don't think we'll get to upstream homebrew packages to the main upstream repos. They ship bioperl
, but they seem to only use cpanm --self-contained
. BTW, does that install those deps "privately", and would that be an option here?
we'll get to upstream homebrew packages to the main upstream repos.
We can submit whatever we want to external homebrew formula repos ("Homebrew taps"), but we'd have to convince the opam-repository
people to allow depending on such a tap.
Two questions:
I'm asking because, yes, it is straightforward to upgrade the 7.xx stream to more-modern OCaml. But if that's merely for the purpose of keeping backlevel versions of other software upgraded to more-modern OCaml, I don't quite see the point. If there are actual users of these backlevel versions, then that's a different situation.
- As I understand it, Coq no longer depends on Camlp5 (they forked the essential libraries and took them into their corpus). So this is about maintaining backlevel versions of Coq, right? Are there actually users who are using these backlevel versions of Coq, who cannot use the modern version ? I'm asking because, yes, it is straightforward to upgrade the 7.xx stream to more-modern OCaml. But if that's merely for the purpose of keeping backlevel versions of other software upgraded to more-modern OCaml, I don't quite see the point. If there are actual users of these backlevel versions, then that's a different situation.
Coq migrated as you say, but I want to use coq-elpi
, a Coq library which didn't (it uses Camlp5 for its own purposes). There's a patch migrating coq-elpi to Camlp5 8, but as @gares said it's stuck on this problem.
- As I understand from your last comments, macports has these packages ? Can you make the conf-perl-XXX packages work under macports? Then that would seem to solve the problem, no?
This would not solve the whole problem. I use Homebrew, and Homebrew and MacPorts are incompatible, so you have two disjoint issues: support homebrew, and support macports. So this wouldn't help homebrew users, but it'd help for the macports one.
Re macports I've seen your question in https://github.com/camlp5/camlp5/issues/66#issuecomment-699510282. I don't use macports, but it seems (from https://ports.macports.org/port/p5.34-ipc-system-simple/details/ and https://ports.macports.org/port/p5.34-string-shellquote/details/) a macports fix could be the following depexts lines:
for conf-perl-ipc-system-simple
["p5.34-ipc-system-simple"] {os-family = "macports"}
for conf-perl-string-shellquote
["p5.34-string-shellquote"] {os-family = "macports"}
But it seems macports lets you install multiple perl versions in parallel and has separate packages for each, so you'd probably need to use /usr/bin/env perl5.34
in your scripts on this platform? I don't see a way to depend on "whichever perl version is the default"...
==
Could you just "vendor" these dependencies (= include a copy with your perl code), at least on mac? While ugly, it seems better than leaving this issue open for an year...
Can you clone camlp5, and apply this patch ? If it works, I can release a new version. I'm reluctant to do this, b/c to my mind, a platform that doesn't have proper support for Perl5 isn't a developer's platform, but hey, I guess I'm swimmin' against the tide.
git diff diff --git a/opam b/opam index 6aba450a..e13ceee3 100644 --- a/opam +++ b/opam @@ -29,8 +29,8 @@ bug-reports: "https://github.com/camlp5/camlp5/issues" depends: [ "ocaml" {>= "4.02" & < "4.14.0"} "conf-perl"
two further comments:
Since you use homebrew, can I suggest that you might request the maintainers to add these two Perl modules to their main repo? They're very, very standard, and are available in many, many distros. That would solve the problem, too.
If you find that that works, I'll conditionalize on "with-test and not macos" for those packages.
We can submit whatever we want to external homebrew formula repos ("Homebrew taps"), but we'd have to convince the
opam-repository
people to allow depending on such a tap.
This may be the only reasonable path forward at this point if the libraries cannot be vendored for testing. As @Blaisorblade suspects, homebrew explicitly does not package perl/python/ruby/etc. libraries.
The installation issue is fixed but https://github.com/camlp5/camlp5/pull/88#issuecomment-1017035603 mentions that:
I still need to find a way to make these perl packages available on homebrew, b/c the pa_ppx packages need them to build. As do other packages that use the "mkcamlp5" scripts. But for now, this is ..... acceptable.
Let me paste Homebrew's advice, and also remind you it won't work as-is inside opam's sandbox:
==> Caveats
By default non-brewed cpan modules are installed to the Cellar. If you wish
for your modules to persist across updates we recommend using `local::lib`.
You can set that up like this:
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"' >> ~/.profile
IIUC (also from https://metacpan.org/pod/local::lib), local::lib
is a way to install extra modules in non-default location; conf-perl
packages could install the perl modules inside the switch folder (that's allowed by the opam sandbox) and use setenv
to extend the environment of each switch appropriately...
Today trying
opam install camlp5
on macOS 10.14.6 with a fresh ocaml install I get the followingWhereas
opam install "camlp5=7.14"
works fineI'm too much of an ocaml and perl newb to delve deeper. I had an attempt at installing those perl modules manually without success
Was tests on fresh install: