Created
February 13, 2020 10:39
-
-
Save abhijat/4a4a2a1223db0ee75489cb26c59a674a to your computer and use it in GitHub Desktop.
Setting up opam with musl-libc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are a few steps to be followed when setting up opam to use musl-libc. | |
1. Install musl-tools - this adds the wrapper musl-gcc to the system. | |
2. export CC=musl-gcc | |
3. Any supporting C libraries will need to be compiled with musl and installed in a special prefix, eg | |
apt-get source libgmp-dev # get the source for libgmp | |
CC=musl-gcc ./configure --prefix=/usr/local/musl # make sure the libs and headers are compiled with the right compiler and end up in a special path | |
4. Export the following variables to make sure opam finds them | |
export CC=musl-cc | |
export C_INCLUDE_PATH=/usr/local/musl/include:.... # add whatever extra paths may be needed here | |
export LIBRARY_PATH=/usr/local/musl/lib | |
5. Install opam, create its switch: | |
opam switch create 4.08.1+musl+static+flambda -v | |
Note: its a good idea to also set | |
export OPAMEXTERNALSOLVER=mccs | |
as the default resolver can fail | |
6. switch over to the opam env | |
eval `opam env` | |
7. Now install using opam install etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment