[Haskell-cafe] can't build module with ffi 'wrapper' by cabal (or ghc): unknown symbol

Evgeny Chukreev l at toril.ru
Wed Jun 29 14:05:49 EDT 2005


Hello!

http://toril.ru/hmhash/hmhash-0.1.tar.bz2

###### ./Setup.hs clean; ./Setup.hs configure; ./Setup.hs build -v5

Configuring HMhash-0.1...
configure: searching for ghc in path.
configure: found ghc at /usr/bin/ghc
configure: looking for package tool: ghc-pkg near compiler in /usr/bin/ghc
configure: found package tool in /usr/bin/ghc-pkg
configure: Using install prefix: /usr/local
configure: Using compiler: /usr/bin/ghc
configure: Compiler flavor: GHC
configure: Compiler version: 6.4
configure: Using package tool: /usr/bin/ghc-pkg
configure: Using haddock: /usr/bin/haddock
configure: Using happy: /usr/bin/happy
configure: Using alex: /usr/bin/alex
configure: Using hsc2hs: /usr/bin/hsc2hs
configure: Using cpphs: /usr/bin/cpphs
configure: Reading installed packages...
configure: Dependency base-any: using base-1.0
Preprocessing library HMhash-0.1...
/usr/bin/hsc2hs -osrc/Codec/Mhash.hs src/Codec/Mhash.hsc
Building HMhash-0.1...
/usr/bin/ghc -package-name HMhash -odir dist/build/src -hidir dist/build/src --make -isrc -ffi -fglasgow-exts -fallow-undecidable-instances -fallow-overlapping-instances -fallow-incoherent-instances -Wall -O0 -package base-1.0 Codec.Mhash -v
Glasgow Haskell Compiler, Version 6.4, for Haskell 98, compiled by GHC version 6.2.2
Using package config file: /usr/lib/ghc-6.4/package.conf
Using package config file: /home/akshaal/.ghc/i386-linux-6.4/package.conf
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: Codec.Mhash
Stable modules:
*** Compiling Codec.Mhash      ( src/Codec/Mhash.hs, interpreted ):
compile: input file src/Codec/Mhash.hs
*** Checking old interface for Codec.Mhash:
Compiling Codec.Mhash      ( src/Codec/Mhash.hs, dist/build/src/Codec/Mhash.o )
*** Parser:
*** Renamer/typechecker:

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'

<no location info>: Warning: Defined but not used: `k'
*** Desugar:
    Result size = 6135
*** Simplify:
    Result size = 6847
    Result size = 5654
    Result size = 5564
*** Tidy Core:
    Result size = 5564
*** CorePrep:
    Result size = 6911
*** Stg2Stg:
*** CodeGen:
*** CodeOutput:
*** C Compiler
gcc src/Codec/Mhash_stub.c -o /tmp/ghc29101.s -DDONT_WANT_WIN32_DLL_SUPPORT -v -S -Wimplicit -O -D__GLASGOW_HASKELL__=604 -ffloat-store -I src/Codec -I /usr/lib/ghc-6.4/include
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-8)
 /usr/lib/gcc-lib/i486-linux/3.3.5/cc1 -quiet -v -I src/Codec -I /usr/lib/ghc-6.4/include -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=5 -DDONT_WANT_WIN32_DLL_SUPPORT -D__GLASGOW_HASKELL__=604 src/Codec/Mhash_stub.c -quiet -dumpbase Mhash_stub.c -auxbase-strip /tmp/ghc29101.s -O -Wimplicit -version -ffloat-store -o /tmp/ghc29101.s
GNU C version 3.3.5 (Debian 1:3.3.5-8) (i486-linux)
        compiled by GNU C version 3.3.5 (Debian 1:3.3.5-8).
GGC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=95593
ignoring nonexistent directory "/usr/i486-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 src/Codec
 /usr/lib/ghc-6.4/include
 /usr/local/include
 /usr/lib/gcc-lib/i486-linux/3.3.5/include
 /usr/include
End of search list.
*** Assembler
gcc -Isrc/Codec -c /tmp/ghc29101.s -o dist/build/src/Mhash_stub.o
*** Assembler
gcc -Isrc/Codec -c /tmp/ghc29100.s -o dist/build/src/Codec/Mhash.o
*** Deleting temp files
Deleting: /tmp/ghc29101.s /tmp/ghc29100.s
Upsweep completely successful.
*** Deleting temp files
Deleting:
link(batch): upsweep (partially) failed OR
   Main.main not exported; not linking.
*** Deleting temp files
Deleting:
/usr/bin/ar qv dist/build/libHSHMhash-0.1.a dist/build/src/Codec/Mhash.o
/usr/bin/ar: creating dist/build/libHSHMhash-0.1.a
a - dist/build/src/Codec/Mhash.o


###### ./Setup.hs install
Installing: /usr/local/lib/HMhash-0.1 & /usr/local/bin HMhash-0.1...
Registering HMhash-0.1...
Reading package info from ".installed-pkg-config" done.
building GHCi library /usr/local/lib/HMhash-0.1/HSHMhash-0.1.o... done.
Saving old package config file... done.
Writing new package config file... done.


###### ghci -package HMhash
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.4, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
Loading package HMhash-0.1 ... linking ... ghc-6.4: /usr/local/lib/HMhash-0.1/HSHMhash-0.1.o: unknown symbol `CodecziMhash_d7Ew'
ghc-6.4: unable to load package `HMhash-0.1'

------------------
I know how to fix it by hands:

rm dist/build/libHSHMhash-0.1.a
/usr/bin/ar qv dist/build/libHSHMhash-0.1.a dist/build/src/Codec/Mhash.o dist/build/src/Mhash_stub.o

But, how to do it with cabal?

--
... WBR, Evgeny Chukreev ...


More information about the Haskell-Cafe mailing list