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

Why is `lablqml` trying to write into the ocaml library location instead of its own installation location: #61

Open jordwalke opened 5 years ago

jordwalke commented 5 years ago

With the following package.json file in the directory, run npm install -g esy && esy

{
  "name": "reason-qml",
  "version": "0.1.0",
  "description": "Starter Reason Esy Pesy Project",
  "esy": {
    "build": "refmterr dune build -p #{self.name}",
    "NOTE": "Optional release Section. Customizes result of `esy release`",
    "buildsInSource": "_build",
    "release": {
      "releasedBinaries": [
        "ReasonQmlApp.exe"
      ]
    },
    "sandboxEnv": {
      "PKG_CONFIG_PATH": "/usr/local/opt/qt/lib/pkgconfig:#{$PKG_CONFIG_PATH}",
      "LD_LIBRARY_PATH": "/usr/local/opt/qt/lib:#{$LD_LIBRARY_PATH}",
      "PATH": "/usr/local/opt/qt/bin:#{$PATH}"
    },
    "buildEnv": {
      "ODOC_SYNTAX": "re",
      "PATH": "/usr/local/opt/qt/bin:#{$PATH}"
    },
    "exportedEnv": {
      "PATH": {
        "val": "/usr/local/opt/qt/bin:#{$PATH}",
        "scope": "global"
      }
    }
  },
  "buildDirs": {
    "test": {
      "imports": [
        "Library = require('reason-qml/library')",
        "Rely = require('rely/lib')"
      ],
      "flags": [
        "-linkall",
        "-g",
        "-w",
        "-9"
      ]
    },
    "testExe": {
      "imports": [
        "Test = require('reason-qml/test')"
      ],
      "bin": {
        "RunReasonQmlTests.exe": "RunReasonQmlTests.re"
      }
    },
    "library": {
      "imports": [
        "Console = require('console/lib')",
        "Pastel = require('pastel/lib')",
        "Lablqml = require('lablqml/lib')"
      ]
    },
    "bin": {
      "imports": [
        "Library = require('reason-qml/library')"
      ],
      "bin": {
        "ReasonQmlApp.exe": "ReasonQmlApp.re"
      }
    }
  },
  "scripts": {
    "start": "esy x ReasonQmlApp.exe",
    "test": "esy x RunReasonQmlTests.exe",
    "doc": "esy dune build @doc",
    "doc-path": "esy echo #{self.target_dir}/default/_doc/_html/index.html"
  },
  "dependencies": {
    "@opam/dune": "*",
    "@reason-native/console": "*",
    "@reason-native/pastel": "*",
    "@reason-native/rely": "*",
    "@esy-ocaml/reason": "*",
    "refmterr": "*",
    "ocaml": "~4.7.0",
    "@opam/lablqml": ">=0.6.2"
  },
  "devDependencies": {
    "@opam/merlin": "*",
    "ocaml": "~4.7.0",
    "@opam/odoc": "*",
    "@pesy/esy-pesy": "0.1.0-alpha.2"
  }
}

Then you get an error that this package is trying to install itself into the ocaml library, not the package's own install location. This destroys reproducible/cached builds.

    # esy-build-package: running: 'make' 'install'
    dune build @install
    dune install
    Installing /Users/jfiorini/.esy/3________________________________________________________________/i/o
caml-4.7.1004-ba9a4808/lib/lablqml/META
    Error: mkdir: /Users/jfiorini/.esy/3________________________________________________________________/
i/ocaml-4.7.1004-ba9a4808/lib/lablqml: Operation not permitted
    make: *** [install] Error 1
    error: command failed: 'make' 'install' (exited with 2)
    esy-build-package: exiting with errors above...
jordwalke commented 5 years ago

This never usually happens for stock Dune/opam packages. What was done differently about this package build/install?

jordwalke commented 5 years ago

For example, you don't even need a separate install command, as the package manager (both opam and esy) will do the right thing by default. See how merlin builds:

https://github.com/ocaml/merlin/blob/master/merlin.opam#L8