diff --git a/.circleci/config.yml b/.circleci/config.yml index 2aa882b02..645d1f37e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,49 +95,76 @@ defaults: &defaults version: 2 jobs: - ghc-8.0.2: - environment: - - STACK_FILE: "stack-8.0.2.yaml" - <<: *defaults - ghc-8.2.1: environment: - STACK_FILE: "stack-8.2.1.yaml" + persist_to_workspace: + root: .stack-work + paths: + - install/*/*/8.2.1 <<: *defaults ghc-8.2.2: environment: - STACK_FILE: "stack-8.2.2.yaml" + persist_to_workspace: + root: .stack-work + paths: + - install/*/*/8.2.2 <<: *defaults ghc-8.4.2: environment: - STACK_FILE: "stack-8.4.2.yaml" + persist_to_workspace: + root: .stack-work + paths: + - install/*/*/8.4.2 <<: *defaults ghc-8.4.3: environment: - STACK_FILE: "stack-8.4.3.yaml" + persist_to_workspace: + root: .stack-work + paths: + - install/*/*/8.4.3 <<: *defaults ghc-8.4.4: environment: - STACK_FILE: "stack-8.4.4.yaml" + persist_to_workspace: + root: .stack-work + paths: + - install/*/*/8.4.4 <<: *defaults ghc-8.6.1: environment: - STACK_FILE: "stack-8.6.1.yaml" + persist_to_workspace: + root: .stack-work + paths: + - install/*/*/8.6.1 <<: *defaults ghc-8.6.2: environment: - STACK_FILE: "stack-8.6.2.yaml" + persist_to_workspace: + root: .stack-work + paths: + - install/*/*/8.6.2 <<: *defaults ghc-8.6.3: environment: - STACK_FILE: "stack-8.6.3.yaml" + persist_to_workspace: + root: .stack-work + paths: + - install/*/*/8.6.3 <<: *defaults ghc-nightly: @@ -148,8 +175,7 @@ jobs: cabal: working_directory: ~/build docker: - # - image: quay.io/haskell_works/ghc-8.4.3 - - image: quay.io/haskell_works/ghc-8.6.1 + - image: alanz/haskell-hie-ci steps: - checkout - run: @@ -178,6 +204,24 @@ jobs: paths: - ~/.cabal + shakefile: + docker: + - image: fpco/stack-build + steps: + - checkout # don't checkout submodules: Shakefile.hs should take care of that + - attach_workspace: + at: .stack-work + - run: ./Shakefile.hs build-all + - run: hie-wrapper --version + - run: hie-8.6.3 --version + - run: hie-8.6.2 --version + - run: hie-8.6.1 --version + - run: hie-8.4.4 --version + - run: hie-8.4.3 --version + - run: hie-8.4.2 --version + - run: hie-8.2.3 --version + - run: hie-8.2.2 --version + workflows: version: 2 @@ -193,3 +237,13 @@ workflows: - ghc-8.6.3 - ghc-nightly - cabal + - shakefile: + requires: + - ghc-8.2.1 + - ghc-8.2.2 + - ghc-8.4.2 + - ghc-8.4.3 + - ghc-8.4.4 + - ghc-8.6.1 + - ghc-8.6.2 + - ghc-8.6.3 diff --git a/README.md b/README.md index b323723f5..53238d36b 100644 --- a/README.md +++ b/README.md @@ -99,169 +99,55 @@ we talk to clients.__ ## Installation -### Installation with stack on Linux - -To install HIE, you need stack version >= 1.7.1. - -HIE builds from source code, so there's a couple of extra steps. - -#### Linux pre-requirements - -On Linux you will need install a couple of extra libraries (for Unicode ([ICU](http://site.icu-project.org/)) and [NCURSES](https://www.gnu.org/software/ncurses/)): - -**Debian/Ubuntu**: - -```bash -sudo apt install libicu-dev libtinfo-dev libgmp-dev -``` -**Fedora**: - -```bash -sudo dnf install libicu-devel ncurses-devel -``` -**ArchLinux**: see [below](#installation-on-archlinux). - -#### Download the source code - -```bash -git clone https://github.com/haskell/haskell-ide-engine --recursive -cd haskell-ide-engine -``` - -In order to support both stack and cabal, HIE requires `cabal-install` -as well. If it is not already installed, install it and update its package list: - -```bash -stack install cabal-install -cabal update -``` - -#### Choose your GHC version - -The GHC version you are going to install HIE for depends on which version of GHC you are using for your project. If you don't have a current project there are two potential options: - -1. The Nightly GHC version ([currently](https://www.stackage.org/nightly) 8.6.3) -2. The LTS GHC version (which is [currently](https://www.stackage.org/lts) 8.4.4) - -By default in a stack project you will get the LTS version. +### Installation on macOS -You can check which version of ghc you are using in your project by running the following at the root of your project: +Download the pre-built binaries from the [releases page](https://github.com/haskell/haskell-ide-engine/releases), and copy/symlink them into `/usr/local/bin` (or somewhere else in your $PATH): ```bash -stack ghc -- --version +ln -s hie-bin-dir/hie* /usr/local/bin/ ``` -You can install an specific version or [all available GHC versions](#install-all-available-ghc-versions). - -#### Install a specific GHC version 8.2.1 - 8.6.3 - -We will use the `make` tools here to wrap `stack install`. The preferred installation mechanism is via `make`, as it makes sure the repo is synced, installs the required cabal libraries if missing, and makes copies of the executables with suffixes to be able to tell them apart. - -Install **Nightly** (and hoogle docs): - -```bash -make hie-8.6.3 -make build-doc-8.6.3 -``` +Alternatively, you can install from source. See instructions below -Install **LTS** (and hoogle docs): +### Installation with Nix -```bash -make hie-8.4.4 -make build-doc-8.4.4 -``` +Follow the instructions at https://github.com/domenkozar/hie-nix -This step can take more than 30 minutes, so grab a coffee and please be patient! -The available versions depend on the `stack-*.yaml` config files in the `haskell-ide-engine` directory. +### Installation on ArchLinux -#### For GHC 8.0.2 +An [haskell-ide-engine-git](https://aur.archlinux.org/packages/haskell-ide-engine-git/) package is available on the AUR. -This is no longer supported on the HIE `master` branch, so you must switch to the `hie-0.1.0.0` branch: +Using [Aura](https://github.com/aurapm/aura): -```bash -git checkout hie-0.1.0.0 -git submodule update --init ``` -Then you can run `stack install`: - -```bash -stack --stack-yaml=stack-8.0.2.yaml install +# aura -A haskell-ide-engine-git ``` -#### Install *all* available GHC versions - -This is the simplest approach as it will install all GHC versions to match against any project versions you might have. - -*Warning*: Requires 20+ GB of space and potentially more than 2 hours to install, so please be patient! - -This will: - -* install all supported GHC versions (8.2.1 - 8.6.3) -* name them as expected by the VS Code plugin -* build local hoogle docs for each version - -For this you need the `make` tool (on Windows, see the further advice below). Use the command: -```bash -make build-all -``` - -Then add +### Installation from source -```json -"languageServerHaskell.useCustomHieWrapper": true, -"languageServerHaskell.useCustomHieWrapperPath": "hie-wrapper", -``` +To install HIE, you need stack version >= 1.7.1. -to VS Code user settings. +HIE builds from source code, so there's a couple of extra steps. -### Installation with stack on Windows +#### Linux pre-requirements -To install HIE, you need stack version >= 1.7.1. +On Linux you will need install a couple of extra libraries (for Unicode ([ICU](http://site.icu-project.org/)) and [NCURSES](https://www.gnu.org/software/ncurses/)): -#### Download the source code +**Debian/Ubuntu**: ```bash -git clone https://github.com/haskell/haskell-ide-engine --recursive -cd haskell-ide-engine +sudo apt install libicu-dev libtinfo-dev libgmp-dev ``` - -In order to support both stack and cabal, HIE requires `cabal-install` -as well. If it is not already installed, install it and update its package list: +**Fedora**: ```bash -stack install cabal-install -cabal update -``` - -#### Install *all* available GHC versions - -*Warning*: Requires 20+ GB of space and potentially more than 2 hours to install, so please be patient! - -This will: - -* install all supported GHC versions (8.2.1 - 8.6.3) -* name them as expected by the VS Code plugin -* build local hoogle docs for each version - -`make` doesn't work on Windows due to several UNIX-specific things, such -as the `cp` command or extensionless executable names. Instead, a PowerShell -script is provided specifically for this purpose: - -**PowerShell:** - -``` -./build-all.ps1 -``` - -**cmd.exe:** - -``` -powershell -ExecutionPolicy RemoteSigned -c ./build-all.ps1 +sudo dnf install libicu-devel ncurses-devel ``` +**ArchLinux**: see [below](#installation-on-archlinux). -#### Long paths +#### Windows: long paths (optional) In order to avoid problems with long paths on Windows you can do the following: @@ -271,83 +157,51 @@ In order to avoid problems with long paths on Windows you can do the following: 2. Clone the `haskell-ide-engine` to the root of your logical drive (e.g. to `C:\hie`) -### Installation on macOS - -Download the pre-built binaries from the [releases page](https://github.com/haskell/haskell-ide-engine/releases), and copy/symlink them into `/usr/local/bin` (or somewhere else in your $PATH): +#### Download the source code ```bash -ln -s hie-bin-dir/hie* /usr/local/bin/ +git clone https://github.com/haskell/haskell-ide-engine --recursive +cd haskell-ide-engine ``` -Alternatively, you can install from source with `make build` or `make build-all`. +#### Choose your GHC version -#### DYLD on macOS +The GHC version you are going to install HIE for depends on which version of GHC you are using for your project. If you don't have a current project there are two potential options: -If you hit a problem that looks like ```can't load .so/.DLL for: libiconv.dylib (dlopen(libiconv.dylib, 5): image not found)```, it means that libraries cannot be found in the library path. We can hint where to look for them and append more paths to `DYLD_LIBRARY_PATH`. +1. The Nightly GHC version ([currently](https://www.stackage.org/nightly) 8.6.3) +2. The LTS GHC version (which is [currently](https://www.stackage.org/lts) 8.4.4) -``` -export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/lib:/usr/local/lib" -``` +By default in a stack project you will get the LTS version. -On practice `/usr/local/lib` is full of dylibs linked by `brew`. After you amend `DYLD_LIBRARY_PATH`, some of the previously compiled application might not work and yell about incorrect linking, for example, `dyld: Symbol not found: __cg_jpeg_resync_to_restart`. You may need to look up where it comes from and remove clashing links, in this case it were clashing images libs: +You can check which version of ghc you are using in your project by running the following at the root of your project: -```sh -$ brew unlink libjpeg -$ brew unlink libtiff -$ brew unlink libpng +```bash +stack ghc -- --version ``` -Recompile. - -### Installation with Nix - -Follow the instructions at https://github.com/domenkozar/hie-nix - - -### Installation on ArchLinux - -An [haskell-ide-engine-git](https://aur.archlinux.org/packages/haskell-ide-engine-git/) package is available on the AUR. - -Using [Aura](https://github.com/aurapm/aura): - -``` -# aura -A haskell-ide-engine-git -``` +You can install an specific version or [all available GHC versions](#install-all-available-ghc-versions). -### Installation with Shake +#### Install HIE for projects with GHC >= 8.2.1 -Experimental build script for HIE. Feedback is appreciated. Uses the [shake](https://shakebuild.com/) build system for predictable builds. -The build script is platform independent and the only prerequisites are that `git` and `stack` are installed. The dependency on `make` and other linux specific commands has been dropped. +The build script itself is platform independent and the only prerequisites are that `git` and `stack` are installed. Note, on first invocation of the build script, a GHC is being installed for execution. However, if you build HIE for every GHC, no GHC is downloaded twice. The GHC used for the `Shakefile.hs` can be adjusted in `shake.yaml` by using a different resolver. -Available commands can be seen with: +To build and install HIE for chosen GHC X.Y.Z version use command: ```bash -stack ./Shakefile.hs help +stack ./Shakefile.hs hie-X.Y.Z ``` -Remember, this will take time to download a Stackage-LTS and an appropriate GHC. However, afterwards all commands should work as expected. - -#### Install specific GHC Version with Shake - -Install **Nightly** (and hoogle docs): +All available commands can be seen with: ```bash -stack ./Shakefile.hs hie-8.6.3 -stack ./Shakefile.hs build-doc-8.6.3 -``` - -Install **LTS** (and hoogle docs): - -```bash -stack ./Shakefile.hs hie-8.4.4 -stack ./Shakefile.hs build-doc-8.4.4 +stack ./Shakefile.hs help ``` -#### Install *all* available GHC versions with Shake +#### Install *all* available GHC versions *Warning*: Requires 20+ GB of space and potentially more than 2 hours to install, so please be patient! @@ -370,6 +224,20 @@ Then add to VS Code user settings. +#### For GHC 8.0.2 + +This is no longer supported on the HIE `master` branch, so you must switch to the `hie-0.1.0.0` branch: + +```bash +git checkout hie-0.1.0.0 +git submodule update --init +``` +Then you can run `stack install`: + +```bash +stack --stack-yaml=stack-8.0.2.yaml install +``` + ## Configuration There are some settings that can be configured via a `settings.json` file: @@ -687,6 +555,24 @@ All the documentation is in [the docs folder](/docs) at the root of this project ## Troubleshooting +### DYLD on macOS + +If you hit a problem that looks like ```can't load .so/.DLL for: libiconv.dylib (dlopen(libiconv.dylib, 5): image not found)```, it means that libraries cannot be found in the library path. We can hint where to look for them and append more paths to `DYLD_LIBRARY_PATH`. + +``` +export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/lib:/usr/local/lib" +``` + +On practice `/usr/local/lib` is full of dylibs linked by `brew`. After you amend `DYLD_LIBRARY_PATH`, some of the previously compiled application might not work and yell about incorrect linking, for example, `dyld: Symbol not found: __cg_jpeg_resync_to_restart`. You may need to look up where it comes from and remove clashing links, in this case it were clashing images libs: + +```sh +$ brew unlink libjpeg +$ brew unlink libtiff +$ brew unlink libpng +``` + +Recompile. + ### macOS: Got error while installing GHC 8.6.1 or 8.6.2 - dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib These builds have a dependency on [homebrew](https://brew.sh)'s `gmp` library. Install with brew: `brew install gmp`.