Re: Installing lablgtk failed; cannot find camlp4orf.

"Hendrik Boom [email protected] [ocaml_beginners]" <[email protected]> Sat, 12 Dec 2015 12:35:27 -0500
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
On Sat, Dec 12, 2015 at 05:49:11PM +0100, Gabriel Scherer [email protected] [ocaml_beginners] wrote:
> There is some (probably too short for its own good) documentation of the
> "switch" command at
>   https://opam.ocaml.org/doc/Usage.html#opamswitch
> 
> It would help if you could collect the questions you have about this
> mechanism, so that we can then update the documentation to be more helpful.

Let me continue to do that here.  Questions get answers, and answers 
generate new questions.

> 
> I should apologize for recommending a stateful command (that changes your
> environment) without giving a way out. You can easily go back to your
> previous switch by doing "opam switch system". You can remove the newly
> installed switch with "opam switch remove 4.02.3".
> 
> The switch state is global to your opam root (~/.opam in your case). The
> change in PATH is performed in .opam/opam-init/variables.sh, itself called
> from .opam/opam-init/init.sh, which is probably sourced by one of your
> profile files (~./profile, ~/.bash_profile, ~/.bashrc) -- you either set
> this up yourself or let "opam init" do it automatically.

This was the information I needed.  The documentation should say this, 
and also its (now obvious) consequence, namely:

  The new switch state takes effect 
upon login, or login shell start, or anytime one of these startup 
profils scripts is started.  The reason for doing 
  eval `opam config env`  
is merely to accomplish the same in the current shell, so that you don't 
have to shut it down and start a new one.

Is there an version of the   eval `opam config env` command that gives 
you a different switch for the current shell without affecting other 
shells or the current normal switch?  Say, if I want to check that my 
code works with old versions of the compiler or libraries but not 
affecting other current development?

Presumably there is some analogous advice for nonUnix environments, but 
not being familiar with them, I can't advise.

And, I gather, the only thing the switch state affects is which version 
of the compiler you use, together, of course, with the correspunding 
version of all the compiled code.

It's not clear to me what I'd have to do if I were to want a different 
version of just some packages or libraries (perhaps I've modified them 
to try and fix bugs) while keeping the same compiler.  The switch 
choices seem all to be compiler versions -- or is that an 
oversimplification already? 

-- hendrik

> 
> In any case, the experience shows that there is a bad interaction between
> the "system switch" (which is a bit special compared to other switches, as
> the OCaml compiler was installed by the system distribution and thus OPAM
> has little control over it) and camlp4 under some OCaml versions. This is a
> known problem with no really good solution, see
>   https://github.com/ocaml/opam/issues/2151
> the recommend solution is to
> - either use your system-packaged camlp4 ("apt-get install camlp4" or
> something)
> - or use another switch than the system switch

The problem is that the system switch is used for bootstrapping the 
ocaml and opam environment.  Try this:

Admit that it is just a bootstrap tool and explain how to use opam to 
compile a complete new system in the user's directory, so that it no 
longer needs the system version.  Subsequently one could 
delete the system version to save space.

Of course this wouldn't save space if here is more then one OCaml user.
In that case, find a way to use opam to update the system version, 
making it available to all users.  This will require root access and may 
sorely perplex operating system package managers.  One could perhaps do 
the new installation under /opt or /usr/local, and subsequently 
uninstall the system version.

The newly compiled version would of course be set up to look for its 
files within the newly compiled system instead of the original one.  
And, of course in the user .opam places -- users may stll need to have 
their own switch choice.

> 
> On Sat, Dec 12, 2015 at 4:16 PM, Hendrik Boom [email protected]
> [ocaml_beginners] <[email protected]> wrote:
> 
> > On Thu, Dec 10, 2015 at 09:47:02PM +0100, Gabriel Scherer
> > [email protected] [ocaml_beginners] wrote:
> > > This seems to be an OPAM packaging bug that should be reported at
> > >   https://github.com/ocaml/opam-repository/issues
> > >
> > > Could you tell which version of OCaml you have and which switch you
> > > are using? From the log it looks like this is 4.01 using the system
> > > switch (presumably you installed OCaml from your system distribution,
> > > and the packaged version is 4.01), but that might also be a bug. Have
> > > you tried using a more recent version (opam switch install 4.02.3)?
> >
> > Did  that.  Then did
> >
> > opam install lablgtk
> >
> > and this time it worked.
> >
> > I'm not really sure what the commend 'opam switch install 4.02.3' does.
> > Evidently it installs a new version of ocaml to my local environment.
> > ut what's the scope of this switch?  Does it replace the system's
> > version of ocaml entirely?  When I start a new shell and echo $PATH it's
> > clear that the PATH now starts with
> >
> > /home/hendrik/.opam/4.02.3/bin:/home/hendrik/bin:/usr/local/bin:
> >
> > etc etc.
> >
> > So how global is this?
> >
> > -- hendrik
> >
> > >
> > > On Thu, Dec 10, 2015 at 6:12 PM, Hendrik Boom [email protected]
> > > [ocaml_beginners] <[email protected]> wrote:
> > > > Installing lablgtk failed.
> > > > It appears to be unable to find camlp4orf.
> > > > Any ideas?
> > > >
> > > > -- hendrik
> > > >
> > > >
> > > > hendrik@notlookedfor:~/dv/ocaml/learngtk$ opam install lablgtk
> > > > The following actions will be performed:
> > > >  - install   camlp4.4.01+system                    [required by
> > lablgtk]
> > > >  - install   lablgtk.2.18.3
> > > > === 2 to install ===
> > > > Do you want to continue ? [Y/n] y
> > > >
> > > > =-=- Synchronizing package archives
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> > > >
> > > > =-=- Installing packages
> > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> > > > Copying
> > ~/.opam/repo/default/packages/camlp4/camlp4.4.01+system/files/install to
> > ~/.opam/system/build/camlp4.4.01+system/
> > > > Copying
> > ~/.opam/repo/default/packages/camlp4/camlp4.4.01+system/files/check-camlp4.sh
> > to ~/.opam/system/build/camlp4.4.01+system/
> > > > Building camlp4.4.01+system:
> > > >   sh ./check-camlp4.sh
> > > > [ERROR] The compilation of camlp4.4.01+system failed.
> > > > Removing camlp4.4.01+system.
> > > >   Nothing to do.
> > > > [WARNING] Directory /home/hendrik/.opam/system/lib/camlp4 is not
> > empty, not removing
> > > >
> > > >
> > > > #=== ERROR while installing camlp4.4.01+system
> > ================================#
> > > > # opam-version 1.2.0
> > > > # os           linux
> > > > # command      sh ./check-camlp4.sh
> > > > # path         /home/hendrik/.opam/system/build/camlp4.4.01+system
> > > > # compiler     system (4.01.0)
> > > > # exit-code    1
> > > > # env-file
> >  /home/hendrik/.opam/system/build/camlp4.4.01+system/camlp4-8311-c61e7b.env
> > > > # stdout-file
> > /home/hendrik/.opam/system/build/camlp4.4.01+system/camlp4-8311-c61e7b.out
> > > > # stderr-file
> > /home/hendrik/.opam/system/build/camlp4.4.01+system/camlp4-8311-c61e7b.err
> > > > ### stdout ###
> > > > # ...[truncated]
> > > > # `opam switch`.
> > > > #
> > > > # Here are some installation instructions for camlp4 if you obtained
> > OCaml
> > > > # via the OPAM binary packages:
> > > > #
> > > > #
> > http://software.opensuse.org/download.html?project=home%3Aocaml&package=ocaml
> > > > #
> > > > # * Debian/Ubuntu: sudo apt-get install camlp4-extra
> > > > # * RHEL/CentOS/Fedora: sudo yum install ocaml-camlp4
> > > > #
> > > > ### stderr ###
> > > > # ./check-camlp4.sh: 3: ./check-camlp4.sh: camlp4orf: not found
> > > >
> > > >
> > > > =-=- Error report
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> > > > The following failed
> > > >  - install   camlp4.4.01+system
> > > > Due to the errors, the following have been cancelled
> > > >  - install   lablgtk.2.18.3
> > > > hendrik@notlookedfor:~/dv/ocaml/learngtk$
> > > >
> > > >
> > > >
> > > > ------------------------------------
> > > > Posted by: Hendrik Boom <[email protected]>
> > > > ------------------------------------
> > > >
> > > > Archives up to December 31, 2011 are also downloadable at
> > http://www.connettivo.net/cntprojects/ocaml_beginners
> > > > The archives of the very official ocaml list (the seniors' one) can be
> > found at http://caml.inria.fr
> > > > Attachments are banned and you're asked to be polite, avoid flames etc.
> > > > ------------------------------------
> > > >
> > > > Yahoo Groups Links
> > > >
> > > >
> > > >
> > >
> > >
> > > ------------------------------------
> > > Posted by: Gabriel Scherer <[email protected]>
> > > ------------------------------------
> > >
> > > Archives up to December 31, 2011 are also downloadable at
> > http://www.connettivo.net/cntprojects/ocaml_beginners
> > > The archives of the very official ocaml list (the seniors' one) can be
> > found at http://caml.inria.fr
> > > Attachments are banned and you're asked to be polite, avoid flames etc.
> > > ------------------------------------
> > >
> > > Yahoo Groups Links
> > >
> > >
> > >
> >
> >
> > ------------------------------------
> > Posted by: Hendrik Boom <[email protected]>
> > ------------------------------------
> >
> > Archives up to December 31, 2011 are also downloadable at
> > http://www.connettivo.net/cntprojects/ocaml_beginners
> > The archives of the very official ocaml list (the seniors' one) can be
> > found at http://caml.inria.fr
> > Attachments are banned and you're asked to be polite, avoid flames etc.
> > ------------------------------------
> >
> > Yahoo Groups Links
> >
> >
> >
> >