Skip to content

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

License

Notifications You must be signed in to change notification settings

shin-sakata/ghc-single-binary-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published