reasonml / ReasonNativeProject

Reason native compilation starter project
MIT License
203 stars 45 forks source link

npm install fails with 4.04.0 installed globally #11

Open slogsdon opened 7 years ago

slogsdon commented 7 years ago

Running npm install fails when OCaml 4.04.0 is installed globally:

$ opam switch
--     -- 3.07    Official 3.07 release
--     -- 3.08.0  Official 3.08.0 release
--     -- 3.08.1  Official 3.08.1 release
--     -- 3.08.2  Official 3.08.2 release
--     -- 3.08.3  Official 3.08.3 release
--     -- 3.08.4  Official 3.08.4 release
--     -- 3.09.0  Official 3.09.0 release
--     -- 3.09.1  Official 3.09.1 release
--     -- 3.09.2  Official 3.09.2 release
--     -- 3.09.3  Official 3.09.3 release
--     -- 3.10.0  Official 3.10.0 release
--     -- 3.10.1  Official 3.10.1 release
--     -- 3.10.2  Official 3.10.2 release
--     -- 3.11.0  Official 3.11.0 release
--     -- 3.11.1  Official 3.11.1 release
--     -- 3.11.2  Official 3.11.2 release
--     -- 3.12.0  Official 3.12.0 release
--     -- 3.12.1  Official 3.12.1 release
--     -- 4.00.0  Official 4.00.0 release
--     -- 4.00.1  Official 4.00.1 release
--     -- 4.01.0  Official 4.01.0 release
--     -- 4.02.0  Official 4.02.0 release
--     -- 4.02.1  Official 4.02.1 release
--     -- 4.02.2  Official 4.02.2 release
4.02.3  C 4.02.3  Official 4.02.3 release
--     -- 4.03.0  Official 4.03.0 release
--     -- 4.04.0  Official 4.04.0 release
system  I system  System compiler (4.04.0)
# 244 more patched or experimental compilers, use '--all' to show
$ opam switch system
$ eval `opam config env`
$ git clone https://github.com/reasonml/ReasonProject HelloReason
$ cd HelloReason
$ npm install
# ... later
ocamlc -I +compiler-libs -g -c fl_lint.ml
ocamlc -I +compiler-libs -a -o findlib.cma findlib_config.cmo fl_split.cmo fl_metatoken.cmo fl_meta.cmo fl_metascanner.cmo fl_topo.cmo fl_package_base.cmo findlib.cmo fl_args.cmo fl_lint.cmo
ocamlc -I +compiler-libs -g -c ocaml_args.ml
ocamlc -I +compiler-libs -g -c frontend.ml
File "frontend.ml", line 1787, characters 16-29:
Warning 3: deprecated: String.create
Use Bytes.create instead.
ocamlc -I +compiler-libs  -o ocamlfind -g findlib.cma unix.cma \
                   ocaml_args.cmo frontend.cmo
File "_none_", line 1:
Error: Error on dynamically loaded library: /usr/local/lib/ocaml/stublibs/dllunix.so: dlopen(/usr/local/lib/ocaml/stublibs/dllunix.so, 138): Symbol not found: _caml_string_is_c_safe
  Referenced from: /usr/local/lib/ocaml/stublibs/dllunix.so
  Expected in: flat namespace
 in /usr/local/lib/ocaml/stublibs/dllunix.so
make[1]: *** [ocamlfind] Error 2
make: *** [all] Error 2
ReasonProject@0.0.1 /Users/shane.logsdon/Code/reason/HelloReason
├─┬ @opam-alpha/merlin@2.5.1
│ └─┬ merlin-actual@2.5.1  (git://github.com/npm-opam/merlin.git#5b236062b3cceff3e653ba47283159cf6895a93b)
│   ├─┬ @opam-alpha/yojson@1.3.3
│   │ └─┬ yojson-actual@1.3.3  (git://github.com/npm-opam/yojson.git#a72727dd8899c53153fd8a7cea06c626d0a71faf)
│   │   ├─┬ @opam-alpha/biniou@1.0.12
│   │   │ └─┬ biniou-actual@1.0.12  (git://github.com/npm-opam/biniou.git#198ece6041aa0853bc1637475796840b3daae5a9)
│   │   │   └─┬ @opam-alpha/conf-which@1.0.0
│   │   │     └── conf-which-actual@1.0.0  (git://github.com/npm-opam/conf-which.git#0b798e035ea41e43744ff28075b15d1a5dc9ac99)
│   │   ├─┬ @opam-alpha/cppo@1.4.1
│   │   │ └─┬ cppo-actual@1.4.1  (git://github.com/npm-opam/cppo.git#f93baf17d8099c5866df939264ddddb6457aa7d2)
│   │   │   └── @opam-alpha/ocamlbuild@0.9.2
│   │   └─┬ @opam-alpha/easy-format@1.2.0
│   │     └── easy-format-actual@1.2.0  (git://github.com/npm-opam/easy-format.git#9a61ee2ca3cff40b50a36dc66dcb7761d096a451)
│   ├─┬ opam-installer-bin@0.0.0  (git+https://github.com/yunxing/opam-installer-bin.git#689ede681217f76fb2f82a9f4528e192a5b543ba)
│   │ ├── dependency-env@0.1.1  (git+https://github.com/npm-ml/dependency-env.git#94c75aff3a71587afb570d89bcf2eef7996bb67f)
│   │ └── nopam@0.1.0  (git+https://github.com/yunxing/nopam.git#7cd19f068ac9aaf75010cd6961f7c65c779a1d4a)
│   └── substs@0.0.1  (git+https://github.com/yunxing/substs.git#fd480dcdb4aed3fa9128fd819a546e3a7770040f)
├─┬ @opam-alpha/ocaml@4.2.3
│ └── ocaml@4.2.3  (git+https://github.com/npm-opam/ocaml.git#0bb98be8e5233a02282ed8de0c8965677ddbde33)
├─┬ dependency-env@0.0.1
│ └── resolve@1.2.0
├── fastrealpath@0.1.1
└── nopam@0.1.0

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.3.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.3.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! ocamlfind-actual@1.6.2 postinstall: `eval $(dependencyEnv) && nopam && ./configure -no-camlp4 -bindir $opam_bin -sitelib $opam_lib -mandir $opam_man -config $opam_lib/findlib.conf -no-custom && make all && make opt && make install`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the ocamlfind-actual@1.6.2 postinstall script 'eval $(dependencyEnv) && nopam && ./configure -no-camlp4 -bindir $opam_bin -sitelib $opam_lib -mandir $opam_man -config $opam_lib/findlib.conf -no-custom && make all && make opt && make install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ocamlfind-actual package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     eval $(dependencyEnv) && nopam && ./configure -no-camlp4 -bindir $opam_bin -sitelib $opam_lib -mandir $opam_man -config $opam_lib/findlib.conf -no-custom && make all && make opt && make install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ocamlfind-actual
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ocamlfind-actual
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/shane.logsdon/Code/reason/HelloReason/npm-debug.log

Switching to 4.02.3 seems to correct the issue:

$ cd ..
$ rm -rf HelloReason
$ opam switch
--     -- 3.07    Official 3.07 release
--     -- 3.08.0  Official 3.08.0 release
--     -- 3.08.1  Official 3.08.1 release
--     -- 3.08.2  Official 3.08.2 release
--     -- 3.08.3  Official 3.08.3 release
--     -- 3.08.4  Official 3.08.4 release
--     -- 3.09.0  Official 3.09.0 release
--     -- 3.09.1  Official 3.09.1 release
--     -- 3.09.2  Official 3.09.2 release
--     -- 3.09.3  Official 3.09.3 release
--     -- 3.10.0  Official 3.10.0 release
--     -- 3.10.1  Official 3.10.1 release
--     -- 3.10.2  Official 3.10.2 release
--     -- 3.11.0  Official 3.11.0 release
--     -- 3.11.1  Official 3.11.1 release
--     -- 3.11.2  Official 3.11.2 release
--     -- 3.12.0  Official 3.12.0 release
--     -- 3.12.1  Official 3.12.1 release
--     -- 4.00.0  Official 4.00.0 release
--     -- 4.00.1  Official 4.00.1 release
--     -- 4.01.0  Official 4.01.0 release
--     -- 4.02.0  Official 4.02.0 release
--     -- 4.02.1  Official 4.02.1 release
--     -- 4.02.2  Official 4.02.2 release
4.02.3  I 4.02.3  Official 4.02.3 release
--     -- 4.03.0  Official 4.03.0 release
--     -- 4.04.0  Official 4.04.0 release
system  C system  System compiler (4.04.0)
# 244 more patched or experimental compilers, use '--all' to show
$ opam switch 4.02.3
$ eval `opam config env`
$ git clone https://github.com/reasonml/ReasonProject HelloReason
$ cd HelloReason
$ npm install
# ... later
> ReasonProject@0.0.1 postinstall /Users/shane.logsdon/Code/reason/HelloReason
> npm run reasonBuild

> ReasonProject@0.0.1 reasonBuild /Users/shane.logsdon/Code/reason/HelloReason
> eval $(dependencyEnv) && nopam && rebuild -I src ./src/Test.native 2>&1 | refmterr

/Users/shane.logsdon/Code/reason/HelloReason/node_modules/ocaml/bin/ocamldep.opt -modules -pp refmt -impl src/Test.re | tee src/Test.re.depends > src/Test.ml.depends
env OCAMLC="ocamlc.opt" /Users/shane.logsdon/code/reason/HelloReason/node_modules/reason/_build/ocamlfind/bin/rec -c -I src -pp refmt -o src/Test.cmo -intf-suffix .rei -impl src/Test.re
env OCAMLOPT="ocamlopt.opt" /Users/shane.logsdon/code/reason/HelloReason/node_modules/reason/_build/ocamlfind/bin/reopt -c -I src -pp refmt -o src/Test.cmx -intf-suffix .rei -impl src/Test.re
env OCAMLOPT="ocamlopt.opt" /Users/shane.logsdon/code/reason/HelloReason/node_modules/reason/_build/ocamlfind/bin/reopt src/Test.cmx -o src/Test.native
✔ Seems fine!
ReasonProject@0.0.1 /Users/shane.logsdon/Code/reason/HelloReason
├─┬ @opam-alpha/merlin@2.5.1
│ └─┬ merlin-actual@2.5.1  (git://github.com/npm-opam/merlin.git#5b236062b3cceff3e653ba47283159cf6895a93b)
│   └─┬ @opam-alpha/yojson@1.3.3
│     └─┬ yojson-actual@1.3.3  (git://github.com/npm-opam/yojson.git#a72727dd8899c53153fd8a7cea06c626d0a71faf)
│       └─┬ @opam-alpha/biniou@1.0.12
│         └─┬ biniou-actual@1.0.12  (git://github.com/npm-opam/biniou.git#198ece6041aa0853bc1637475796840b3daae5a9)
│           └─┬ @opam-alpha/conf-which@1.0.0
│             └── conf-which-actual@1.0.0  (git://github.com/npm-opam/conf-which.git#0b798e035ea41e43744ff28075b15d1a5dc9ac99)
├─┬ @opam-alpha/ocaml@4.2.3
│ └── ocaml@4.2.3  (git+https://github.com/npm-opam/ocaml.git#0bb98be8e5233a02282ed8de0c8965677ddbde33)
├─┬ dependency-env@0.0.1
│ └── resolve@1.2.0
├── fastrealpath@0.1.1
├── nopam@0.1.0
└─┬ reason@1.4.0
  ├─┬ @opam-alpha/BetterErrors@0.0.1
  │ └─┬ BetterErrors-actual@0.0.1  (git://github.com/npm-opam/BetterErrors.git#3a8c29bb67089b4b615ced135f3bd608be0e5aa0)
  │   └─┬ @opam-alpha/ANSITerminal@0.7.0
  │     └── ANSITerminal-actual@0.7.0  (git://github.com/npm-opam/ANSITerminal.git#787c809f7b3e0d6445b803805f81a74a2af7b503)
  ├─┬ @opam-alpha/easy-format@1.2.0
  │ └── easy-format-actual@1.2.0  (git://github.com/npm-opam/easy-format.git#9a61ee2ca3cff40b50a36dc66dcb7761d096a451)
  ├─┬ @opam-alpha/menhir@20160825.0.0
  │ └─┬ menhir-actual@20160825.0.0  (git://github.com/npm-opam/menhir.git#8d6905e8eeb4bedcec501a14fdc7a7d950f85874)
  │   └── @opam-alpha/ocamlbuild@0.9.2
  ├─┬ @opam-alpha/merlin-extend@0.3.0
  │ └─┬ merlin-extend-actual@0.3.0  (git://github.com/npm-opam/merlin-extend.git#8d01d124db27f46a27e04f25d0e1c54bab0d0f48)
  │   └─┬ @opam-alpha/cppo@1.4.1
  │     └── cppo-actual@1.4.1  (git://github.com/npm-opam/cppo.git#f93baf17d8099c5866df939264ddddb6457aa7d2)
  ├─┬ @opam-alpha/ocamlfind@1.6.2
  │ └─┬ ocamlfind-actual@1.6.2  (git+https://github.com/npm-opam/ocamlfind.git#f6ea48c7628210d477ead863d32feba2357b9afe)
  │   └─┬ @opam-alpha/conf-m4@4.1.0
  │     └── conf-m4-actual@4.1.0  (git://github.com/npm-opam/conf-m4.git#75e353ae7ae97a988319ddb0e97ecfa25bce4739)
  ├─┬ @opam-alpha/re@1.7.1
  │ └── re-actual@1.7.1  (git://github.com/npm-opam/re.git#9da39424a8a4a12a768f90b1e5cc4401102b6834)
  ├── dependency-env@0.1.1  (git+https://github.com/reasonml/dependency-env.git#94c75aff3a71587afb570d89bcf2eef7996bb67f)
  ├── nopam@0.1.0  (git+https://github.com/reasonml/nopam.git#7cd19f068ac9aaf75010cd6961f7c65c779a1d4a)
  ├─┬ opam-installer-bin@0.0.0  (git+https://github.com/yunxing/opam-installer-bin.git#689ede681217f76fb2f82a9f4528e192a5b543ba)
  │ ├── dependency-env@0.1.1  (git+https://github.com/npm-ml/dependency-env.git#94c75aff3a71587afb570d89bcf2eef7996bb67f)
  │ └── nopam@0.1.0  (git+https://github.com/yunxing/nopam.git#7cd19f068ac9aaf75010cd6961f7c65c779a1d4a)
  ├── substs@0.0.1  (git+https://github.com/yunxing/substs.git#fd480dcdb4aed3fa9128fd819a546e3a7770040f)
  └─┬ utop-bin@1.19.2  (git+https://github.com/reasonml/utop-bin.git#5e9e322c1f264c0d9e8abb9f85e5472de1c8147d)
    ├── camomile-bin@0.8.5  (git+https://github.com/reasonml/camomile-bin.git#08f5d6115b76d46897af47b9ee8e70a55973b40f)
    ├─┬ lambda-term-bin@1.10.0  (git+https://github.com/reasonml/lambda-term-bin.git#72137b68f22af1fd2d1e52afbb02ff45b494908a)
    │ └── zed-bin@1.4.0  (git+https://github.com/reasonml/zed-bin.git#7d2f0677a4a73c1b51ecbf05589e1f7b5bd76705)
    ├── lwt-bin@2.5.2  (git+https://github.com/reasonml/lwt-bin.git#96859b56091d3b46d3c36e80522a137bb768fee5)
    └── react-bin@1.2.2  (git+https://github.com/reasonml/react-bin.git#b9868712a9e76af9de52e726912bdd99f9a66e87)

I'm checking into the following things but wanted to get this logged beforehand:

Edit: Adding version numbers:

slogsdon commented 7 years ago

Removing OCaml and related tools from the system seems to allow npm install to work without issue:

$ brew uninstall opam
Uninstalling /usr/local/Cellar/opam/1.2.2_2... (30 files, 14.9M)
$ brew uninstall ocaml camlp4 ocamlbuild
Uninstalling /usr/local/Cellar/ocaml/4.04.0... (1,730 files, 194.0M)
Uninstalling /usr/local/Cellar/camlp4/4.04+1... (165 files, 143M)
Uninstalling /usr/local/Cellar/ocamlbuild/0.9.3_1... (27 files, 6.9M)
$ brew uninstall --force ocaml camlp4 ocamlbuild
$ brew uninstall opam --force
$ ± rm -rf ~/.opam/
$ cd ..
$ rm -rf HelloReason
$ which opam
opam not found
$ which ocaml
ocaml not found
$ which ocamlbuild
ocamlbuild not found
$ git clone https://github.com/reasonml/ReasonProject HelloReason
$ cd HelloReason
$ npm install
# ... later
> ReasonProject@0.0.1 postinstall /Users/shane.logsdon/Code/reason/HelloReason
> npm run reasonBuild

> ReasonProject@0.0.1 reasonBuild /Users/shane.logsdon/Code/reason/HelloReason
> eval $(dependencyEnv) && nopam && rebuild -I src ./src/Test.native 2>&1 | refmterr

/Users/shane.logsdon/Code/reason/HelloReason/node_modules/ocaml/bin/ocamldep.opt -modules -pp refmt -impl src/Test.re | tee src/Test.re.depends > src/Test.ml.depends
env OCAMLC="ocamlc.opt" /Users/shane.logsdon/code/reason/HelloReason/node_modules/reason/_build/ocamlfind/bin/rec -c -I src -pp refmt -o src/Test.cmo -intf-suffix .rei -impl src/Test.re
env OCAMLOPT="ocamlopt.opt" /Users/shane.logsdon/code/reason/HelloReason/node_modules/reason/_build/ocamlfind/bin/reopt -c -I src -pp refmt -o src/Test.cmx -intf-suffix .rei -impl src/Test.re
env OCAMLOPT="ocamlopt.opt" /Users/shane.logsdon/code/reason/HelloReason/node_modules/reason/_build/ocamlfind/bin/reopt src/Test.cmx -o src/Test.native
✔ Seems fine!
ReasonProject@0.0.1 /Users/shane.logsdon/Code/reason/HelloReason
├─┬ @opam-alpha/merlin@2.5.1
│ └─┬ merlin-actual@2.5.1  (git://github.com/npm-opam/merlin.git#5b236062b3cceff3e653ba47283159cf6895a93b)
│   └─┬ @opam-alpha/yojson@1.3.3
│     └─┬ yojson-actual@1.3.3  (git://github.com/npm-opam/yojson.git#a72727dd8899c53153fd8a7cea06c626d0a71faf)
│       └─┬ @opam-alpha/biniou@1.0.12
│         └─┬ biniou-actual@1.0.12  (git://github.com/npm-opam/biniou.git#198ece6041aa0853bc1637475796840b3daae5a9)
│           └─┬ @opam-alpha/conf-which@1.0.0
│             └── conf-which-actual@1.0.0  (git://github.com/npm-opam/conf-which.git#0b798e035ea41e43744ff28075b15d1a5dc9ac99)
├─┬ @opam-alpha/ocaml@4.2.3
│ └── ocaml@4.2.3  (git+https://github.com/npm-opam/ocaml.git#0bb98be8e5233a02282ed8de0c8965677ddbde33)
├─┬ dependency-env@0.0.1
│ └── resolve@1.2.0
├── fastrealpath@0.1.1
├── nopam@0.1.0
└─┬ reason@1.4.0
  ├─┬ @opam-alpha/BetterErrors@0.0.1
  │ └─┬ BetterErrors-actual@0.0.1  (git://github.com/npm-opam/BetterErrors.git#3a8c29bb67089b4b615ced135f3bd608be0e5aa0)
  │   └─┬ @opam-alpha/ANSITerminal@0.7.0
  │     └── ANSITerminal-actual@0.7.0  (git://github.com/npm-opam/ANSITerminal.git#787c809f7b3e0d6445b803805f81a74a2af7b503)
  ├─┬ @opam-alpha/easy-format@1.2.0
  │ └── easy-format-actual@1.2.0  (git://github.com/npm-opam/easy-format.git#9a61ee2ca3cff40b50a36dc66dcb7761d096a451)
  ├─┬ @opam-alpha/menhir@20160825.0.0
  │ └─┬ menhir-actual@20160825.0.0  (git://github.com/npm-opam/menhir.git#8d6905e8eeb4bedcec501a14fdc7a7d950f85874)
  │   └── @opam-alpha/ocamlbuild@0.9.2
  ├─┬ @opam-alpha/merlin-extend@0.3.0
  │ └─┬ merlin-extend-actual@0.3.0  (git://github.com/npm-opam/merlin-extend.git#8d01d124db27f46a27e04f25d0e1c54bab0d0f48)
  │   └─┬ @opam-alpha/cppo@1.4.1
  │     └── cppo-actual@1.4.1  (git://github.com/npm-opam/cppo.git#f93baf17d8099c5866df939264ddddb6457aa7d2)
  ├─┬ @opam-alpha/ocamlfind@1.6.2
  │ └─┬ ocamlfind-actual@1.6.2  (git+https://github.com/npm-opam/ocamlfind.git#f6ea48c7628210d477ead863d32feba2357b9afe)
  │   └─┬ @opam-alpha/conf-m4@4.1.0
  │     └── conf-m4-actual@4.1.0  (git://github.com/npm-opam/conf-m4.git#75e353ae7ae97a988319ddb0e97ecfa25bce4739)
  ├─┬ @opam-alpha/re@1.7.1
  │ └── re-actual@1.7.1  (git://github.com/npm-opam/re.git#9da39424a8a4a12a768f90b1e5cc4401102b6834)
  ├── dependency-env@0.1.1  (git+https://github.com/reasonml/dependency-env.git#94c75aff3a71587afb570d89bcf2eef7996bb67f)
  ├── nopam@0.1.0  (git+https://github.com/reasonml/nopam.git#7cd19f068ac9aaf75010cd6961f7c65c779a1d4a)
  ├─┬ opam-installer-bin@0.0.0  (git+https://github.com/yunxing/opam-installer-bin.git#689ede681217f76fb2f82a9f4528e192a5b543ba)
  │ ├── dependency-env@0.1.1  (git+https://github.com/npm-ml/dependency-env.git#94c75aff3a71587afb570d89bcf2eef7996bb67f)
  │ └── nopam@0.1.0  (git+https://github.com/yunxing/nopam.git#7cd19f068ac9aaf75010cd6961f7c65c779a1d4a)
  ├── substs@0.0.1  (git+https://github.com/yunxing/substs.git#fd480dcdb4aed3fa9128fd819a546e3a7770040f)
  └─┬ utop-bin@1.19.2  (git+https://github.com/reasonml/utop-bin.git#5e9e322c1f264c0d9e8abb9f85e5472de1c8147d)
    ├── camomile-bin@0.8.5  (git+https://github.com/reasonml/camomile-bin.git#08f5d6115b76d46897af47b9ee8e70a55973b40f)
    ├─┬ lambda-term-bin@1.10.0  (git+https://github.com/reasonml/lambda-term-bin.git#72137b68f22af1fd2d1e52afbb02ff45b494908a)
    │ └── zed-bin@1.4.0  (git+https://github.com/reasonml/zed-bin.git#7d2f0677a4a73c1b51ecbf05589e1f7b5bd76705)
    ├── lwt-bin@2.5.2  (git+https://github.com/reasonml/lwt-bin.git#96859b56091d3b46d3c36e80522a137bb768fee5)
    └── react-bin@1.2.2  (git+https://github.com/reasonml/react-bin.git#b9868712a9e76af9de52e726912bdd99f9a66e87)
slogsdon commented 7 years ago

Attempting again from scratch with 4.04.0 sees the exact same result as before:

$ brew install opam
==> Installing dependencies for opam: ocaml, ocamlbuild, camlp4
==> Installing opam dependency: ocaml
==> Downloading https://homebrew.bintray.com/bottles/ocaml-4.04.0.el_capitan.bottle.tar.gz
Already downloaded: /Users/shane.logsdon/Library/Caches/Homebrew/ocaml-4.04.0.el_capitan.bottle.tar.gz
==> Pouring ocaml-4.04.0.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/ocaml/4.04.0: 1,730 files, 194.0M
==> Installing opam dependency: ocamlbuild
==> Downloading https://homebrew.bintray.com/bottles/ocamlbuild-0.9.3_1.el_capitan.bottle.tar.gz
Already downloaded: /Users/shane.logsdon/Library/Caches/Homebrew/ocamlbuild-0.9.3_1.el_capitan.bottle.tar.gz
==> Pouring ocamlbuild-0.9.3_1.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/ocamlbuild/0.9.3_1: 27 files, 6.9M
==> Installing opam dependency: camlp4
==> Downloading https://homebrew.bintray.com/bottles/camlp4-4.04+1.el_capitan.bottle.tar.gz
Already downloaded: /Users/shane.logsdon/Library/Caches/Homebrew/camlp4-4.04+1.el_capitan.bottle.tar.gz
==> Pouring camlp4-4.04+1.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/camlp4/4.04+1: 165 files, 143M
==> Installing opam
==> Downloading https://homebrew.bintray.com/bottles/opam-1.2.2_2.el_capitan.bottle.tar.gz
Already downloaded: /Users/shane.logsdon/Library/Caches/Homebrew/opam-1.2.2_2.el_capitan.bottle.tar.gz
==> Pouring opam-1.2.2_2.el_capitan.bottle.tar.gz
==> Caveats
OPAM uses ~/.opam by default for its package database, so you need to
initialize it first by running (as a normal user):

$  opam init

Run the following to initialize your environment variables:

$  eval `opam config env`

To export the needed variables every time, add them to your dotfiles.
  * On Bash, add them to `~/.bash_profile`.
  * On Zsh, add them to `~/.zprofile` or `~/.zshrc` instead.

Documentation and tutorials are available at https://opam.ocaml.org, or
via "man opam" and "opam --help".

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/opam/1.2.2_2: 30 files, 14.9M
$ opam init
Checking for available remotes: rsync and local, git, mercurial.
  - you won't be able to use darcs repositories unless you install the darcs command on your system.

=-=- Fetching repository information =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
[default] synchronized from https://opam.ocaml.org

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
∗  installed base-bigarray.base
∗  installed base-threads.base
∗  installed base-unix.base
Done.

In normal operation, OPAM only alters files within ~/.opam.

During this initialisation, you can allow OPAM to add information to two
other files for best results. You can also make these additions manually
if you wish.

If you agree, OPAM will modify:

  - ~/.zshrc (or a file you specify) to set the right environment
    variables and to load the auto-completion scripts for your shell (zsh)
    on startup. Specifically, it checks for and appends the following line:

    . /Users/shane.logsdon/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true

  - ~/.ocamlinit to ensure that non-system installations of `ocamlfind`
    (i.e. those installed by OPAM) will work correctly when running the
    OCaml toplevel. It does this by adding $OCAML_TOPLEVEL_PATH to the list
    of include directories.

If you choose to not configure your system now, you can either configure
OPAM manually (instructions will be displayed) or launch the automatic setup
later by running:

   opam config setup -a

Do you want OPAM to modify ~/.zshrc and ~/.ocamlinit?
(default is 'no', use 'f' to name a file other than ~/.zshrc)
    [N/y/f] y

User configuration:
  ~/.ocamlinit is already up-to-date.
  ~/.zshrc is already configured for another OPAM root.
Global configuration:
  Updating ~/.opam/opam-init/init.sh
  Updating ~/.opam/opam-init/init.zsh
  Updating ~/.opam/opam-init/init.csh
  Updating ~/.opam/opam-init/init.fish
# To setup the new switch in the current shell, you need to run:
eval `opam config env`
$ eval `opam config env`
$ cd ..
$ rm -rf HelloReason
$ git clone https://github.com/reasonml/ReasonProject HelloReason
$ cd HelloReason
$ npm install

Using opam switch 4.02.3 also corrects the issue.


Funny enough, installing 4.04.0 through Opam (with opam switch 4.04.0) works, so the issue seems to be caused by system installed OCaml 4.04.0.

jordwalke commented 7 years ago

Great repro documentation. esy and we're looking at making esy the standard way of building packages. But what can we do in the mean time to prevent this from happening (a quicker fix?)

slogsdon commented 7 years ago

I would say that updating the README would be a good start, letting users know to opam switch to a non-system version if they experience issues. Thoughts?

jordwalke commented 7 years ago

Updated the docs, and we are working on a legit fix to this issue. Thank you for reporting.

graforlock commented 7 years ago

+1 Same issue here.

jordwalke commented 7 years ago

Very close to getting big fix that prevents any global environment from even being perceived by the package install.