Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_build in alt-ergo-lib-2.3.2 release #351

Closed
shakthimaan opened this issue Jul 31, 2020 · 8 comments
Closed

_build in alt-ergo-lib-2.3.2 release #351

shakthimaan opened this issue Jul 31, 2020 · 8 comments
Assignees

Comments

@shakthimaan
Copy link

I am trying to build alt-ergo-lib.2.3.2 with dune.2.6.0 and Multicore OCaml 4.10.0 as part of https://github.com/ocaml-bench/sandmark. We use bwrap sandboxing to build packages in a different directory, but, I see that the 2.3.2 release already has a _build/ directory in the release package. Hence, I get the following error when trying to compile alt-ergo-lib.2.3.2:

# [ERROR] ../sandmark/_opam exists, but does not appear to be a valid opam root. Please remove it and use `opam init', or specify a different `--root' argument
# Exception: End_of_file.

Is it possible to provide a tarball without the _build directory, or is there a way to clean the _build directory before running configure?

@ACoquereau
Copy link
Contributor

Hi,
I forgot to clean the _build directory in the release package, sorry for that.
Does the archive (https://github.com/OCamlPro/alt-ergo/archive/2.3.2.tar.gz) from the release package in github does the job ? It should not contain the _build directory

@shakthimaan
Copy link
Author

The https://github.com/OCamlPro/alt-ergo/archive/2.3.2.tar.gz has the configure and OPAM files in a sources/ directory, as compared to http://alt-ergo.ocamlpro.com/http/alt-ergo-2.3.2/alt-ergo-2.3.2.tar.gz where they are present in the top-level directory. Would it be possible to make a 2.3.3 minor release without the _build directory?

@ACoquereau
Copy link
Contributor

The release should be done with the PR 16943(ocaml/opam-repository#16943) in opam-repository
You can also find the corrected archive here : https://alt-ergo.ocamlpro.com/http/alt-ergo-2.3.3/alt-ergo-2.3.3.tar.gz
Hope this will resolve your issue.

@shakthimaan
Copy link
Author

shakthimaan commented Aug 1, 2020

In the configure script, ocaml unix.cma configure "$@" gets invoked, and I used the following to debug the error:

$ OPAMROOT=/local/sandmark/_opam /local/sandmark/_opam/opam-init/hooks/sandbox.sh build ./configure alt-ergo-lib

The following function in configure.ml is throwing the error for _opam exists, but does not appear to be a valid opam root..

(* Compute actual values for config options *)
let () =
  let prefix_set = !prefix ≠ "" in
  update "prefix" prefix (fun () -> opam_var "prefix");
  update "libdir" libdir (fun () ->
      if prefix_set
      then Filename.concat !prefix "lib"
      else opam_var "lib");
  update "sharedir" sharedir (fun () ->
      if prefix_set
      then Filename.concat !prefix "share"
      else opam_var "share");
  update "mandir" mandir (fun () ->
      if prefix_set
      then Filename.concat !prefix "man"
      else opam_var "man");
  update "pluginsdir" pluginsdir (fun () ->
      Filename.concat
        (Filename.concat !libdir "alt-ergo") "plugins"
    );
  update "preludesdir" preludesdir (fun () ->
      Filename.concat
        (Filename.concat !sharedir "alt-ergo") "preludes"
    );
  ()

The minimal example below suffices to throw the error:

(* Compute actual values for config options *)
let () =
  let prefix_set = !prefix ≠ "" in
  update "prefix" prefix (fun () -> opam_var "prefix");
  ()

What could be a possible fix?
Note: The version number in the *.opam files need to be bumped to use 2.3.3.

@ACoquereau
Copy link
Contributor

#353 will make the release 2.3.3. I'll let @Gbury handle the _opam issue. When this will be done we will make the 2.3.3 release in the opam repository

@Gbury
Copy link
Collaborator

Gbury commented Aug 4, 2020

Since a few versions, opam has a concept of local switches (as in, local to a directory). Such local switches are stored in a folder named _opam in the directory of the switch, and thus to determine the current switch, opam looks for a _opam file in the parents directory of the current directory. I think here what happens is that you may use _opam for something else than a local switch, and hence when the configure script calls opam for some config variables, and opam looks for the current switch, it finds a _opam that is not a local switch, and hence errors out.
There is not much that can be done from the alt-ergo side, but I see two solutions:

  • do not use the name _opam for something else than a local-switch (such folders are automatically created by opam, so just consider the name as reserved by opam, just as ~/.opam is)
  • call the configure script with explicit values for all configurable parameters (prefix, libdir, mandir), which should skip the opam invocation.

@ACoquereau
Copy link
Contributor

2.3.3 has been released, hope everything work for you @shakthimaan

@shakthimaan
Copy link
Author

Yes, specifying prefix, and libdir to configure script helped build alt-ergo in the sandbox environment. Thanks @OCamlPro-Coquera and @Gbury.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants