Skip to content

Instantly share code, notes, and snippets.

@tenomoto
Last active August 22, 2019 02:48
Show Gist options
  • Save tenomoto/cc9c721fc12c21e84c17503f41d6d868 to your computer and use it in GitHub Desktop.
Save tenomoto/cc9c721fc12c21e84c17503f41d6d868 to your computer and use it in GitHub Desktop.
Install OCaml and Owl on FreeBSD

This gist describes steps to install the latest version of OCaml and Owl on FreeBSD. Tested with FreeBSD 12.0-RELEASE-p9 on Hyper-V/Windows 10 Pro 1903.

Install opam

Install opam as described How to install opan. EDIT the first line may not work. Install opam with pkg.

sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
opam init
eval $(opam env)
opam switch create 4.08.1
eval $(opam env)

Install dependencies

  • Install matrix libraries.
  • pkgconf (replaced from pkg-config in pkg) is needed to provide header and library paths during the build of Owl.
  • Install gcc9.
sudo pkg install cblas lapacke openblas pkgconf gcc9

Some tricks

  • Set CFLAGS to avoid a failure during configuration.
  • Create symbolic links of gcc and g++.
  • Copy openblas.pc where pkg-config (a symbolic link to pkgconf) can find (PKG_CONFIG_PATH).
  • Finally install Owl.
export CFLAGS="-I/usr/local/include -L/usr/local/lib -O2"
mkdir ~/bin
cd ~/bin
ln -s /usr/local/bin/gcc9 gcc
ln -s /usr/local/bin/g++9 g++
cp openblas.pc /usr/local/libdata/pkgconfig/
opam install owl
Name: openblas
Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version
Version: 0.2.20
URL: https://github.com/xianyi/OpenBLAS
Libs: -L/usr/local/lib -lopenblas
Libs.private:
Cflags: -I/usr/local/include
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment