Kakadu / lablqml

Interfacing Qt/QML with OCaml. Formely known as lablqt
http://kakadu.github.io/lablqml
GNU Lesser General Public License v2.1
159 stars 17 forks source link

ppx_qt is empty #62

Closed clembu closed 4 years ago

clembu commented 4 years ago

The opam file for ppx_qt is empty, and nothing is installed. Makes the ppx effectively unavailable, and the library really hard to use.

Kakadu commented 4 years ago

@facelesspanda I did some changes. It seems that a META for executable should exist and I remove it.

Please, check new version, I want more feedback.

clembu commented 4 years ago

will try to update tonight and check again. Thanks.

clembu commented 4 years ago

just tried to pin to master and update fails with

dune build @install
Error: exception Sys_error("_build/log: Read-only file system")
Backtrace:
Raised by primitive operation at file "stdlib.ml", line 324, characters 29-55
Called from file "src/stdune/log.ml", line 23, characters 11-61
Called from file "bin/common.ml", line 73, characters 2-28
Called from file "bin/common.ml" (inlined), line 97, characters 2-39
Called from file "bin/main.ml", line 46, characters 4-37
Called from file "vendor/cmdliner/src/cmdliner_term.ml", line 25, characters 19-24
Called from file "vendor/cmdliner/src/cmdliner.ml", line 146, characters 9-16
Called from file "vendor/cmdliner/src/cmdliner.ml", line 176, characters 18-36
Called from file "vendor/cmdliner/src/cmdliner.ml", line 312, characters 20-46
Called from file "bin/main.ml", line 198, characters 10-51

I must not segfault.  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.
make: *** [Makefile:29: install] Error 1

(content of the opam install log pertaining to lablqml)

Kakadu commented 4 years ago

Pinning work for me though. But your error seems quite mysterious (and hardly googlable). Do you use any non-trivial sandboxing software which can mess with access rights?

clembu commented 4 years ago

nope, just opam. I'll see about gaining more info tonight. For some reason this package is the only one that seems to make dune angry for me.

clembu commented 4 years ago

so I tried building locally.

  1. Cloned lablqml to a new directory
  2. cd lablqml
  3. opam switch create . 4.08.1 There opam tries to install the existing local package because there's a lablqml.opam file at the root, and I have this output
    ### output ###
    # dune build @install
    # Error: mkdir: _build: Read-only file system
    # make: *** [Makefile:29: install] Error 1
  4. run eval $(opam env) to have the environment in the shell
  5. manually run dune build @install That works fine

When I run opam install . from the lablqml repo, I have that error again about _build being read only and dune failing with a huge backtrace. Must come from opam's sandboxing probably?

Kakadu commented 4 years ago

I don't know. I tried the same but it compiles fine. https://gist.github.com/Kakadu/ddfa3d11a159f364ee74998bca13726a

If it is indeed about sanboxing, then you can try to comment out last lines in ~/.opam/config to disable sandboxing

wrap-build-commands:
  ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"}
wrap-install-commands:
  ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"}
wrap-remove-commands:
  ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"}
clembu commented 4 years ago

hmm. the verbose mode helped me figuring out something that was kinda obvious: there's a build step before the install step

+ /home/odd/.opam/opam-init/hooks/sandbox.sh "build" "dune" "build" "-p" "lablqml" "-j" "3" (CWD=/home/odd/dev/lablqml/_opam/.opam-switch/build/lablqml.0.6.2)
-     discover lib/c_flags.sexp,lib/c_library_flags.sexp,lib/moc.sexp,lib/rcc.sexp
- /usr/bin/moc-qt5
- /usr/bin/rcc-qt5
-          gcc lib/object_ml.o
...... warnings .....
λ compiled  lablqml.0.6.2
+ /home/odd/.opam/opam-init/hooks/sandbox.sh "install" "make" "install" (CWD=/home/odd/dev/lablqml/_opam/.opam-switch/build/lablqml.0.6.2)
- dune build @install
- Error: mkdir: _build: Read-only file system
- make: *** [Makefile:29: install] Error 1

lablqml is built first to /home/odd/dev/lablqml/_opam/.opam-switch/build/lablqml.0.6.2 Yet in the install step there is a dune build @install.

I found that curious so I dug around to see how other packages that install fine are structured.

They don't have a install entry in their .opam file.

I'm gonna try removing it from lablqml's and see if things change.

clembu commented 4 years ago

Sure enough, removing the install entry from the opam file managed to make lablqml install perfectly, ironically as that sounds:

+ /home/odd/.opam/opam-init/hooks/sandbox.sh "build" "dune" "build" "-p" "lablqml" "-j" "3" (CWD=/home/odd/dev/lablqml/_opam/.opam-switch/build/lablqml.0.6.2)
-     discover lib/c_flags.sexp,lib/c_library_flags.sexp,lib/moc.sexp,lib/rcc.sexp
- /usr/bin/moc-qt5
- /usr/bin/rcc-qt5
...... warnings .....
λ compiled  lablqml.0.6.2
∗ installed lablqml.0.6.2
Done.
clembu commented 4 years ago

Okay so now that lablqml installs fine, I can assert that ppx_qt isn't available as a preprocessor. Using

  (preprocess (per_module
               ((pps ppx_qt) Controller)) )

which is the preferred way to preprocess files in dune, from what I've seen, results in dune expecting a library, when ppx_qt is an executable.

I could "workaround" it by using a run stanza, but it'd be a shame and could be fixed if ppx_qt was compiled as a library too.

Kakadu commented 4 years ago

@facelesspanda I will try to look at this at the weekend...

Kakadu commented 4 years ago

run stanza will be required anyway because ppx_qt generates C++ files.

Kakadu commented 4 years ago

@facelesspanda Also, if you manage to upgrade code in https://github.com/Kakadu/lablqml/tree/master/dune_test than pull-request will be appreciated.

clembu commented 4 years ago

Ok, I'll see what I can do.