revery-ui / reason-glfw

Cross-platform GLFW / OpenGL ES / WebGL bindings for Reason
MIT License
46 stars 17 forks source link

Creating a 'release' build with js_of_ocaml? #108

Open michaelboulton opened 5 years ago

michaelboulton commented 5 years ago

I was trying to reduce the JS bundle size in Revery by creating a 'release' build but it seems like this library doesn't play nicely when trying to compile it in release mode - Just cloning this repository and trying to run esy dune build --profile release Gives me this error (seemingly when it's compiling it to bytecode):

$ esy dune build  --profile release
      ocamlc bin_js/test_glfw.bc (exit 2)
(cd /home/michael/code/reason-glfw/_esy/default/store/b/reason_glfw-222626f5/default && /home/michael/.esy/3__________________________________________________________________/i/ocaml-4.7.1004-a6ae015e/bin/ocamlc.opt -w -40 -g -o bin_js/test_glfw.bc -I /home/michael/.esy/3__________________________________________________________________/i/opam__s__js__of__ocaml-opam__c__3.3.0-259f2db1/lib/js_of_ocaml -I /home/michael/.esy/3__________________________________________________________________/i/opam__s__lwt-opam__c__4.2.0-6f67c2ec/lib/lwt -I /home/michael/.esy/3__________________________________________________________________/i/opam__s__ocamlfind-opam__c__1.8.0-32d00fdd/lib/bytes -I /home/michael/.esy/3__________________________________________________________________/i/opam__s__result-opam__c__1.3-abf03bc2/lib/result -I /home/michael/.esy/3__________________________________________________________________/i/opam__s__seq-opam__c__base-37652505/lib/seq -I /home/michael/.esy/3__________________________________________________________________/i/opam__s__uchar-opam__c__0.0.2-a0257ecf/lib/uchar -I /home/michael/.esy/3__________________________________________________________________/i/reason_gl_matrix-0.9.9304-c8ab5514/lib/reglm -I examples -I src /home/michael/.esy/3__________________________________________________________________/i/opam__s__result-opam__c__1.3-abf03bc2/lib/result/result.cma /home/michael/.esy/3__________________________________________________________________/i/opam__s__lwt-opam__c__4.2.0-6f67c2ec/lib/lwt/lwt.cma /home/michael/.esy/3__________________________________________________________________/i/opam__s__js__of__ocaml-opam__c__3.3.0-259f2db1/lib/js_of_ocaml/js_of_ocaml.cma /home/michael/.esy/3__________________________________________________________________/i/ocaml-4.7.1004-a6ae015e/lib/ocaml/unix.cma /home/michael/.esy/3__________________________________________________________________/i/ocaml-4.7.1004-a6ae015e/lib/ocaml/bigarray.cma /home/michael/.esy/3__________________________________________________________________/i/reason_gl_matrix-0.9.9304-c8ab5514/lib/reglm/reglm.cma src/reglfw.cma examples/EsyGlfwExamples.cma bin_js/.test_glfw.eobjs/byte/test_glfw.cmo)
File "_none_", line 1:
Error: Error on dynamically loaded library: ./src/dllreglfw_stubs.so: ./src/dllreglfw_stubs.so: undefined symbol: glfwGetProcAddress

(That last line is Error: Error on dynamically loaded library: ./src/dllreglfw_stubs.so: ./src/dllreglfw_stubs.so: undefined symbol: glfwGetProcAddress)

This also happens in the revery-quick-start repo when running esy dune build --profile release ./App.bc.js

Is this a known issue? If so, is there some other way to build a 'release' version?

(For reference this is mainly a problem when trying to build something with Revery because without 'release' mode the final JS bundle ends up being huge, even when run through something like the closure compiler)

WhoAteDaCake commented 5 years ago

Error: Error on dynamically loaded library: ./src/dllreglfw_stubs.so: ./src/dllreglfw_stubs.so: undefined symbol: glfwGetProcAddress

I am getting the exact same error when trying to build revery within a clean docker image.

EDIT: Just released that I tried to build it on a server with no GPU (facepalm)