Git Product home page Git Product logo

hello-ppx-esy's People

Contributors

jchavarri avatar mrmurphy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hello-ppx-esy's Issues

Running Examples

Tried running test_bs. After installing and build root, and running yarn then esy in test_bs , i got the following errors:

~/D/h/test_bs ❯❯❯ esy                                 ✘ 130 
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                                     
.... installing @opam/ocaml-secondary-compiler@opam:4.08.1@ee                                                             .... installing @opam/ocaml-migrate-parsetree@opam:1.5.0@3e31                                                             info installing: done                                
info building @opam/ocamlfind-secondary@opam:1.8.1@9b0e1546
error: build failed with exit code: 1
  build log:
    # esy-build-package: building: @opam/ocamlfind-secondary@opam:1.8.1
    # esy-build-package: pwd: /Users/mandalarian/.esy/3/b/opam__s__ocamlfind_secondary-opam__c__1.8.1-bb3faeb0
    # esy-build-package: running: 'substs' 'META.in'
    # esy-build-package: running: 'substs' 'ocaml-secondary-compiler.conf.in'
    # esy-build-package: running: './configure' '-sitelib' '/Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib' '-no-camlp4'
    Welcome to findlib version 1.8.1
    Configuring core...
    Checking for #remove_directory...
    Testing threading model...
    systhread_supported: true
    Testing DLLs...
    Testing whether ppxopt can be supported...
    Checking for ocamlc -opaque...
    Configuring libraries...
    native dynlink: found
    labltk: not present
    ocamlbuild: not present
    camlp4: disabled
    compiler-libs: found
    dbm: not present (normal since OCaml-4.00)
    num: not present (normal since OCaml-4.06)
    bytes: found, installing fake library
    spacetime: found
    graphics: not found
    Configuration for dynlink written to site-lib-src/dynlink/META
    Configuration for str written to site-lib-src/str/META
    Configuration for threads written to site-lib-src/threads/META
    Configuration for unix written to site-lib-src/unix/META
    Configuration for stdlib written to site-lib-src/stdlib/META
    Configuration for bigarray written to site-lib-src/bigarray/META
    Configuration for ocamldoc written to site-lib-src/ocamldoc/META
    Configuration for compiler-libs written to site-lib-src/compiler-libs/META
    Configuration for bytes written to site-lib-src/bytes/META
    Configuration for raw_spacetime written to site-lib-src/raw_spacetime/META
    Detecting compiler arguments: (extractor built) ok
    
    About the OCAML core installation:
        Standard library:      /Users/mandalarian/.esy/3_____________________________________________________________/i/ocaml-4.6.1000-a4275564/lib/ocaml
        Binaries:              /Users/mandalarian/.esy/3_____________________________________________________________/i/ocaml-4.6.1000-a4275564/bin
        Manual pages:          /Users/mandalarian/.esy/3_____________________________________________________________/i/ocaml-4.6.1000-a4275564/man
        Multi-threading type:  posix
    The directory of site-specific packages will be
        site-lib:              /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib
    The configuration file is written to:
        findlib config file:   /Users/mandalarian/.esy/3_____________________________________________________________/i/ocaml-4.6.1000-a4275564/etc/findlib.conf
    Software will be installed:
        Libraries:             in <site-lib>/findlib
        Binaries:              /Users/mandalarian/.esy/3_____________________________________________________________/i/ocaml-4.6.1000-a4275564/bin
        Manual pages:          /Users/mandalarian/.esy/3_____________________________________________________________/i/ocaml-4.6.1000-a4275564/man
        topfind script:        /Users/mandalarian/.esy/3_____________________________________________________________/i/ocaml-4.6.1000-a4275564/lib/ocaml
    Topfind ppxopt support:    yes
    Toolbox:                   no
    Link custom runtime:       yes
    Need bytes compatibility:  no
    
    Configuration has been written to Makefile.config
    
    You can now do 'make all', and optionally 'make opt', to build ocamlfind.
    # esy-build-package: running: 'make' 'install-meta'
    for x in `ls site-lib-src`; do if [ -f "site-lib-src/$x/META" ]; then mkdir -p "/Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/$x"; cp site-lib-src/$x/META "/Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/$x"; fi; done
    mkdir: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/bigarray: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/bigarray: Operation not permitted
    mkdir: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/bytes: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/bytes: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/compiler-libs/META: Operation not permitted
    mkdir: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/dynlink: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/dynlink: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/ocamldoc/META: Operation not permitted
    mkdir: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/raw_spacetime: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/raw_spacetime: Operation not permitted
    mkdir: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/stdlib: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/stdlib: Operation not permitted
    mkdir: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/str: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/str: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/threads/META: Operation not permitted
    mkdir: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/unix: Operation not permitted
    cp: /Users/mandalarian/.esy/3_____________________________________________________________/i/opam__s__ocaml_secondary_compiler-opam__c__4.08.1-071830cd/share/ocaml-secondary-compiler/lib/unix: Operation not permitted
    make: *** [install-meta] Error 1
    error: command failed: 'make' 'install-meta' (exited with 2)
    esy-build-package: exiting with errors above...
    
  building @opam/ocamlfind-secondary@opam:1.8.1
esy: exiting due to errors above
~/D

test_native works as intended.

FYI in case you wanted to fix and share.

Thanks for sharing.

Issue running the examples on linux (or maybe it is due to the latest esy version?)

Hi,

I'm totally inexperienced with native reason and esy, so I don't really understand what the issue is. But I was unable to get the bucklescript (test_bs) example working.

Here is the output when I try run yarn build inside the test_bs folder:

yarn run v1.22.0
$ bsb -make-world
[1/3] Building src/Index.reast
FAILED: src/Index.reast
/home/jasoons/Documents/learning/ocaml/ppx/hello-ppx-esy/test_bs/node_modules/bs-platform/lib/bsc.exe  -w -30-40+6+7+27+32..39+44+45+101 -color always -bs-jsx 2 -ppx 'esy x ppx_42'  -o src/Index.reast -bs-syntax-only -bs-binary-ast /home/jasoons/Documents/learning/ocaml/ppx/hello-ppx-esy/test_bs/src/Index.re
info building @opam/dune@opam:2.5.0@aef1678b
error: build failed with exit code: 1
  build log:
    # esy-build-package: building: @opam/dune@opam:2.5.0
    # esy-build-package: pwd: /home/jasoons/.esy/3/b/opam__s__dune-opam__c__2.5.0-b0d2c727
    # esy-build-package: running: 'ocaml' 'bootstrap.ml' '-j' '4'
    ocamlfind -toolchain secondary ocamlc 2>.duneboot.ocamlfind-output
    ocamlfind: [WARNING] Undefined toolchain: secondary

    The ocamlfind's secondary toolchain does not seem to be correctly
    installed.
    Dune requires OCaml 4.07 or later to compile.
    Please either upgrade your compile or configure a secondary OCaml compiler
    (in opam, this can be done by installing the ocamlfind-secondary package).
    error: command failed: 'ocaml' 'bootstrap.ml' '-j' '4' (exited with 2)
    esy-build-package: exiting with errors above...

  building @opam/dune@opam:2.5.0
esy: exiting due to errors above

  We've found a bug for you!
  /home/jasoons/Documents/learning/ocaml/ppx/hello-ppx-esy/test_bs/src/Index.re

  Error while running external preprocessor
Command line: esy x ppx_42 '/tmp/camlppx81734c' '/tmp/camlppx4a215f'


FAILED: subcommand failed.
error Command failed with exit code 2.

And running the esy command inside the test_bs folder gave me this error:

info esy 0.6.2 (using esy.json)
info building @opam/dune@opam:2.5.0@aef1678b
error: build failed with exit code: 1
  build log:
    # esy-build-package: building: @opam/dune@opam:2.5.0
    # esy-build-package: pwd: /home/jasoons/.esy/3/b/opam__s__dune-opam__c__2.5.0-b0d2c727
    # esy-build-package: running: 'ocaml' 'bootstrap.ml' '-j' '4'
    ocamlfind -toolchain secondary ocamlc 2>.duneboot.ocamlfind-output
    ocamlfind: [WARNING] Undefined toolchain: secondary

    The ocamlfind's secondary toolchain does not seem to be correctly
    installed.
    Dune requires OCaml 4.07 or later to compile.
    Please either upgrade your compile or configure a secondary OCaml compiler
    (in opam, this can be done by installing the ocamlfind-secondary package).
    error: command failed: 'ocaml' 'bootstrap.ml' '-j' '4' (exited with 2)
    esy-build-package: exiting with errors above...

  building @opam/dune@opam:2.5.0
esy: exiting due to errors above

Running yarn in the project root gives me this error:

yarn install v1.22.0
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
$ node ./copyPlatformBinaryInPlace.js
ppx_42 does not support this platform :(

ppx_42 comes prepacked as built binaries to avoid large
dependencies at build-time.

If you want ppx_42 to support this platform natively,
please open an issue at our repository, linked above. Please
specify that you are on the linux platform,
on the x64 architecture.
internal/fs/utils.js:230
    throw err;
    ^

Error: ENOENT: no such file or directory, copyfile 'bin/ppx_42-linux-x64.exe' -> 'ppx'
    at Object.copyFileSync (fs.js:1807:3)
    at copyFileSync (/home/jasoons/Documents/learning/ocaml/ppx/hello-ppx-esy/copyPlatformBinaryInPlace.js:44:8)
    at Object.<anonymous> (/home/jasoons/Documents/learning/ocaml/ppx/hello-ppx-esy/copyPlatformBinaryInPlace.js:33:3)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  errno: -2,
  syscall: 'copyfile',
  code: 'ENOENT',
  path: 'bin/ppx_42-linux-x64.exe',
  dest: 'ppx'
}

This is because esy doesn't seem to create a file called bin/ppx_42-linux-x64.exe (or the copyPlatformBinaryInPlace.js file is wrong). I don't know if this could be because something changed in the latest version of esy or what.

I got the ppx working by changing the ppx-flags in the bs-config.json to be as follows:

  "ppx-flags": [
    // "esy x ppx_42"
    "../_esy/default/build/default/bin/Bin.exe"
  ],

Anyway, big thanks for putting this together, building ppxs isn't a very approachable task for beginners at the moment, and this definitely helps a lot!

Error running esy build

Hello! I'm trying to run the command esy build as specified in the README, and I'm getting the following error:

info esy build 0.5.8 (using package.json)
File "example-native/dune", line 1, characters 0-84:
1 | (executable
2 |   (name Hello)
3 |   (public_name Hello.exe)
4 |   (preprocess (pps test_ppx))
5 | )
Error: The current project defines some public elements, but no opam packages
are defined.
Please add a <package>.opam file at the project root so that these elements
are installed into it.
error: command failed: 'refmterr' 'dune' 'build' '-p' 'test_ppx' (exited with 1)
esy-build-package: exiting with errors above...
error: build failed with exit code: 1
  
esy: exiting due to errors above

Any ideas on how to fix it? Note that I'm quite new to Reason so I apologize for an inconvenience. I'm attempting to learn how to write a PPX 😄 .

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.