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

Error Adding Package to spin. #73

Closed
idkjs opened this issue Apr 18, 2020 · 10 comments
Closed

Error Adding Package to spin. #73

idkjs opened this issue Apr 18, 2020 · 10 comments
Labels
question Further information is requested

Comments

@idkjs
Copy link

idkjs commented Apr 18, 2020

I am trying to add aantron/luv to a project and I am getting the error below.

~/Github/luv-cli adding-luv* ⇡ 16s
❯ esy start Luvers                                                          
# Unformatted Error Output:
# File "lib/demo.re", line 8, characters 28-41:
# Error: Unbound value Result.get_ok


 ERROR  lib/demo.re:8 28-41 

 5 ┆ ~service="80",
 6  (),
 7 ┆ (result) => {
 8 ┆   let address = List.hd(Result.get_ok(result)).addr;
 9 ┆   let socket = Luv.TCP.init() |> Result.get_ok;
10 ┆   Luv.TCP.connect(
11 ┆     socket,

The value named Result.get_ok can't be found. Could it be a typo?
error: command failed: 'refmterr' 'dune' 'build' '--root' '.' '--only-package' 'luv-cli' (exited with 1)
esy-build-package: exiting with errors above...
error: build failed with exit code: 1
  
esy: exiting due to errors above

Here is the working project before you add luv. https://github.com/idkjs/luv-cli

As soon as you add luv, the build breaks with the above error. luv requires ocaml 4.08+.* or higher. spin bootstrapped with 4.09.0 so I dont know if that should be an issue. I though maybe add @opam/result to fix but you still get the error.

I added luv and result to lib/dune also:

(library
 (name Luv_cli)
 (public_name luv-cli.lib)
 (modules (:standard))
(libraries base console.lib pastel.lib cmdliner luv result)
 (flags -open Base))

(include_subdirs unqualified)

I though maybe add result and luv to dune_project because they were not added after running esy install and esy build, same error.

Any guidance would be greatly appreciated. Thank you.

I was able to add it to a pesy generated project without issue as seen idkjs/luv-with-pesy
Here is the full error output:

esy               
info esy 0.6.2 (using esy.json)
info checking https://github.com/ocaml/opam-repository for updates...
info checking https://github.com/esy-ocaml/esy-opam-override for updates...
info resolving esy packages: done                         
info solving esy constraints: done         
info resolving npm packages: done
info fetching: done                                                                                    
info installing: done                                                                                             
Error: exception Sys_error("luv-cli.opam: Operation not permitted")
Raised by primitive operation at file "stdlib.ml", line 324, characters 29-55
Called from file "src/stdune/io.ml", line 173, characters 8-126
Re-raised at file "src/stdune/io.ml", line 178, characters 8-23
Called from file "src/dune/artifact_substitution.ml", line 383, characters
  15-48
Called from file "src/fiber/fiber.ml", line 229, characters 16-19
Called from file "src/dune/build_system.ml", line 1588, characters 8-1023
Called from file "src/fiber/fiber.ml", line 114, characters 10-15
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17

I must not crash.  Uncertainty is the mind-killer. Exceptions are the
little-death that brings total obliteration.  I will fully express my cases. 
Execution will pass over me and through me.  And when it has gone past, I
will unwind the stack along its path.  Where the cases are handled there will
be nothing.  Only I will remain.
# Unformatted Error Output:
# File "lib/demo.re", line 8, characters 28-41:
# Error: Unbound value Result.get_ok


 ERROR  lib/demo.re:8 28-41 

 5 ┆ ~service="80",
 6 ┆ (),
 7 ┆ (result) => {
 8 ┆   let address = List.hd(Result.get_ok(result)).addr;
 9 ┆   let socket = Luv.TCP.init() |> Result.get_ok;
10 ┆   Luv.TCP.connect(
11 ┆     socket,

The value named Result.get_ok can't be found. Could it be a typo?


error: command failed: 'refmterr' 'dune' 'build' '--root' '.' '--only-package' 'luv-cli' (exited with 1)
esy-build-package: exiting with errors above...
error: build failed with exit code: 1
  
esy: exiting due to errors above
@tmattio
Copy link
Owner

tmattio commented Apr 19, 2020

Hi @idkjs, thanks for the issue.

I believe the issue is that Result.get_ok comes from the standard library, but Spin-generated projects use Base. We took the decision to use the standard library instead of Base recently (see tmattio/spin-templates#10), but I didn't release a version with this change yet.

For now, you can either remove Base (by removing it from dune-project and every dune file), or you can use the equivalent of Result.get_ok in Base, which should be Result.return.

@tmattio tmattio added the question Further information is requested label Apr 19, 2020
@idkjs
Copy link
Author

idkjs commented Apr 20, 2020

Result.return is apparently not a drop in replacement for Result.get_ok.

For now, you can either remove Base (by removing it from dune-project and every dune file)

If I remove base every where, including in the project.opam, delete _esy, node_modules and esy.lock dirs. There is no base left in the project except in .git.hooks?:

❯ grep -R 'base' .
./README.md:`(libraries base)`
./README.md:`(libraries base console.lib pastel.lib)`
./README.md:(libraries base console.lib pastel.lib cmdliner)
./README.md:(libraries base console.lib pastel.lib cmdliner luv)
./README.md:5 | (libraries base console.lib pastel.lib cmdliner luv)
./.git/hooks/pre-rebase.sample:# The "pre-rebase" hook is run just before "git rebase" starts doing
./.git/hooks/pre-rebase.sample:# $2 -- the branch being rebased (or empty when rebasing the current branch).
./.git/hooks/pre-rebase.sample:# merged to 'next' branch from getting rebased, because allowing it
./.git/hooks/pre-rebase.sample:basebranch="$1"
./.git/hooks/pre-rebase.sample:# Now we are dealing with a topic branch being rebased
./.git/hooks/pre-rebase.sample:# on top of master.  Is it OK to rebase it?
./.git/hooks/pre-rebase.sample:    merged into other branches can be easily rebased without
./.git/hooks/pre-rebase.sample:We would want to allow C to be rebased, refuse A, and encourage
Binary file ./.git/index matches

Then run esy to reinstall:

Error: exception Sys_error("luv-cli.opam: Operation not permitted")
Raised by primitive operation at file "stdlib.ml", line 324, characters 29-55
Called from file "src/stdune/io.ml", line 173, characters 8-126
Re-raised at file "src/stdune/io.ml", line 178, characters 8-23
Called from file "src/dune/artifact_substitution.ml", line 407, characters
  15-48
Called from file "src/fiber/fiber.ml", line 229, characters 16-19
Called from file "src/dune/build_system.ml", line 1588, characters 8-1023
Called from file "src/fiber/fiber.ml", line 114, characters 10-15
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17

I must not crash.  Uncertainty is the mind-killer. Exceptions are the
little-death that brings total obliteration.  I will fully express my cases. 
Execution will pass over me and through me.  And when it has gone past, I
will unwind the stack along its path.  Where the cases are handled there will
be nothing.  Only I will remain.
error: command failed: 'refmterr' 'dune' 'build' '--root' '.' '--only-package' 'luv-cli' (exited with 1)
esy-build-package: exiting with errors above...
error: build failed with exit code: 1
  
esy: exiting due to errors above

Then grep -R 'base' . again and base is everywhere:

❯ grep -R --exclude-dir=_esy 'base' .
./test/.merlin:B /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__seq-opam__c__base-5760452b/lib/seq
./test/.merlin:S /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__seq-opam__c__base-5760452b/lib/seq
./bin/.merlin:B /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__base-opam__c__v0.13.1-fdb7b8b8/lib/base
./bin/.merlin:B /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__base-opam__c__v0.13.1-fdb7b8b8/lib/base/base_internalhash_types
./bin/.merlin:B /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__base-opam__c__v0.13.1-fdb7b8b8/lib/base/caml
./bin/.merlin:B /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__base-opam__c__v0.13.1-fdb7b8b8/lib/base/shadow_stdlib
./bin/.merlin:B /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__seq-opam__c__base-5760452b/lib/seq
./bin/.merlin:S /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__base-opam__c__v0.13.1-fdb7b8b8/lib/base
./bin/.merlin:S /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__base-opam__c__v0.13.1-fdb7b8b8/lib/base/base_internalhash_types
./bin/.merlin:S /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__base-opam__c__v0.13.1-fdb7b8b8/lib/base/caml
./bin/.merlin:S /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__base-opam__c__v0.13.1-fdb7b8b8/lib/base/shadow_stdlib
./bin/.merlin:S /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__seq-opam__c__base-5760452b/lib/seq
./esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch:       try Array.iter (fun x -> if x = basename then raise Exit) a; false
./esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch:--- ./src/findlib/fl_package_base.ml
./esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch:+++ ./src/findlib/fl_package_base.ml
./esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch:                 ~base ~explicit:true
./esy.lock/opam/dune.2.5.1/opam:  "base-unix"
./esy.lock/opam/dune.2.5.1/opam:  "base-threads"
./esy.lock/opam/ocplib-endian.1.1/opam:  "base-bytes"
./esy.lock/opam/astring.0.8.3/opam:  "base-bytes"
./esy.lock/opam/cmdliner.1.0.4/opam:[1]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html
./esy.lock/opam/base.v0.13.1/opam:homepage: "https://github.com/janestreet/base"
./esy.lock/opam/base.v0.13.1/opam:bug-reports: "https://github.com/janestreet/base/issues"
./esy.lock/opam/base.v0.13.1/opam:dev-repo: "git+https://github.com/janestreet/base.git"
./esy.lock/opam/base.v0.13.1/opam:doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/base/index.html"
./esy.lock/opam/base.v0.13.1/opam:  src: "https://github.com/janestreet/base/archive/v0.13.1.tar.gz"
./esy.lock/opam/bos.0.2.0/opam:  "base-unix"
./esy.lock/opam/cppo.1.6.6/opam:  "base-unix"
./esy.lock/opam/lwt.5.2.0/opam:  "base-threads"
./esy.lock/opam/lwt.5.2.0/opam:  "base-unix"
./esy.lock/opam/ctypes.0.17.1/opam:  [make "XEN=%{mirage-xen:enable}%" "ctypes-base" "ctypes-stubs"]
./esy.lock/opam/zed.2.0.7/opam:  "base-bytes"
./esy.lock/opam/ocamlbuild.0.14.0/opam:  "base-ocamlbuild"
./esy.lock/opam/opam-core.2.0.6/opam:  "base-unix"
./esy.lock/opam/opam-core.2.0.6/opam:  "base-bigarray"
./esy.lock/opam/fmt.0.8.8/opam:depopts: [ "base-unix" "cmdliner" ]
./esy.lock/opam/fmt.0.8.8/opam:          "--with-base-unix" "%{base-unix:installed}%"
./esy.lock/opam/luv.0.5.1/opam:  "base-unix" {build}
./esy.lock/opam/luv.0.5.1/opam:  "base-unix" {with-test}
./esy.lock/opam/logs.0.7.0/opam:  "base-threads"
./esy.lock/opam/logs.0.7.0/opam:          "--with-base-threads" "%{base-threads:installed}%"
./esy.lock/opam/logs.0.7.0/opam:A few optional log reporters are distributed with the base library and
./esy.lock/opam/sexplib0.v0.13.0/opam:synopsis: "Library containing the definition of S-expressions and some base converters"
./esy.lock/opam/stdio.v0.13.0/opam:  "base"  {>= "v0.13" & < "v0.14"}
./esy.lock/opam/utop.2.4.3/opam:  "base-unix"
./esy.lock/opam/utop.2.4.3/opam:  "base-threads"
./esy.lock/index.json:        "@opam/base-bytes@opam:base@19d0c2ff",
./esy.lock/index.json:        "@opam/base-bytes@opam:base@19d0c2ff"
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-threads@opam:base@36803084",
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-threads@opam:base@36803084"
./esy.lock/index.json:        "@opam/seq@opam:base@d8d7de1d", "@opam/re@opam:1.9.0@d4d5e13d",
./esy.lock/index.json:        "@opam/seq@opam:base@d8d7de1d", "@opam/re@opam:1.9.0@d4d5e13d",
./esy.lock/index.json:        "@opam/base@opam:v0.13.1@7d937ed0",
./esy.lock/index.json:        "@opam/base@opam:v0.13.1@7d937ed0"
./esy.lock/index.json:    "@opam/seq@opam:base@d8d7de1d": {
./esy.lock/index.json:      "id": "@opam/seq@opam:base@d8d7de1d",
./esy.lock/index.json:      "version": "opam:base",
./esy.lock/index.json:          "version": "base",
./esy.lock/index.json:          "path": "esy.lock/opam/seq.base"
./esy.lock/index.json:        "ocaml@4.9.0@d41d8cd9", "@opam/seq@opam:base@d8d7de1d",
./esy.lock/index.json:        "ocaml@4.9.0@d41d8cd9", "@opam/seq@opam:base@d8d7de1d",
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-bigarray@opam:base@b03491b0",
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-bigarray@opam:base@b03491b0"
./esy.lock/index.json:        "@opam/base-bytes@opam:base@19d0c2ff",
./esy.lock/index.json:        "@opam/base-bytes@opam:base@19d0c2ff"
./esy.lock/index.json:        "ocaml@4.9.0@d41d8cd9", "@opam/seq@opam:base@d8d7de1d",
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-threads@opam:base@36803084",
./esy.lock/index.json:        "ocaml@4.9.0@d41d8cd9", "@opam/seq@opam:base@d8d7de1d",
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb"
./esy.lock/index.json:        "@opam/base-threads@opam:base@36803084",
./esy.lock/index.json:        "@opam/seq@opam:base@d8d7de1d",
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/seq@opam:base@d8d7de1d"
./esy.lock/index.json:        "ocaml@4.9.0@d41d8cd9", "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-threads@opam:base@36803084",
./esy.lock/index.json:        "ocaml@4.9.0@d41d8cd9", "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-threads@opam:base@36803084"
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb"
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:        "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:    "@opam/base-unix@opam:base@87d0b2eb": {
./esy.lock/index.json:      "id": "@opam/base-unix@opam:base@87d0b2eb",
./esy.lock/index.json:      "name": "@opam/base-unix",
./esy.lock/index.json:      "version": "opam:base",
./esy.lock/index.json:          "name": "base-unix",
./esy.lock/index.json:          "version": "base",
./esy.lock/index.json:          "path": "esy.lock/opam/base-unix.base"
./esy.lock/index.json:    "@opam/base-threads@opam:base@36803084": {
./esy.lock/index.json:      "id": "@opam/base-threads@opam:base@36803084",
./esy.lock/index.json:      "name": "@opam/base-threads",
./esy.lock/index.json:      "version": "opam:base",
./esy.lock/index.json:          "name": "base-threads",
./esy.lock/index.json:          "version": "base",
./esy.lock/index.json:          "path": "esy.lock/opam/base-threads.base"
./esy.lock/index.json:    "@opam/base-bytes@opam:base@19d0c2ff": {
./esy.lock/index.json:      "id": "@opam/base-bytes@opam:base@19d0c2ff",
./esy.lock/index.json:      "name": "@opam/base-bytes",
./esy.lock/index.json:      "version": "opam:base",
./esy.lock/index.json:          "name": "base-bytes",
./esy.lock/index.json:          "version": "base",
./esy.lock/index.json:          "path": "esy.lock/opam/base-bytes.base"
./esy.lock/index.json:    "@opam/base-bigarray@opam:base@b03491b0": {
./esy.lock/index.json:      "id": "@opam/base-bigarray@opam:base@b03491b0",
./esy.lock/index.json:      "name": "@opam/base-bigarray",
./esy.lock/index.json:      "version": "opam:base",
./esy.lock/index.json:          "name": "base-bigarray",
./esy.lock/index.json:          "version": "base",
./esy.lock/index.json:          "path": "esy.lock/opam/base-bigarray.base"
./esy.lock/index.json:    "@opam/base@opam:v0.13.1@7d937ed0": {
./esy.lock/index.json:      "id": "@opam/base@opam:v0.13.1@7d937ed0",
./esy.lock/index.json:      "name": "@opam/base",
./esy.lock/index.json:          "archive:https://github.com/janestreet/base/archive/v0.13.1.tar.gz#md5:296457416f9a8b75e6edfc3b1140e384"
./esy.lock/index.json:          "name": "base",
./esy.lock/index.json:          "path": "esy.lock/opam/base.v0.13.1"
./esy.lock/index.json:        "@opam/base-bytes@opam:base@19d0c2ff",
./esy.lock/index.json:        "ocaml@4.9.0@d41d8cd9", "@opam/base-bytes@opam:base@19d0c2ff"
./README.md:`(libraries base)`
./README.md:`(libraries base console.lib pastel.lib)`
./README.md:(libraries base console.lib pastel.lib cmdliner)
./README.md:(libraries base console.lib pastel.lib cmdliner luv)
./README.md:5 | (libraries base console.lib pastel.lib cmdliner luv)
./lib/.merlin:B /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__seq-opam__c__base-5760452b/lib/seq
./lib/.merlin:S /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__seq-opam__c__base-5760452b/lib/seq
./.git/hooks/pre-rebase.sample:# The "pre-rebase" hook is run just before "git rebase" starts doing
./.git/hooks/pre-rebase.sample:# $2 -- the branch being rebased (or empty when rebasing the current branch).
./.git/hooks/pre-rebase.sample:# merged to 'next' branch from getting rebased, because allowing it
./.git/hooks/pre-rebase.sample:basebranch="$1"
./.git/hooks/pre-rebase.sample:# Now we are dealing with a topic branch being rebased
./.git/hooks/pre-rebase.sample:# on top of master.  Is it OK to rebase it?
./.git/hooks/pre-rebase.sample:    merged into other branches can be easily rebased without
./.git/hooks/pre-rebase.sample:We would want to allow C to be rebased, refuse A, and encourage
Binary file ./.git/index matches

I read the tmattio/spin-templates#10 and the related issues so I see you are concerned about friction so this is my contribution.

I don't need this to work right now. Im coding in the open on dev.to so i'd like to be able to explain to myself and other how to resolve this. I would think just removing the library would do it. Maybe I am rebuilding incorrectly. The answer might simply be to wait for pull/10 to land. Ideas?

As a side note, reinstalling does not update the project.opam file. For example, removing base from esy.json then running esy will leave you with the generated .opam file with base included.

I hope this information is useful to you and thanks for sharing your work.

@tmattio
Copy link
Owner

tmattio commented Apr 21, 2020

Having Base present in the lock file is to be expected since a lot of libraries depend on it.

I read the blog post and it pains me to see that you're having more trouble with Spin than with other tools when the exact goal of Spin is to make it straight forward to start new projects. So let's get to the bottom of it 🙂

I've read the doc more carefully and I think there is no alternative to Result.get_ok with Base, so you can either change the code (use Result.ok and propagate the option, or even propagate the result, which IMHO is a better pattern) or replace Result.get_ok with Caml.Result.get_ok.

If that doesn't work, would you mind creating a repo that reproduces the error so that I can try and investigate the problem with the code?

Thanks again for taking the time to report the issue and to bear with Spin even with the friction points. Hopefully, we'll manage to remove them 😄

@idkjs
Copy link
Author

idkjs commented Apr 21, 2020

My brother! Reproduction is here: https://github.com/idkjs/luv-cli. master work before adding luv.

Blows up on add-luv branch.

Thanks in advance. There must be a simple way to say, hey, lets not use this and change out the deps.

I feel your pain. But this is the work we go through to get to where you want to get. I hope my ignorance serves you well.

@tmattio
Copy link
Owner

tmattio commented Apr 21, 2020

I've tried the branch and it works fine!

I see that there were two issues in your comment:

  • Being unable to run Luv's code example, which you've successfully solved by removing base from your project
  • Esy throws a permission error when trying to generate the opam file (Error: exception Sys_error("luv-cli.opam: Operation not permitted")). You can work around this by running esy dune build, which strangely enough does not cause the permission issue. After the opam file has been re-generated, and unless you change your dependencies again, you'll be able to continue using esy build to re-build the project.

Let me know if this fixes your issue!

@tmattio
Copy link
Owner

tmattio commented Apr 21, 2020

I've opened an issue in Esy related to this: esy/esy#1085

@idkjs
Copy link
Author

idkjs commented Apr 22, 2020

Being unable to run Luv's code example, which you've successfully solved by removing base from your project

I was not able to resolve running the Luv example. My point was basically that it was difficult to remove the base dependency and recompile at all. Still can't do it in a spin context. You said you tried the branch and it worked? I am going to download a fresh copy to see.

Esy throws a permission error when trying to generate the opam file (Error: exception Sys_error("luv-cli.opam: Operation not permitted")).

That error was new to me. Tried guessing around, unsuccessfully. Your chasing that down is a win! Thanks.

@idkjs
Copy link
Author

idkjs commented Apr 22, 2020

Just ran your fork, still crashes. Maybe its my machine some kind of way. If i understood you correctly, you were able to run that successfully?

~/Github/luv-cli-fork adding-luv
❯ esy
info esy 0.6.2 (using esy.json)
info fetching: done                                                                                    
info installing: done                                                                                             
info building @esy-ocaml/substs@0.0.1@d41d8cd9
info building ocaml@4.9.0@d41d8cd9
info building yarn-pkg-config@github:esy-ocaml/yarn-pkg-config#db3a0b63883606dd57c54a7158d560d6cba8cd79@d41d8cd9
info building @esy-ocaml/substs@0.0.1@d41d8cd9: done
info building @opam/base-unix@opam:base@87d0b2eb
info building @opam/base-bigarray@opam:base@b03491b0
info building @opam/base-unix@opam:base@87d0b2eb: done
info building @opam/conf-m4@opam:1@3b2b148a
info building @opam/base-bigarray@opam:base@b03491b0: done
info building @opam/base-threads@opam:base@36803084
info building @opam/base-threads@opam:base@36803084: done
info building @opam/conf-m4@opam:1@3b2b148a: done
info building yarn-pkg-config@github:esy-ocaml/yarn-pkg-config#db3a0b63883606dd57c54a7158d560d6cba8cd79@d41d8cd9: done
info building @opam/conf-pkg-config@opam:1.1@55d8e330
info building @opam/conf-pkg-config@opam:1.1@55d8e330: done
info building ocaml@4.9.0@d41d8cd9: done
info building @opam/ocamlfind@opam:1.8.1@ff07b0f9
info building @opam/dune@opam:2.5.1@a0c1e658
info building @opam/cmdliner@opam:1.0.4@93208aac
info building @opam/ocamlbuild@opam:0.14.0@6ac75d03
info building @opam/cmdliner@opam:1.0.4@93208aac: done
info building @opam/seq@opam:base@d8d7de1d
info building @opam/seq@opam:base@d8d7de1d: done
info building @opam/opam-file-format@opam:2.0.0@d0c9876d
info building @opam/ocamlfind@opam:1.8.1@ff07b0f9: done
info building @opam/base-bytes@opam:base@19d0c2ff
info building @opam/base-bytes@opam:base@19d0c2ff: done
info building @opam/ocamlgraph@opam:1.8.8@2767ad0b
info building @opam/opam-file-format@opam:2.0.0@d0c9876d: done
info building @opam/ocamlbuild@opam:0.14.0@6ac75d03: done
info building @opam/uchar@opam:0.0.2@c8218eea
info building @opam/topkg@opam:1.0.1@a42c631e
info building @opam/uchar@opam:0.0.2@c8218eea: done
info building @opam/topkg@opam:1.0.1@a42c631e: done
info building @opam/react@opam:1.2.1@0e11855f
info building @opam/uutf@opam:1.0.2@4440868f
info building @opam/uutf@opam:1.0.2@4440868f: done
info building @opam/astring@opam:0.8.3@4e5e17d5
info building @opam/react@opam:1.2.1@0e11855f: done
info building @opam/ocamlgraph@opam:1.8.8@2767ad0b: done
info building @opam/astring@opam:0.8.3@4e5e17d5: done
info building @opam/dune@opam:2.5.1@a0c1e658: done
info building @opam/cppo@opam:1.6.6@f4f83858
info building @opam/stdlib-shims@opam:0.1.0@d957c903
info building @opam/result@opam:1.5@6b753c82
info building @opam/dune-private-libs@opam:2.5.1@60c1661f
info building @opam/stdlib-shims@opam:0.1.0@d957c903: done
info building @opam/mmap@opam:1.1.0@b85334ff
info building @opam/result@opam:1.5@6b753c82: done
info building @opam/re@opam:1.9.0@d4d5e13d
info building @opam/mmap@opam:1.1.0@b85334ff: done
info building @opam/integers@opam:0.3.0@d6eefd3a
info building @opam/cppo@opam:1.6.6@f4f83858: done
info building @opam/easy-format@opam:1.3.2@0484b3c4
info building @opam/integers@opam:0.3.0@d6eefd3a: done
info building @opam/fix@opam:20200131@0ecd2f01
info building @opam/easy-format@opam:1.3.2@0484b3c4: done
info building @opam/menhirLib@opam:20200211@93d0f001
info building @opam/re@opam:1.9.0@d4d5e13d: done
info building @opam/menhirSdk@opam:20200211@b2a79ec0
info building @opam/fix@opam:20200131@0ecd2f01: done
info building @opam/ppx_derivers@opam:1.2.1@ecf0aa45
info building @opam/ppx_derivers@opam:1.2.1@ecf0aa45: done
info building @opam/sexplib0@opam:v0.13.0@3f54c2be
info building @opam/menhirLib@opam:20200211@93d0f001: done
info building @opam/camomile@opam:1.0.2@51b42ad8
info building @opam/menhirSdk@opam:20200211@b2a79ec0: done
info building @opam/fmt@opam:0.8.8@01c3a23c
info building @opam/sexplib0@opam:v0.13.0@3f54c2be: done
info building @opam/fpath@opam:0.7.2@45477b93
info building @opam/fpath@opam:0.7.2@45477b93: done
info building @opam/ptime@opam:0.8.5@0051d642
info building @opam/fmt@opam:0.8.8@01c3a23c: done
info building @opam/rresult@opam:0.6.0@4b185e72
info building @opam/rresult@opam:0.6.0@4b185e72: done
info building @opam/merlin-extend@opam:0.5@a5dd7d4b
info building @opam/merlin-extend@opam:0.5@a5dd7d4b: done
info building @opam/ocplib-endian@opam:1.1@84c1ca88
info building @opam/ptime@opam:0.8.5@0051d642: done
info building @opam/ctypes@opam:0.17.1@b90ad4de
info building @opam/ocplib-endian@opam:1.1@84c1ca88: done
info building @opam/biniou@opam:1.2.1@d7570399
info building @opam/biniou@opam:1.2.1@d7570399: done
info building @opam/opam-core@opam:2.0.6@369a2f9a
info building @opam/dune-private-libs@opam:2.5.1@60c1661f: done
info building @opam/tyxml@opam:4.4.0@1dca5713
info building @opam/opam-core@opam:2.0.6@369a2f9a: done
info building @opam/ocaml-migrate-parsetree@opam:1.7.2@bc8b618e
info building @opam/tyxml@opam:4.4.0@1dca5713: done
info building @opam/menhir@opam:20200211@26571604
info building @opam/camomile@opam:1.0.2@51b42ad8: done
info building @opam/yojson@opam:1.7.0@7056d985
info building @opam/ctypes@opam:0.17.1@b90ad4de: done
info building @opam/dune-configurator@opam:2.5.1@aeb9d8d5
info building @opam/yojson@opam:1.7.0@7056d985: done
info building @opam/opam-format@opam:2.0.6@228df1b7
info building @opam/dune-configurator@opam:2.5.1@aeb9d8d5: done
info building @opam/junit@opam:2.0.2@0b7bd730
info building @opam/junit@opam:2.0.2@0b7bd730: done
info building @opam/odoc@opam:1.5.0@35218f5f
info building @opam/opam-format@opam:2.0.6@228df1b7: done
info building @opam/charInfo_width@opam:1.1.0@9d8d61b2
info building @opam/charInfo_width@opam:1.1.0@9d8d61b2: done
info building @opam/luv@opam:0.5.1@a530d73c
info building @opam/menhir@opam:20200211@26571604: done
info building @opam/atdgen-runtime@opam:2.2.1@6a3a6395
info building @opam/atdgen-runtime@opam:2.2.1@6a3a6395: done
info building @opam/merlin@opam:3.3.4@5fcabf21
info building @opam/ocaml-migrate-parsetree@opam:1.7.2@bc8b618e: done
info building @opam/lwt@opam:5.2.0@647c0bb8
info building @opam/odoc@opam:1.5.0@35218f5f: done
info building @opam/base@opam:v0.13.1@7d937ed0
info building @opam/lwt@opam:5.2.0@647c0bb8: done
info building @opam/opam-repository@opam:2.0.6@916583b5
info building @opam/opam-repository@opam:2.0.6@916583b5: done
info building @opam/zed@opam:2.0.7@5978011f
info building @opam/zed@opam:2.0.7@5978011f: done
info building @opam/atd@opam:2.2.1@071ab6bd
info building @opam/base@opam:v0.13.1@7d937ed0: done
info building @opam/reason@opam:3.6.0@2da53ff9
info building @opam/atd@opam:2.2.1@071ab6bd: done
info building @esy-ocaml/reason@3.6.0@d41d8cd9
info building @opam/merlin@opam:3.3.4@5fcabf21: done
info building @opam/logs@opam:0.7.0@1d03143e
info building @opam/logs@opam:0.7.0@1d03143e: done
info building @opam/lwt_react@opam:1.1.3@72987fcf
info building @opam/lwt_react@opam:1.1.3@72987fcf: done
info building @opam/lwt_log@opam:1.1.1@2d7a797f
info building @opam/lwt_log@opam:1.1.1@2d7a797f: done
info building @opam/opam-state@opam:2.0.6@50326d95
info building @opam/opam-state@opam:2.0.6@50326d95: done
info building @opam/stdio@opam:v0.13.0@eb59d879
info building @opam/stdio@opam:v0.13.0@eb59d879: done
info building @opam/atdgen@opam:2.2.1@d73fda11
info building @opam/atdgen@opam:2.2.1@d73fda11: done
info building @opam/bos@opam:0.2.0@df49e63f
info building @opam/bos@opam:0.2.0@df49e63f: done
info building @opam/lambda-term@opam:2.0.3@9465cf1c
info building @opam/reason@opam:3.6.0@2da53ff9: done
info building @opam/dune-release@opam:1.3.3@9c1663be
info building @esy-ocaml/reason@3.6.0@d41d8cd9: done
info building @reason-native/console@0.1.0@d41d8cd9
info building @reason-native/console@0.1.0@d41d8cd9: done
info building @reason-native/pastel@0.3.0@d41d8cd9
info building @reason-native/pastel@0.3.0@d41d8cd9: done
info building refmterr@3.3.0@d41d8cd9
info building @opam/lambda-term@opam:2.0.3@9465cf1c: done
info building @reason-native/cli@0.0.1-alpha@d41d8cd9
info building @opam/dune-release@opam:1.3.3@9c1663be: done
info building @reason-native/file-context-printer@0.0.3@d41d8cd9
info building @reason-native/file-context-printer@0.0.3@d41d8cd9: done
info building @opam/utop@opam:2.4.3@5dd230c9
info building @reason-native/cli@0.0.1-alpha@d41d8cd9: done
info building @reason-native/rely@3.2.1@d41d8cd9
info building refmterr@3.3.0@d41d8cd9: done
info building @reason-native/rely@3.2.1@d41d8cd9: done
info building @opam/utop@opam:2.4.3@5dd230c9: done
info building @opam/luv@opam:0.5.1@a530d73c: done
Error: exception Sys_error("luv-cli.opam: Operation not permitted")
Raised by primitive operation at file "stdlib.ml", line 324, characters 29-55
Called from file "src/stdune/io.ml", line 173, characters 8-126
Re-raised at file "src/stdune/io.ml", line 178, characters 8-23
Called from file "src/dune/artifact_substitution.ml", line 407, characters
  15-48
Called from file "src/fiber/fiber.ml", line 229, characters 16-19
Called from file "src/dune/build_system.ml", line 1588, characters 8-1023
Called from file "src/fiber/fiber.ml", line 114, characters 10-15
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17
Re-raised at file "src/stdune/exn.ml" (inlined), line 37, characters 27-56
Called from file "src/stdune/exn_with_backtrace.ml", line 13, characters
  33-71
Called from file "src/fiber/fiber.ml", line 85, characters 10-17

I must not crash.  Uncertainty is the mind-killer. Exceptions are the
little-death that brings total obliteration.  I will fully express my cases. 
Execution will pass over me and through me.  And when it has gone past, I
will unwind the stack along its path.  Where the cases are handled there will
be nothing.  Only I will remain.
error: command failed: 'refmterr' 'dune' 'build' '--root' '.' '--only-package' 'luv-cli' (exited with 1)
esy-build-package: exiting with errors above...
error: build failed with exit code: 1
  
esy: exiting due to errors above

~/Github/luv-cli-fork adding-luv 11m 21s

@tmattio
Copy link
Owner

tmattio commented Apr 22, 2020

Still can't do it in a spin context.

You did though. Base is not a dependency in the project you linked. As mentioned previously, having Base present in the lock file is to be expected since a lot of libraries depend on it.

Just ran your fork, still crashes

Have you tried running esy dune build?

@idkjs
Copy link
Author

idkjs commented Apr 22, 2020

I confirm it works with calling esy dune build directly.

~/Github/luv-cli-fork adding-luv
❯ esy dune build
                     
~/Github/luv-cli-fork adding-luv*
❯ esy start
Hello World!
Hello, World! 👋
luv-cli: required argument WHO is missing
Usage: luv-cli [OPTION]... WHO
Try `luv-cli --help' for more information.

~/Github/luv-cli-fork adding-luv*
❯ 

So the take away, is that we found a bug and in the meantime by posting this issue, you, the graceful maintainer has directed the user to a temporary work around. That sound about right?

Like I said in the post, the work flow is nice. Thanks for the work you put in here!

@idkjs idkjs closed this as completed Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants