shin-sakata / ghc-single-binary-builder

This repository provides an easy way to build a single statically linked binary that does not depend on glibc or other shared libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GHC Single-Binary builder

This repository provides an easy way to build a single statically linked binary that does not depend on Glibc or other shared libraries.

Currently, only GHC 8.10.1 is supported.

The advantage is that anyone can easily add dependent libraries by not using long, time-consuming GHC builds or unfamiliar nix hacks

GitHub

shin-sakata/ghc-single-binary-builder

Docker Hub

shinsakata/ghc-single-binary-builder

Usage

Stack

  1. Change resolver in stack.yaml

Use one of the resolvers where ghc8.10.1 is used

resolver: ghc-8.10.1 
# or resolver: nightly-2020-07-12
  1. Add the following to stack.yaml
docker:
    enable: true
    repo: shinsakata/ghc-single-binary-builder:ghc8.10.1-v1.1.0
  1. Add options to package.yaml
executables:
  stack-minimum-example-exe:
    main:                Main.hs
    source-dirs:         app
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    - -static -optl-static -optl-pthread -fPIC # <- Add options here.
    dependencies:
    - stack-minimum-example
  1. Get the binary

Execute the following command.

$ stack install --local-bin-path=./bin

A single binary will be built in ./bin/.

About

This repository provides an easy way to build a single statically linked binary that does not depend on glibc or other shared libraries.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Dockerfile 44.9%Language:Makefile 33.0%Language:Haskell 22.1%