Skip to content

Combining lvish with Template Haskell: undefined symbol: nand_and_fetch_8 #123

@robstewart57

Description

@robstewart57

Hi,

I'm experiencing a compilation error undefined symbol: nand_and_fetch_8 stemming from bits-atomic, when combining Template Haskell with lvish 2.0.2.

I've put together a small test case.

Foo.hs

{-# LANGUAGE TemplateHaskell #-}

module Foo where
import Language.Haskell.TH

build_p1 :: Q [Dec]
build_p1 = return
    [ FunD p1
             [ Clause [TupP [VarP a,VarP b]] (NormalB (VarE a)) []
             ]
    ] where
       p1 = mkName "p1"
       a = mkName "a"
       b = mkName "b"

And Main.hs

{-# LANGUAGE TemplateHaskell #-}

module Main where
import Foo
import Control.LVish (Par) -- would require the lvish library

$(build_p1)
main = print $ p1 (1,2)

For convenience, this code has been cabalised, available here: http://www.macs.hw.ac.uk/~rs46/files/lvish-template-haskell-fail-case.tar.gz . When trying to compile with cabal install, I get:

<command line>: can't load .so/.DLL for: /home/rob/.cabal/lib/i386-linux-ghc-7.10.1/bitsa_EfESR243Us2C1YfvGtoj49/libHSbits-atomic-0.1.3-EfESR243Us2C1YfvGtoj49-ghc7.10.1.so (/home/rob/.cabal/lib/i386-linux-ghc-7.10.1/bitsa_EfESR243Us2C1YfvGtoj49/libHSbits-atomic-0.1.3-EfESR243Us2C1YfvGtoj49-ghc7.10.1.so: undefined symbol: nand_and_fetch_8)

This symbol should be found from cbits/atomic-bitops-gcc.h and cbits/atomic-bitops-gcc.c from the bits-atomic package, but it's not being found. I don't get this error if I comment out the lvish build-depends entry in the cabal file and comment out the import of Control.LVish in Main.hs .

My software environment is: GHC 7.10, 32bit OS, bits-atomic-0.1.3, lvish-2.0.2. Questions:

  1. Is the lvish and template haskell combination above supposed to work?
  2. Can someone else reproduce my compilation error, based on the cabal project I link to above?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions