Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with make: Error: Unbound module Stdlib #13

Open
1inguini opened this issue Feb 25, 2019 · 10 comments
Open

problem with make: Error: Unbound module Stdlib #13

1inguini opened this issue Feb 25, 2019 · 10 comments

Comments

@1inguini
Copy link

1inguini commented Feb 25, 2019

Here's the error:

➤ make
make[1]: Nothing to be done for 'extra'.
make[1]: Nothing to be done for 'bc2c'.
make[1]: Nothing to be done for 'h15ppx'.
make[1]: Nothing to be done for 'lcd'.
make[1]: Nothing to be done for 'dip'.
make[1]: Nothing to be done for 'simu_circuit'.
make[1]: Nothing to be done for 'byterun'.
make[1]: Nothing to be done for 'omicrob'.
make[1]: Entering directory '/home/linguini/Desktop/ocaml/OMicroB/src/stdlib'
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/std_exit.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/char.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/bytes.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/bytesLabels.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/string.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/stringLabels.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/list.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/listLabels.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/map.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/array.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/arrayLabels.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/uchar.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/sys.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/buffer.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/random.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/complex.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/gc.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/int64.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/hashtbl.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/set.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/moreLabels.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/queue.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/sort.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/stack.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/stdLabels.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/camlinternalOO.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/avr.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -nopervasives -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/liquidCrystal.mli
/sbin/ocamlc.opt -w A-58-e -warn-error A -safe-string -strict-formats -strict-sequence -nostdlib -c -w @a /home/linguini/Desktop/ocaml/OMicroB/src/stdlib/std_exit.ml
File "compiler internals", line 1:
Error: Unbound module Stdlib
make[1]: *** [Makefile:32: std_exit.cmo] Error 2
rm listLabels.cmi array.cmi set.cmi stdLabels.cmi sort.cmi uchar.cmi bytes.cmi map.cmi buffer.cmi moreLabels.cmi sys.cmi std_exit.cmi random.cmi camlinternalOO.cmi list.cmi complex.cmi bytesLabels.cmi stack.cmi hashtbl.cmi stringLabels.cmi gc.cmi int64.cmi liquidCrystal.cmi char.cmi avr.cmi arrayLabels.cmi string.cmi queue.cmi
make[1]: Leaving directory '/home/linguini/Desktop/ocaml/OMicroB/src/stdlib'
make: *** [Makefile:12: all] Error 2

I've made several tweaks in etc/Makefiles to get rid of some other errors I've encountered:

  • Filled OCAMLWHERE because it was empty: OCAMLWHERE := /usr/lib/ocaml

  • Added -pkg obytelib to OCAMLBUILD: OCAMLBUILD := /home/linguini/.opam/default/bin/ocamlbuild -pkg obytelib -cflags -w,A-58-e,-warn-error,A,-safe-string,-strict-formats,-strict-sequence -lflags -w,A-58-e,-warn-error,A,-safe-string,-strict-formats,-strict-sequence -no-links -classic-display -build-dir .build

  • Tweaked some directories (actually I've tweaked ./config first, and tweaked etc/Makefile.conf afterwards):

OCAMLCLEAN  := /home/linguini/.opam/default/bin/ocamlclean
BINDIR      := /home/linguini/.opam/default/bin
LIBDIR      := /home/linguini/.opam/default/lib/omicrob
LIBEXECDIR  := /home/linguini/.opam/default/lib/omicrob
INCLUDEDIR  := /home/linguini/.opam/default/lib/omicrob
MAN1DIR     := /home/linguini/.opam/default/lib/man/man1
MAN3DIR     := /home/linguini/.opam/default/lib/man/man3
@1inguini
Copy link
Author

I removed all the -nostdlib from src/stdlib/Makefile, and at least the make (and make install) succeeded.
I'm not sure if the omicrob made by my tweaked makefiles work, so I'll keep this issue open.

@1inguini
Copy link
Author

1inguini commented Feb 26, 2019

It seems it didn't work, since Error: Unbound module Stdlib comes up when I omicrob test/foo/bar.ml

@stevenvar
Copy link
Owner

Hello,
Are you using a recent version of OCaml? We noticed some issues with OCaml 4.07 because of how the stdlib is now structured (with the new Stdlib module). My only quick "solution" is to use some older version of OCaml (4.06 should work just fine). I'll update the README.md to warn users about this.

@1inguini
Copy link
Author

1inguini commented Feb 26, 2019

downgrading OCaml did well to some point, and I succeeded in make, but now I get this executing (by the way, omicrob became unexecutable with omicrob command in spite of $PATH set correctly) omicrob:

➤ ~/.opam/default/bin/omicrob tests/atmega-2560-led/led.ml
File "command line", line 1:
Error: Unbound module Pervasives

@1inguini
Copy link
Author

I was using the wrong libs, libs of 4.07, but correcting that didn't help

@stevenvar
Copy link
Owner

stevenvar commented Feb 27, 2019

I'm afraid I cannot replicate your issue.

Are you sure you ran

eval $(opam config env)

after switching your ocaml compiler ?

Then, did you run

make clean && ./configure && sudo make install

in the root directory of omicrob ?

EDIT: Alright, I think I now what's happening : since you manually entered a value for $OCAMLWHERE (/usr/lib/ocaml), then the used compiler still is the ocaml system compiler (which I think is 4.07 ?). Anyways, you're not using your opam compiler by doing this. Try removing this modification and let the script do OCAMLWHERE="$(ocamlc -where)".

Please let me now if it works, thanks!

@1inguini
Copy link
Author

1inguini commented Mar 1, 2019

The compiling succeeded when I re-cloned this repo and make with fresh ./config
The thing is, burnig the hex file made from tuto_1_led/ into my pro micro(atmega32u4) with another pro micro as an ISP makes my arduino silent (which mabe an issue from avrdude, sice the same thing happened with arduino-cli), and trying to burn the elf file this error is emitted:

➤ avrdude -c arduino -P /dev/serial/by-id/usb-SparkFun_SparkFun_Pro_Micro-if00  -p m32u4 -U flash:w:led.elf:e -v

avrdude: Version 6.3, compiled on Jan 11 2019 at 08:12:38
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/linguini/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/serial/by-id/usb-SparkFun_SparkFun_Pro_Micro-if00
         Using Programmer              : arduino
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "led.elf"
avrdude: ERROR: ELF file "led.elf" is not a 32-bit, big-endian file that was expected
avrdude: read from file 'led.elf' failed

avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: safemode: Fuses OK (E:CB, H:D8, L:FF)

avrdude done.  Thank you.

@stevenvar
Copy link
Owner

The elf file is the PC executable (used for simulation / debugging), you should burn the .hex file

@1inguini
Copy link
Author

1inguini commented Mar 1, 2019

OK, but still led doesn't light up.

@stevenvar
Copy link
Owner

did you pick the right model of microcontroller in the configure file ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants