Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghcide: remove redundant env NIX_GHC_LIBDIR #2819

Merged
merged 2 commits into from
May 23, 2022

Conversation

sloorush
Copy link
Contributor

@sloorush sloorush commented Apr 9, 2022

Copy link
Collaborator

@pepeiborra pepeiborra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you test this change? Does it work?

@sloorush
Copy link
Contributor Author

Hey @pepeiborra, I am unsure of how to test this manually. Could you please guide me on how to do it if needed?

I had run all the tests under the cabal test cmd, and all tests passed successfully. So I believe the change is working.

@pepeiborra
Copy link
Collaborator

To test this you would need to install Nix, set up a Nix shell environment for developing a Haskell project, start HLS from the Nix environment and check that it works as expected.

@sloorush
Copy link
Contributor Author

sloorush commented Apr 12, 2022

Hey @pepeiborra, I tried to set up the environment using nix, but when I try to build master(as well as this branch), I am facing this error.

version `GLIBC_2.34' not found

Upon searching for a fix, I found that version 2.34 is only available with the unstable channel of nix. I tried to run the nixos-unstable channel to install GLIBC 2.34, but the ldd version is still stuck on 2.33.

Is there any better way to encounter this issue?

@michaelpj
Copy link
Collaborator

Can you be more specific about what you're doing? e.g. here's what I get:

> nix develop
> cabal build
> ldd dist-newstyle/build/x86_64-linux/ghc-8.10.7/haskell-language-server-1.7.0.0/x/haskell-language-server/build/haskell-language-server/haskell-language-server | grep glibc
/bin/sh: /nix/store/yilda176cq33hbv240mqzkf6ks6r9b1p-ncurses-6.2/lib/libncursesw.so.6: no version information available (required by /nix/store/885av1bsnz5n4wk7ldy832bssad9isd2-readline-8.1p2/lib/libreadline.so.8)
        libpthread.so.0 => /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib/libpthread.so.0 (0x00007f578d105000)
        librt.so.1 => /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib/librt.so.1 (0x00007f578d06b000)
        libutil.so.1 => /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib/libutil.so.1 (0x00007f578d066000)
        libdl.so.2 => /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib/libdl.so.2 (0x00007f578d061000)
        libc.so.6 => /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib/libc.so.6 (0x00007f578cdf8000)
        libm.so.6 => /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib/libm.so.6 (0x00007f578ccb7000)
        /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib/ld-linux-x86-64.so.2 => /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib64/ld-linux-x86-64.so.2 (0x00007f57a527b000)

Which looks like it's linking to 2.33, and it runs fine. What do you get?

@sloorush
Copy link
Contributor Author

@michaelpj Here is what I get when I run the following commands

Terminal logs

❯ nix develop
warning: updating lock file '/home/rush/Desktop/oss/haskell-language-server/flake.lock':
• Updated input 'hie-bios':
    'https://hackage.haskell.org/package/hie-bios-0.9.0/hie-bios-0.9.0.tar.gz?narHash=sha256-nd+FfUQVZNxJfKZkAWA3dF0JwRgXntL+1gGvyNHDbKc=''https://hackage.haskell.org/package/hie-bios-0.9.1/hie-bios-0.9.1.tar.gz?narHash=sha256-5RqspT27rb%2ftMBwrKr4VfSSbq0+c0LMNuaKlTun0Kkk='
warning: Git tree '/home/rush/Desktop/oss/haskell-language-server' is dirty
nix-pre-commit-hooks: updating /home/rush/Desktop/oss/haskell-language-server repo
nix-pre-commit-hooks: WARNING: Refusing to install because of pre-existing .pre-commit-config.yaml
    1. Translate .pre-commit-config.yaml contents to the new syntax in your Nix file
        see https://github.com/hercules-ci/nix-pre-commit-hooks#getting-started
    2. remove .pre-commit-config.yaml
    3. add .pre-commit-config.yaml to .gitignore
[rush@rush haskell-language-server]$ cabal build
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - ghcide-1.6.0.1 (lib) (file /home/rush/Desktop/oss/haskell-language-server/dist-newstyle/build/x86_64-linux/ghc-8.10.7/hie-compat-0.2.1.1/cache/build changed)
 - hls-test-utils-1.2.0.0 (lib) (configuration changed)
 - hls-tactics-plugin-1.6.1.0 (lib) (configuration changed)
 - hls-stylish-haskell-plugin-1.0.1.0 (lib) (configuration changed)
 - hls-splice-plugin-1.0.1.0 (lib) (configuration changed)
 - hls-selection-range-plugin-1.0.0.0 (lib) (configuration changed)
 - hls-retrie-plugin-1.0.2.0 (lib) (configuration changed)
 - hls-rename-plugin-1.0.0.2 (lib) (configuration changed)
 - hls-qualify-imported-names-plugin-1.0.1.0 (lib) (configuration changed)
 - hls-pragmas-plugin-1.0.2.0 (lib) (configuration changed)
 - hls-ormolu-plugin-1.0.2.0 (lib) (configuration changed)
 - hls-module-name-plugin-1.0.1.0 (lib) (configuration changed)
 - hls-hlint-plugin-1.0.3.0 (lib) (configuration changed)
 - hls-haddock-comments-plugin-1.0.1.0 (lib) (configuration changed)
 - hls-fourmolu-plugin-1.0.2.0 (lib) (configuration changed)
 - hls-floskell-plugin-1.0.1.0 (lib) (configuration changed)
 - hls-explicit-imports-plugin-1.0.2.0 (lib) (configuration changed)
 - hls-eval-plugin-1.2.1.0 (lib) (configuration changed)
 - hls-class-plugin-1.0.2.0 (lib) (configuration changed)
 - hls-change-type-signature-plugin-1.0.1.0 (lib) (configuration changed)
 - hls-call-hierarchy-plugin-1.0.2.0 (lib) (configuration changed)
 - hls-brittany-plugin-1.0.2.0 (lib) (configuration changed)
 - hls-alternate-number-format-plugin-1.1.0.0 (lib) (configuration changed)
 - haskell-language-server-1.6.1.1 (lib) (configuration changed)
 - hls-refine-imports-plugin-1.0.1.0 (lib) (configuration changed)
 - haskell-language-server-1.6.1.1 (exe:haskell-language-server-wrapper) (configuration changed)
 - haskell-language-server-1.6.1.1 (exe:haskell-language-server) (configuration changed)
 - haskell-language-server-1.6.1.1 (test:wrapper-test) (configuration changed)
 - haskell-language-server-1.6.1.1 (test:func-test) (configuration changed)
Preprocessing library for ghcide-1.6.0.1..
Building library for ghcide-1.6.0.1..
[33 of 76] Compiling Development.IDE.Core.RuleTypes ( src/Development/IDE/Core/RuleTypes.hs, /home/rush/Desktop/oss/haskell-language-server/dist-newstyle/build/x86_64-linux/ghc-8.10.7/ghcide-1.6.0.1/build/Development/IDE/Core/RuleTypes.o, /home/rush/Desktop/oss/haskell-language-server/dist-newstyle/build/x86_64-linux/ghc-8.10.7/ghcide-1.6.0.1/build/Development/IDE/Core/RuleTypes.dyn_o ) [GHC changed]
<command line>: /nix/store/563528481rvhc5kxwipjmg6rqrl95mdx-glibc-2.33-56/lib/libc.so.6: version `GLIBC_2.34' not found (required by /home/rush/.cabal/store/ghc-8.10.7/direct-sqlite-2.3.26-818fd3d15f09228e80772b43db7c405bf637b666eb2b51d62d1a7122c473f6bb/lib/libHSdirect-sqlite-2.3.26-818fd3d15f09228e80772b43db7c405bf637b666eb2b51d62d1a7122c473f6bb-ghc8.10.7.so)
cabal: Failed to build ghcide-1.6.0.1 (which is required by test:wrapper-test
from haskell-language-server-1.6.1.1 and test:func-test from
haskell-language-server-1.6.1.1).

[rush@rush haskell-language-server]$ ldd dist-newstyle/build/x86_64-linux/ghc-8.10.7/haskell-language-server-1.7.0.0/x/haskell-language-server/build/haskell-language-server/haskell-language-server | grep glibc
/bin/sh: /nix/store/yilda176cq33hbv240mqzkf6ks6r9b1p-ncurses-6.2/lib/libncursesw.so.6: no version information available (required by /usr/lib/libreadline.so.8)
ldd: dist-newstyle/build/x86_64-linux/ghc-8.10.7/haskell-language-server-1.7.0.0/x/haskell-language-server/build/haskell-language-server/haskell-language-server: No such file or directory
[rush@rush haskell-language-server]$ ldd --version
/bin/sh: /nix/store/yilda176cq33hbv240mqzkf6ks6r9b1p-ncurses-6.2/lib/libncursesw.so.6: no version information available (required by /usr/lib/libreadline.so.8)
ldd (GNU libc) 2.33
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

@sloorush
Copy link
Contributor Author

Hey, I'm not sure what the issue was, but the codebase builds after I rebased the branch with the new changes, and it builds successfully now on nix as well.

Anything else I should test for the PR?

P.S. Sorry for the review request spam 😅

@sloorush sloorush requested a review from pepeiborra May 21, 2022 18:29
@pepeiborra
Copy link
Collaborator

Does the testsuite pass?

@sloorush
Copy link
Contributor Author

Does the testsuite pass?

Yes, all test cases pass

Terminal logs

[rush@rush haskell-language-server]$ cabal test
Build profile: -w ghc-9.0.2 -O1
In order, the following will be built (use -v for more details):
 - haskell-language-server-1.7.0.0 (test:func-test) (ephemeral targets)
 - haskell-language-server-1.7.0.0 (test:wrapper-test) (ephemeral targets)
Preprocessing test suite 'wrapper-test' for haskell-language-server-1.7.0.0..
Preprocessing test suite 'func-test' for haskell-language-server-1.7.0.0..
Building test suite 'wrapper-test' for haskell-language-server-1.7.0.0..
Building test suite 'func-test' for haskell-language-server-1.7.0.0..
Running 1 test suites...
Test suite wrapper-test: RUNNING...
haskell-language-server-wrapper
  --project-ghc-version
    stack with ghc 8.10.7:                    No 'hie.yaml' found. Try to discover the project type!
OK (1.86s)
    stack with ghc 8.8.4:                     No 'hie.yaml' found. Try to discover the project type!
Running 1 test suites...
Test suite func-test: RUNNING...
haskell-language-server
  commands
    are prefixed:                                                          OK (5.78s)
    cabal with global ghc:                    No 'hie.yaml' found. Try to discover the project type!
OK (18.54s)
    get de-prefixed:                                                       OK (18.89s)
  completions
    works:                                                                 OK (11.94s)
    itemCompletion/resolve works:                                          IGNORED
      no support for itemCompletion/resolve requests
    completes imports:                                                     OK (10.66s)
    completes qualified imports:                                           OK (11.88s)
    completes with no prefix:                                              OK (12.00s)
    strips compiler generated stuff from completions:                      OK (10.98s)
    have implicit foralls on basic polymorphic types:                      OK (11.76s)
    have implicit foralls with multiple type variables:                    OK (10.04s)
    maxCompletions:                                                        OK (9.53s)
    import function completions:                                           OK (9.79s)
    import second function completion:                                     OK (9.65s)
    contexts
      only provides type suggestions:                                      OK (10.08s)
      only provides value suggestions:                                     OK (11.06s)
      completes qualified type suggestions:                                OK (10.52s)
    snippets
      work for argumentless constructors:                                  OK (10.25s)
      work for polymorphic types:                                          OK (11.84s)
      work for complex types:                                              OK (11.51s)
      work for infix functions:                                            OK (11.43s)
      work for infix functions in backticks:                               OK (11.27s)
      work for qualified infix functions:                                  OK (10.93s)
      work for qualified infix functions in backticks:                     OK (11.04s)
      respects lsp configuration:                                          OK (31.06s)
    stack with existing cabal build artifact: No 'hie.yaml' found. Try to discover the project type!
2022-05-22T17:40:54.065508Z | Info | No log file specified; using stderr.
OK (2.97s)

All 4 tests passed (41.70s)
Test suite wrapper-test: PASS
Test suite logged to:
/home/rush/Desktop/oss/haskell-language-server/dist-newstyle/build/x86_64-linux/ghc-9.0.2/haskell-language-server-1.7.0.0/t/wrapper-test/test/haskell-language-server-1.7.0.0-wrapper-test.log
1 of 1 test suites (1 of 1 test cases) passed.
OK (11.04s)
      respects client capabilities:                                        OK (10.90s)
      works for record fields sharing the single signature:                OK (9.81s)
  plugin config
    config parsing
      empty object as user configuration should not send error logMessage: OK (12.15s)
  deferred responses
    instantly respond to failed modules with no cache:                     IGNORED
      Tests gets stuck in ci
    multiple main modules
      Can load one file at a time, when more than one Main module exists:  IGNORED
        Tests gets stuck in ci
  definitions
    goto's symbols:                                                        IGNORED
      Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/References.hs
    goto's imported modules:                                               IGNORED
      Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/Bar.hs
    goto's exported modules:                                               IGNORED
      Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/Bar.hs
    goto's imported modules that are loaded:                               IGNORED
      Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/Bar.hs
    goto's imported modules that are loaded, and then closed:              IGNORED
      Broken: file:///Users/jwindsor/src/haskell-language-server/test/testdata/Bar.hs
  diagnostics providers
    Diagnostics work
      example plugin produces diagnostics:                                 OK (4.22s)
    Warnings are warnings
      Overrides -Werror:                                                   OK (9.07s)
  format document
    works:                                                                 IGNORED
      Tests gets stuck in ci
    works with custom tab size:                                            IGNORED
      Tests gets stuck in ci
    format range
      works:                                                               IGNORED
        Tests gets stuck in ci
      works with custom tab size:                                          IGNORED
        Tests gets stuck in ci
    formatting provider
      respects none:                                                       IGNORED
        Tests gets stuck in ci
      can change on the fly:                                               IGNORED
        Tests gets stuck in ci
      supports both new and old configuration sections:                    IGNORED
        Tests gets stuck in ci
  behaviour on malformed projects
    no test executed:                                                      OK
  code actions
    import suggestions
      works with 3.8 code action kinds:                                    OK (17.56s)
    add package suggestions
      adds to .cabal files:                                                IGNORED
        no support for adding dependent packages via code action
      adds to hpack package.yaml files:                                    IGNORED
        no support for adding dependent packages via code action
    redundant import code actions
      remove solitary redundant imports:                                   OK (9.03s)
      doesn't touch other imports:                                         OK (8.82s)
    rename suggestions
      works:                                                               OK (18.53s)
      doesn't give both documentChanges and changes:                       OK (18.59s)
    missing top level signature code actions
      Adds top level signature:                                            OK (16.26s)
    typed hole code actions
      works:                                                               OK (17.17s)
      doesn't work when wingman is active:                                 OK (17.45s)
      shows more suggestions:                                              OK (18.22s)
      doesnt show more suggestions when wingman is active:                 OK (17.26s)
    unused term code actions
      Prefixes with '_':                                                   IGNORED
        no support for prefixing unused names with _
      respect 'only' parameter:                                            OK (17.30s)
  hie-bios
    loads modules inside main-is:                                          OK (3.33s)
    reports errors in hie.yaml:                                            OK (2.52s)
  highlight
    works:                                                                 OK (9.96s)
  window/workDoneProgress
    sends indefinite progress notifications:                               IGNORED
      Tests gets stuck in ci
    eval plugin sends progress reports:                                    IGNORED
      Tests gets stuck in ci
    ormolu plugin sends progress notifications:                            IGNORED
      Tests gets stuck in ci
    fourmolu plugin sends progress notifications:                          IGNORED
      Tests gets stuck in ci
  references
    works with definitions:                                                IGNORED
      Broken
  document symbols
    pre 3.10 symbol information
      provides nested data types and constructors:                         IGNORED
        Tests gets stuck in ci
      provides nested where functions:                                     IGNORED
        Tests gets stuck in ci
      provides pattern synonyms:                                           IGNORED
        Tests gets stuck in ci
      provides imports:                                                    IGNORED
        Tests gets stuck in ci
    3.10 hierarchical document symbols
      provides nested data types and constructors:                         IGNORED
        Tests gets stuck in ci
      provides nested where functions:                                     IGNORED
        Tests gets stuck in ci
      provides pattern synonyms:                                           IGNORED
        Tests gets stuck in ci
      provides imports:                                                    IGNORED
        Tests gets stuck in ci
  type definitions
    finds local definition of record variable:                             OK (4.61s)
    finds local definition of newtype variable:                            OK (4.72s)
    finds local definition of sum type variable:                           OK (4.09s)
    finds local definition of sum type constructor:                        OK (4.51s)
    finds non-local definition of type def:                                OK (4.17s)
    find local definition of type def:                                     OK (3.93s)
    find type-definition of type def in component:                         OK (3.54s)
    find definition of parameterized data type:                            OK (2.83s)

All 82 tests passed (68.66s)
Test suite func-test: PASS
Test suite logged to:
/home/rush/Desktop/oss/haskell-language-server/dist-newstyle/build/x86_64-linux/ghc-9.0.2/haskell-language-server-1.7.0.0/t/func-test/test/haskell-language-server-1.7.0.0-func-test.log
1 of 1 test suites (1 of 1 test cases) passed.

@michaelpj michaelpj merged commit 9b3f3bf into haskell:master May 23, 2022
hololeap pushed a commit to hololeap/haskell-language-server that referenced this pull request Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove use of NIX_GHC_LIBDIR in ghcide
3 participants