2
votes

I am following the Yesod quick start guide and I am getting errors doing cabal installand yesod devel regarding the persistent-sqlite module. I've already installed ghc-7.4.1 and haskell-platform-2012.2.0.0.

$ cabal install:

Loading package persistent-sqlite-0.9.0.2 ... linking ... ghc: /home/roberto/.cabal/lib/persistent-sqlite-0.9.0.2/ghc-7.4.1/HSpersistent-sqlite-0.9.0.2.o: unknown symbol `__warn_memset_zero_len'

ghc: unable to load package `persistent-sqlite-0.9.0.2'

cabal: Error: some packages failed to install: mate-0.0.0 failed during the building phase. The exception was: ExitFailure 1

$ yesod devel:

ghc: /home/roberto/.cabal/lib/persistent-sqlite-0.9.0.2/ghc-7.4.1/HSpersistent-sqlite-0.9.0.2.o: unknown symbol `__warn_memset_zero_len'

ghc: unable to load package `persistent-sqlite-0.9.0.2' Build failure, pausing...

$ ghc-pkg list:

persistent-sqlite-0.9.0.2
yesod-platform-1.0.5

$ cabal install persistent-sqlite --reinstall

In function ‘memset’,

inlined from ‘exprDup’ at cbits/sqlite3.c:68471:0: 

/usr/include/bits/string3.h:82:0: warning: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters

If I comment that line out, __warn_memset_zero_len(); in /usr/include/bits/string3.h:82, everything goes fine. Is there a proper solution, like telling ghc not to stop on a compilation warning?

3
I've had a look at the .cabal file for the persistent-sqlite package at $HOME/.cabal/packages, looking for a -Werror ghc-option that should be causing the problem, but I found a -Wall instead. And the same for the yesod project I'm creating, called mate; mate.cabal didn't have any -Werror.rturrado

3 Answers

1
votes

I was asking the same question on FreeNode irc on #ghc-dev and was told that this error happens due to some problems in Template Haskell mechanism that uses GHCi to pre-compile things. This happens exactly when trying to pre-compile SQLite libraries.

And I was also informed that this should be fixed with the new version of GHC that is about to be released: v7.8.x (but it will still take some time to get it as part of a new Haskell Platform).

And I am quite surprised that the problem is there for such a long time.

2
votes

Unknown symbol errors when running yesod devel are often the result of failing to include a module in exposed-modules or other-modules in your application's cabal file.

1
votes

Some comments that may help:

A memset error with zero length is not something to ignore.

An unknown symbol error may say that the underlying sqlite library version is too old.

  • Consider updating sqlite, or in case of optimization problems check if the gcc version is not too old.

  • Instead of using cabal, cabal-dev provides a sanboxed library database for your project.

  • Instead of installing libraries separately, it's better to list them all in a .cabal project file specifying version dependencies. (the yesod-platform and the persistent-sqlite have dependencies in common)

Cheers!