stevenvar / OMicroB

An OCaml generic virtual machine for microcontrollers
Other
142 stars 23 forks source link

Missing Graphics during compliation #10

Closed fxfactorial closed 4 years ago

fxfactorial commented 5 years ago

Great work, love this.

Got a build bug:

rs/edgar/.opam/4.06.1/bin/ocamldep.opt -modules proto.ml > proto.ml.depends
/Users/edgar/.opam/4.06.1/bin/ocamlc.opt -c -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -thread -I /Users/edgar/Repos/OMicroB/lib/extra -o display.cmo display.ml
+ /Users/edgar/.opam/4.06.1/bin/ocamlc.opt -c -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -thread -I /Users/edgar/Repos/OMicroB/lib/extra -o display.cmo display.ml
File "display.ml", line 3, characters 5-13:
Error: Unbound module Graphics
Command exited with code 2.
Hint: Recursive traversal of subdirectories was not enabled for this build,
  as the working directory does not look like an ocamlbuild project (no
  '_tags' or 'myocamlbuild.ml' file). If you have modules in subdirectories,
  you should add the option "-r" or create an empty '_tags' file.

  To enable recursive traversal for some subdirectories only, you can use the
  following '_tags' file:

      true: -traverse
      <dir1> or <dir2>: traverse

make[1]: *** [.build/main.native] Error 10
make: *** [all] Error 2
stevenvar commented 5 years ago

It looks like you didn't have the Graphics library installed during the compilation of your opam or your ocaml switch.

I guess, from your home path, that you're on a mac. I think you should install https://www.xquartz.org/ (and reinstall opam) if it is not already the case.

I'll modify the readme to note the Graphics dependencies

fxfactorial commented 5 years ago
[ERROR] The compilation of graphics failed at "/Users/edgar/.opam/opam-init/hooks/sandbox.sh build ocamlc -custom graphics.cma -o test".

#=== ERROR while compiling graphics.1.0 =======================================#
# context     2.0.2 | macos/x86_64 | base-bigarray.base base-threads.base base-unix.base ocaml-base-compiler.4.06.1 | https://opam.ocaml.org#dc840fe4
# path        ~/.opam/4.06.1/.opam-switch/build/graphics.1.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build ocamlc -custom graphics.cma -o test
# exit-code   2
# env-file    ~/.opam/log/graphics-29574-dd682e.env
# output-file ~/.opam/log/graphics-29574-dd682e.out
### output ###
# File "_none_", line 1:
# Error: Cannot find file graphics.cma

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ Ξ» build graphics 1.0
└─
╢─ No changes have been performed

<><> graphics.1.0 troubleshooting <><><><><><><><><><><><><><><><><><><><><>  🐫
=> This package checks whether the Graphics library was compiled.

This is after removing and installing opam 2.0.2, after I had installed xquartz. Is there a reason for this dependency at all? Seems like just for simulator/tests?

Vertmo commented 5 years ago

I think it's just the simulator yes. I'm guessing commenting out lines 7 through 9 in the toplevel Makefile like so :

--- a/Makefile
+++ b/Makefile
@@ -4,9 +4,9 @@ all: config
    $(call compile, lib/extra)
    $(call compile, src/bc2c)
    $(call compile, src/h15ppx)
-   $(call compile, src/simulators/lcd)
-   $(call compile, src/simulators/dip)
-   $(call compile, src/simulators/circuit)
+#  $(call compile, src/simulators/lcd)
+#  $(call compile, src/simulators/dip)
+#  $(call compile, src/simulators/circuit)
    $(call compile, src/byterun)
    $(call compile, src/omicrob)
    $(call compile, src/stdlib)

Should do the trick (not having your problem, I haven't been able to test it though). That also mean you won't be able to simulate your programs, but you should be able to compile and flash them.