I'm following the install procedure at https://reasonml.github.io/docs/en/installation. (The MacOs CLI tools provided by Xcode have been installed.) The specified commands to install Reason and run a hello world test are:
npm install -g esy
git clone https://github.com/esy-ocaml/hello-reason.git
cd hello-reason
esy
esy x Hello
The 4th step (the "esy" command fails with the following output:
info esy 0.6.12 (using package.json)
info fetching: done
info installing: done
info building @esy-ocaml/[email protected]@d41d8cd9
info building [email protected]@d41d8cd9
info building @esy-ocaml/[email protected]@d41d8cd9: done
info building @opam/base-unix@opam:base@87d0b2eb
info building @opam/base-threads@opam:base@36803084
info building @opam/base-threads@opam:base@36803084: done
info building @opam/base-unix@opam:base@87d0b2eb: done
error: build failed with exit code: 1
build log:
# esy-build-package: building: [email protected]
# esy-build-package: pwd: /Users/sbeisner/.esy/3/b/ocaml-4.12.0-44d44425
# esy-build-package: running: './esy-configure' '--disable-cfi' '--prefix' '/Users/sbeisner/.esy/3_______________________________________________________________/s/ocaml-4.12.0-44d44425'
[esy-configure] Detected OSX / Linux environment
configure: Configuring OCaml version 4.12.0
checking build system type... x86_64-apple-darwin20.6.0
checking host system type... x86_64-apple-darwin20.6.0
checking target system type... x86_64-apple-darwin20.6.0
checking for ld... ld
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/sbeisner/.esy/3/b/ocaml-4.12.0-44d44425':
configure: error: C compiler cannot create executables
See `config.log' for more details
error: command failed: './esy-configure' '--disable-cfi' '--prefix' '/Users/sbeisner/.esy/3_______________________________________________________________/s/ocaml-4.12.0-44d44425' (exited with 77)
esy-build-package: exiting with errors above...
building [email protected]
esy: exiting due to errors above
I can see that the C compiler is present:
gcc --version
reports:
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Can someone point me to what I'm missing or overlooking? Thanks.
UPDATED:
I found that the problem above is due to the fact that Apple symbolically links "gcc" to the clang compiler that Apple distributes. (An incredibly irresponsible idea!) After installing the real gcc (via homebrew) most of the build kicked off by the "esy" command runs OK, UNTIL, (near the end?) it get errors trying to create files in /var/folders/mt/.....
So I'm stuck again. It appears, based on the kinds of errors above that the standard install procedure has not been tested on MacOS. Disappointing!!!
Please, if you have successfully installed Reason on MacOs, please let me know how you did it? Thanks!