Opened 14 months ago

Last modified 7 months ago

#9009 infoneeded bug

Confusing error message when loading package with TH

Reported by: jstolarek Owned by:
Priority: normal Milestone:
Component: Package system Version: 7.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

I got this error message when compiling a file that calls Template Haskell function from singletons package:

[1 of 1] Compiling Splices          ( Splices.hs, Splices.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package syb-0.4.1 ... linking ... done.
Loading package th-desugar-1.4.0 ... linking ... done.
Loading package singletons-1.0 ... <command line>: can't load .so/.DLL for: /home/killy/.cabal/lib/x86_64-linux-ghc-7.8.2/singletons-1.0/libHSsingletons-1.0-ghc7.8.2.so (/home/killy/.cabal/lib/x86_64-linux-ghc-7.8.2/singletons-1.0/libHSsingletons-1.0-ghc7.8.2.so: undefined symbol: singletonszm1zi0_DataziSingletonsziSingleziMonad_lookupProxy1_info)

After some investigation it turned out that the module Data.Singletons.Single.Monad was not listed in singletons.cabal file - neither under exported-modules nor other-modules - when the package was installed. The error message is mostly confusing. It would be good to at least get a hint on the possible cause.

Change History (6)

comment:1 Changed 7 months ago by thomie

@jstolarek is this still a problem? What are the steps needed to reproduce it?

comment:2 Changed 7 months ago by jstolarek

Thomie, I haven't tried this with HEAD. With 7.8.3 the problem is of course there.

Here are steps to reproduce:

  1. cabal get singletons
  2. cd singletons-1.0
  3. edit singletons.cabal and remove line 98 (Data.Singletons.Single.Monad from other-modules section)
  4. cabal install
  5. ghc Foo.hs where Foo.hs contains:
{-# LANGUAGE TemplateHaskell, KindSignatures, DataKinds, TypeFamilies, ExistentialQuantification #-}
module Foo where

import Data.Singletons.TH

$(promote [d| data N = Z | S N |])

comment:3 Changed 7 months ago by thomie

  • Status changed from new to infoneeded

Compiling singletons-1.0 with HEAD failes with:

src/Data/Singletons/Prelude/Ord.hs:48:15:
    MINIMAL pragmas not (yet) handled by Template Haskell

Using ghc 7.8.3 I get a nice error message when compiling Foo.hs:

singletons-1.0$ ghc-7.8.3 -package-db=.cabal-sandbox/x86_64-linux-ghc-7.8.3-packages.conf.d/ Foo.hs
[1 of 1] Compiling Foo              ( Foo.hs, Foo.o )
Failed to load interface for ‘Data.Singletons.Single.Monad’
There are files missing in the ‘singletons-1.0’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

jstolarek: What am I missing? Maybe cabal version (1.20.0.3) is relevant?

comment:4 Changed 7 months ago by jstolarek

Compiling singletons-1.0 with HEAD failes with ...

Just remove the MINIMAL pragma.

Maybe cabal version (1.20.0.3) is relevant?

It looks like my version is identical:

$ cabal --version
cabal-install version 1.20.0.3
using version 1.20.0.2 of the Cabal library

I see you're using cabal sandbox. Perhaps this is important? I'm using user's package database.

comment:5 Changed 7 months ago by thomie

This is still not reproducable for me with 7.8.3 (I get the same error from comment:3). I am using the haskell-platform 2014.02 in the global database, an initially empty user database (deleted ~/.ghc and ~/.cabal) and no sandbox.

But it I did reproduce it with a recent HEAD. I followed the steps from comment:2 and also removed the MINIMAL pragma from src/Data/Singletons/Prelude/Ord.hs in singletons-1.0.

$ uname -a
Linux feng-laptop 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ /opt/ghc/head/bin/ghc-pkg list
/opt/ghc/head/lib/ghc-7.9.20141108/package.conf.d
   Cabal-1.21.1.0
   array-0.5.0.1
   base-4.8.0.0
   bin-package-db-0.0.0.0
   binary-0.7.1.0
   bytestring-0.10.4.0
   containers-0.5.5.1
   deepseq-1.3.0.3
   directory-1.2.1.1
   filepath-1.3.0.3
   ghc-7.9.20141108
   ghc-prim-0.3.1.0
   haskeline-0.7.1.3
   haskell2010-1.1.2.1
   haskell98-2.0.0.4
   hoopl-3.10.0.2
   hpc-0.6.0.2
   integer-gmp-0.5.1.0
   old-locale-1.0.0.7
   old-time-1.1.0.3
   pretty-1.1.1.1
   process-1.2.0.1
   rts-1.0
   template-haskell-2.10.0.0
   terminfo-0.4.0.0
   time-1.5
   transformers-0.4.1.0
   unix-2.7.0.2
   xhtml-3000.2.1
/home/thomas/.ghc/x86_64-linux-7.9.20141108/package.conf.d
   mtl-2.2.1
   singletons-1.0
   syb-0.4.2
   th-desugar-1.4.2

$ /opt/ghc/head/bin/ghc-7.9.20141108 Foo.hs 
[1 of 1] Compiling Foo              ( Foo.hs, Foo.o )
<command line>: can't load .so/.DLL for: /home/thomas/.cabal/lib/x86_64-linux-ghc-7.9.20141108/singletons-1.0/libHSsingl_LteS7xqJUFW9l0IV1AW3w0-ghc7.9.20141108.so (/home/thomas/.cabal/lib/x86_64-linux-ghc-7.9.20141108/singletons-1.0/libHSsingl_LteS7xqJUFW9l0IV1AW3w0-ghc7.9.20141108.so: undefined symbol: singlzuLteS7xqJUFW9l0IV1AW3w0_DataziSingletonsziSingleziMonad_wrapUnSingFun5_closure)

comment:6 Changed 7 months ago by jstolarek

Interesting that you can't reproduce this with 7.8.3.

Note: See TracTickets for help on using tickets.