-
Notifications
You must be signed in to change notification settings - Fork 11
Home
These are the (most comprehensive) instructions to get a working OPAM setup.
These instructions are optimized towards compiling miTLS and F*.
- Open up a
cmd.exe
prompt, and make sure that typingbash
andtar
results in a'bash' is not recognized as an internal or external command
error. Ifcmd.exe
picks up any of these two programs, uninstall them. Possible culprits:- bash for windows (the new linux syscall emulation layer in windows 10)
- gnu on windows
- git for windows (comes with its own msys distribution)
- msys
- etc. etc.
-
If you already have cygwin installed: make sure it's cygwin64 (
uname -a
). -
If you already have cygwin installed: open up a cygwin terminal, and run
where ocaml
andwhere flexlink
. If you get anything at this stage, clean up. Possible culprits include:- cygwin packages for
ocaml
andflexdll
; remove these! - leftover Wodi setup
- leftover old OCaml setup (e.g. the old 3.11 installer, ocpwin, etc.)
- cygwin packages for
- Open up a
cmd.exe
prompt, and runset
. If you have any environment variable for OCaml (e.g.OCAMLLIB
), clean it up using your system properties → environment variables dialog.
Download and launch the installer from http://protz.github.io/ocaml-installer/; follow the setup instructions and make sure all of the packages below are installed.
Note: on Windows 8.1 and above, the OCaml installer will fail to launch Cygwin's setup.exe. In that case, launch it manually (it has been downloaded to your desktop).
Here's the list of packages you'll need (the installer doesn't pre-check all of them).
- wget
- make
- automake
- m4
- mingw64-x86_64-gcc-core
- mingw64-x86_64-pkg-config
- patch
- rlwrap
- libreadline
- diffutils
- unzip
- mingw64-x86_64-openssl
- mingw64-x86_64-sqlite3
- mingw64-x86_64-gmp
Run the second part of the sanity check again, to make sure you still have one ocaml
and one flexlink
binary.
Run opam init
, and decline to let it customize your ~/.bash_profile
. Instead, add the following to your ~/.bashrc
:
export CAML_LD_LIBRARY_PATH=$HOME/.opam/system/lib/stublibs:/cygdrive/c/OCaml/lib/stublibs
export MANPATH=$HOME/.opam/system/man:$MANPATH
export PATH=$HOME/.opam/system/bin:/usr/x86_64-w64-mingw32/sys-root/mingw/bin/:$PATH
Run source ~/.bashrc
in any (open) terminals to get the new (proper) environment.
opam install depext-cygwinports
Theoretically not needed now that the x86_64-mingw32-*
packages are in the mainstream Cygwin repo, but the special fixes in fdopen
's repository won't kick in until this is installed.
Run opam install zarith batteries stdint fileutils sqlite3
.
If opam
fails to install a package (e.g. sqlite3
), try again opam install sqlite3
.
- If OPAM complains that the system dependency on GMP cannot be found, and if you're positive that the cygwin package
mingw64-x86_64-gmp
is installed, then open the Cygwin terminal and fake the installation of OPAM package conf-gmp:
$ opam install --fake conf-gmp
- If, building miTLS, you get:
** Cannot resolve symbols for C:/cygwin/home/protz/.opam/system/lib/sqlite3\libsqlite3_stubs.a(sqlite3_stubs.o):
sqlite3_enable_load_extension
then:
opam remove sqlite3
export SQLITE3_DISABLE_LOADABLE_EXTENSIONS=1
opam install sqlite3
- OPAM pretends to call
curl
but really it's only callingwget
; make surewget
is installed - make sure your OCaml executable is the right one (
where ocaml
) - make sure
OCAMLLIB
is properly set using a Windows-style path (e.g.C:\OCaml\lib
). This is known to causeopam install sqlite3
to fail. - check the output of
ocamlopt -config
(should containnative_c_compiler: x86_64-w64-mingw32-gcc -O -mms-bitfields -Wall -Wno-unused
)
You can install opam install depext-cygwinports
, so that opam depext
is aware of Cygwin packages that need to be installed. But, this shouldn't be needed if you installed the right packages already.