Skip to content

Template Haskell: ByteCodeLink.lookupCE During interactive linking, GHCi couldn't find the following symbol #1024

Closed
haskell/ghcide
#410

Description

@ocharles

The new Template Haskell support seems to get further at work, now failing with:

ghcide version: 0.0.5 (GHC: 8.8.1)
Ghcide setup tester in /home/ollie/work/circuithub.
Report bugs at https://github.com/digital-asset/ghcide/issues

Step 1/6: Finding files to test in /home/ollie/work/circuithub
Found 1 files

Step 2/6: Looking for hie.yaml files that control setup
Found 1 cradle

Step 3/6, Cradle 1/1: Loading ./hie.yaml

Step 4/6, Cradle 1/1: Loading GHC Session

Step 5/6: Initializing the IDE

Step 6/6: Type checking the files
ghcide: ^^ Could not load 'filepickerzmpolicyzm0zi2zi6zmLUnJDYkanFc1p7RlDh5zzSr_NetworkziFilepickerziHandle_FilepickerHandle_closure', dependency unresolved. See top entry above.

File:     entities/Model/Common.hs
Range:    1:0-100001:0
Source:   typecheck
Severity: DsError
Message: 
  Program error:
  ByteCodeLink.lookupCE
  During interactive linking, GHCi couldn't find the following symbol:
  filepickerzmpolicyzm0zi2zi6zmLUnJDYkanFc1p7RlDh5zzSr_NetworkziFilepickerziHandle_FilepickerHandle_closure
  This may be due to you not asking GHCi to load extra object files,
  archives or DLLs needed by your current session. Restart GHCi, specifying
  the missing library using the -L/path/to/object/dir and -lmissinglibname
  flags, or simply by naming the relevant files on the GHCi command line.
  Alternatively, this link failure might indicate a bug in GHCi.
  If you suspect the latter, please send a bug report to:
  [email protected]
ghcide: ^^ Could not load 'OctopartV3ziTypesziCore_Uid_closure', dependency unresolved. See top entry above.

File:     entities/Model/OctopartV3.hs
Range:    1:0-100001:0
Source:   typecheck
Severity: DsError
Message: 
  Program error:
  ByteCodeLink.lookupCE
  During interactive linking, GHCi couldn't find the following symbol:
  OctopartV3ziTypesziCore_Uid_closure
  This may be due to you not asking GHCi to load extra object files,
  archives or DLLs needed by your current session. Restart GHCi, specifying
  the missing library using the -L/path/to/object/dir and -lmissinglibname
  flags, or simply by naming the relevant files on the GHCi command line.
  Alternatively, this link failure might indicate a bug in GHCi.
  If you suspect the latter, please send a bug report to:
  [email protected]
ghcide: ^^ Could not load 'filepickerzmpolicyzm0zi2zi6zmLUnJDYkanFc1p7RlDh5zzSr_NetworkziFilepickerziHandle_FilepickerHandle_closure', dependency unresolved. See top entry above.

File:     entities/Model/User.hs
Range:    1:0-100001:0
Source:   typecheck
Severity: DsError
Message: 
  Program error:
  ByteCodeLink.lookupCE
  During interactive linking, GHCi couldn't find the following symbol:
  filepickerzmpolicyzm0zi2zi6zmLUnJDYkanFc1p7RlDh5zzSr_NetworkziFilepickerziHandle_FilepickerHandle_closure
  This may be due to you not asking GHCi to load extra object files,
  archives or DLLs needed by your current session. Restart GHCi, specifying
  the missing library using the -L/path/to/object/dir and -lmissinglibname
  flags, or simply by naming the relevant files on the GHCi command line.
  Alternatively, this link failure might indicate a bug in GHCi.
  If you suspect the latter, please send a bug report to:
  [email protected]
Files that failed:
 * api/src/Daemon/Notification/Consignment.hs

My hie.yaml is:

cradle:
  direct:
    arguments:
      - -Wall
      - -fno-warn-orphans
      - -hide-package resource-pool
      - -hide-package servant-checked-exceptions-core
      - -ich-aws/lib
      - -ich-eda/src
      - -ich-linear/lib
      - -ich-model/lib
      - -ich-persistence/src
      - -ich-segment/lib
      - -ich-servant-auth/lib
      - -ich-stripe/lib
      - -ich-wai-extra/lib
      - -idaemons/ch-shipment-tracking/src
      - -idaemons/ch-sync-mycronic-events/lib
      - -idaemons/ch-sync-trays/lib
      - -ieffects/hedis-simple-effects/lib
      - -ieffects/http-client-simple-effects/lib
      - -ientities
      - -iex-pool-prometheus/lib
      - -imouse-proxy/shared
      - -ioctopart
      - -ipicofactory/aoi/lib
      - -ipicofactory/coordinator/lib
      - -ipicofactory/jpctl/src
      - -ipicofactory/linescan-image-archiver/src
      - -ipicofactory/my300/src
      - -ipicofactory/panelisation/lib
      - -ipicofactory/ur10/lib
      - -ipicofactory/ur10/src-lib
      - -iprelude
      - -iquoting/lib
      - -package-env - # so that .ghci-environment.* generated by cabal is not used

The z-encoded name in question comes from something that is in my package database, as witnessed by:

$ ghc-pkg dump | grep Network.Filepicker.Handle
Network.Filepicker.Handle Network.Filepicker.Policy

Activity

  1. ocharles commented on Dec 16, 2019

    @ocharles
    ContributorAuthor

    Interestingly, even if I -i the source code of this module, I still get the same error - though I can see ghcide compiling the whole package as expected:

    ghcide version: 0.0.5 (GHC: 8.8.1)
    Ghcide setup tester in /home/ollie/work/circuithub.
    Report bugs at https://github.com/digital-asset/ghcide/issues
    
    Step 1/6: Finding files to test in /home/ollie/work/circuithub
    Found 1 files
    
    Step 2/6: Looking for hie.yaml files that control setup
    Found 1 cradle
    
    Step 3/6, Cradle 1/1: Loading ./hie.yaml
    
    Step 4/6, Cradle 1/1: Loading GHC Session
    
    Step 5/6: Initializing the IDE
    
    Step 6/6: Type checking the files
    File:     haskell-filepicker-policy/Network/Filepicker/Handle.hs
    Range:    7:0-7:40
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Handle.hs:7:1: warning:
      The qualified import of ‘Data.ByteString’ is redundant
      except perhaps to import instances from ‘Data.ByteString’
      To import instances alone, use: import Data.ByteString()
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    22:0-22:48
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:22:1: warning:
      The qualified import of ‘Data.Aeson.Types’ is redundant
      except perhaps to import instances from ‘Data.Aeson.Types’
      To import instances alone, use: import Data.Aeson.Types()
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    23:0-23:53
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:23:1: warning:
      The import of ‘Data.ByteArray’ is redundant
      except perhaps to import instances from ‘Data.ByteArray’
      To import instances alone, use: import Data.ByteArray()
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    31:0-31:27
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:31:1: warning:
      The import of ‘Data.Maybe’ is redundant
      except perhaps to import instances from ‘Data.Maybe’
      To import instances alone, use: import Data.Maybe()
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    32:0-32:28
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:32:1: warning:
      The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
      To import instances alone, use: import Data.Monoid()
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    36:0-36:48
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:36:1: warning:
      The qualified import of ‘Data.Text’ is redundant
      except perhaps to import instances from ‘Data.Text’
      To import instances alone, use: import Data.Text()
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    43:0-43:28
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:43:1: warning:
      The import of ‘Debug.Trace’ is redundant
      except perhaps to import instances from ‘Debug.Trace’
      To import instances alone, use: import Debug.Trace()
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    71:0-71:10
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:71:1: warning:
      Defined but not used: ‘setMaxSize’
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    75:0-75:10
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:75:1: warning:
      Defined but not used: ‘setMinSize’
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    79:0-79:7
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:79:1: warning:
      Defined but not used: ‘setPath’
    File:     haskell-filepicker-policy/Network/Filepicker/Policy.hs
    Range:    83:0-83:12
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/Policy.hs:83:1: warning:
      Defined but not used: ‘setContainer’
    File:     haskell-filepicker-policy/Network/Filepicker/URL.hs
    Range:    23:0-23:49
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/URL.hs:23:1: warning:
      The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
      To import instances alone, use: import Data.Monoid()
    File:     haskell-filepicker-policy/Network/Filepicker/URL.hs
    Range:    25:0-25:47
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/URL.hs:25:1: warning:
      The qualified import of ‘Data.Text’ is redundant
      except perhaps to import instances from ‘Data.Text’
      To import instances alone, use: import Data.Text()
    File:     haskell-filepicker-policy/Network/Filepicker/URL.hs
    Range:    54:14-54:20
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/URL.hs:54:15: warning:
      This binding for ‘handle’ shadows the existing binding
      imported from ‘Network.Filepicker.Policy’ at
      haskell-filepicker-policy/Network/Filepicker/URL.hs:28:1-42
      (and originally defined
      at haskell-filepicker-policy/Network/Filepicker/Policy.hs:50:5-10)
    File:     haskell-filepicker-policy/Network/Filepicker/URL.hs
    Range:    57:34-57:40
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/URL.hs:57:35: warning:
      This binding for ‘handle’ shadows the existing binding
      imported from ‘Network.Filepicker.Policy’ at
      haskell-filepicker-policy/Network/Filepicker/URL.hs:28:1-42
      (and originally defined
      at haskell-filepicker-policy/Network/Filepicker/Policy.hs:50:5-10)
    File:     haskell-filepicker-policy/Network/Filepicker/URL.hs
    Range:    64:26-64:32
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/URL.hs:64:27: warning:
      This binding for ‘handle’ shadows the existing binding
      imported from ‘Network.Filepicker.Policy’ at
      haskell-filepicker-policy/Network/Filepicker/URL.hs:28:1-42
      (and originally defined
      at haskell-filepicker-policy/Network/Filepicker/Policy.hs:50:5-10)
    File:     haskell-filepicker-policy/Network/Filepicker/URL.hs
    Range:    74:46-74:52
    Source:   typecheck
    Severity: DsWarning
    Message: 
      haskell-filepicker-policy/Network/Filepicker/URL.hs:74:47: warning:
      This binding for ‘handle’ shadows the existing binding
      imported from ‘Network.Filepicker.Policy’ at
      haskell-filepicker-policy/Network/Filepicker/URL.hs:28:1-42
      (and originally defined
      at haskell-filepicker-policy/Network/Filepicker/Policy.hs:50:5-10)
    ghcide: ^^ Could not load 'NetworkziFilepickerziHandle_FilepickerHandle_closure', dependency unresolved. See top entry above.
    
    File:     entities/Model/Common.hs
    Range:    1:0-100001:0
    Source:   typecheck
    Severity: DsError
    Message: 
      Program error:
      ByteCodeLink.lookupCE
      During interactive linking, GHCi couldn't find the following symbol:
      NetworkziFilepickerziHandle_FilepickerHandle_closure
      This may be due to you not asking GHCi to load extra object files,
      archives or DLLs needed by your current session. Restart GHCi, specifying
      the missing library using the -L/path/to/object/dir and -lmissinglibname
      flags, or simply by naming the relevant files on the GHCi command line.
      Alternatively, this link failure might indicate a bug in GHCi.
      If you suspect the latter, please send a bug report to:
      [email protected]
    
  2. ocharles commented on Dec 16, 2019

    @ocharles
    ContributorAuthor

    I can't give a full minimal repro just yet, but the package in question is open source at https://github.com/circuithub/haskell-filepicker-policy

  3. ocharles commented on Dec 16, 2019

    @ocharles
    ContributorAuthor

    This may be a dupe of haskell/ghcide#25 which reports the same error and is still open, but perhaps we should move on to this issue as the bug has changed? I'll leave that choice to the maintainers.

  4. cocreature commented on Dec 16, 2019

    @cocreature
    Contributor

    Good idea, I’ve closed haskell/ghcide#25

  5. chessai commented on Dec 20, 2019

    @chessai
    Member

    I am also getting this bug.

  6. chessai commented on Dec 24, 2019

    @chessai
    Member

    @ndmitchell @cocreature i want to work on fixing this. Any idea what the problem is/could be, relevant points of code to look at? Thanks

  7. cocreature commented on Dec 24, 2019

    @cocreature
    Contributor

    @chessai Sorry, I don’t know what the issue is or how to fix it. TH support was initially added in haskell/ghcide#222 so that might be helpful for finding relevant code paths.

  8. MaxGabriel commented on Jan 21, 2020

    @MaxGabriel

    Has anyone been able to reproduce this? Our project at work is running into it, so I thought I'd try to get a reproducing case.

    I took the gist here: https://gist.github.com/ocharles/1eb5532910bd65a3e1c11c880a1da349 and copied the same premise into this github repo: https://github.com/MaxGabriel/TemplateHaskellBug

    Then I ran ghcide with both stack and cabal and didn't run into the error. I also was able to build https://github.com/circuithub/haskell-filepicker-policy with ghcide with Stack (after making a few changes to it).

    This was with ghcide version: 0.0.5 (GHC: 8.6.5) and GHC 8.6.5 (Cabal), and LTS 14.19 (Stack, GHC 8.6.5)

  9. merijn commented on Jan 21, 2020

    @merijn

    @MaxGabriel I will see if I can reproduce it with the current ghcide

  10. merijn commented on Jan 31, 2020

    @merijn

    I just tried with 0.0.6 (i.e. HEAD) and I still run into problems. Specifically, I run into this error:

    ghcide: /home/mverstra/.cabal/store/ghc-8.6.5/persistent-sqlite-2.10.6.1-0834952e52e4fa9c78dec0a6a7253fab9a1d76084dee96701acf094e28f0770f/lib/libHSpersistent-sqlite-2.10.6.1-0834952e52e4fa9c78dec0a6a7253fab9a1d76084dee96701acf094e28f0770f.a: unknown symbol `stat64'
    ghcide: /home/mverstra/.cabal/store/ghc-8.6.5/persistent-sqlite-2.10.6.1-0834952e52e4fa9c78dec0a6a7253fab9a1d76084dee96701acf094e28f0770f/lib/libHSpersistent-sqlite-2.10.6.1-0834952e52e4fa9c78dec0a6a7253fab9a1d76084dee96701acf094e28f0770f.a: unknown symbol `sqlite3_errmsg'
    ghcide: ^^ Could not load 'persistentzmsqlitezm2zi10zi6zi1zm0834952e52e4fa9c78dec0a6a7253fab9a1d76084dee96701acf094e28f0770f_DatabaseziSqlite_zdfShowError_closure', dependency unresolved. See top entry above.
    

    Looking in the mentioned store path I find two persistent-sqlite libraries, one static and one dynamic. Running nm on these to find the mentioned symbols I see:

    $ nm libHSpersistent-sqlite-2.10.6.1-0834952e52e4fa9c78dec0a6a7253fab9a1d76084dee96701acf094e28f0770f.a | grep stat64
                     U fstat64
                     U lstat64
                     U stat64
    $ nm libHSpersistent-sqlite-2.10.6.1-0834952e52e4fa9c78dec0a6a7253fab9a1d76084dee96701acf094e28f0770f.a | grep sqlite3_errmsg
                     U sqlite3_errmsg
    0000000000034910 T sqlite3_errmsg
    0000000000036ff0 T sqlite3_errmsg16
    

    So sqlite3_errmsg does appear to exist in the library, but is still mentioned as missing, and stat64 is indeed not there.

    As for the dynamic one:

    $ nm libHSpersistent-sqlite-2.10.6.1-0834952e52e4fa9c78dec0a6a7253fab9a1d76084dee96701acf094e28f0770f.a | grep stat64
                     U fstat64
                     U lstat64
                     U stat64
    $ nm libHSpersistent-sqlite-2.10.6.1-0834952e52e4fa9c78dec0a6a7253fab9a1d76084dee96701acf094e28f0770f.a | grep sqlite3_errmsg
                     U sqlite3_errmsg
    0000000000034910 T sqlite3_errmsg
    0000000000036ff0 T sqlite3_errmsg16
    

    Both symbols appear to be defined.

  11. merijn commented on Jan 31, 2020

    @merijn

    I've tried explicitly passing -lc in my cradle to resolve the symbols, but that seems to have no effect.

  12. merijn commented on Jan 31, 2020

    @merijn

    I don't really know how to effectively debug/inspect what ghcide/hie-bios are doing in terms of linkerflags used, but if someone tells me what to try I can have a look.

  13. mpickering commented on Feb 6, 2020

    @mpickering
    Contributor

    I have a fix locally for this which I will put up soon. I'm also going to implement support for generating object files to reduce memory usage when using TH which is prohibitive for big projects at the moment.

  14. merijn commented on Feb 7, 2020

    @merijn

    @mpickering If you need someone to test/try it, just point me at the right branch and I can try it.

  15. transferred this issue fromhaskell/ghcideon Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions