Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 123244

Summary: ghci 6.4.1 (-r1) has problems with symbols from libgcc_s (unknown)
Product: Gentoo Linux Reporter: Georg Sauthoff <g_sauthoff>
Component: Current packagesAssignee: Gentoo's Haskell Language team <haskell>
Status: RESOLVED INVALID    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Georg Sauthoff 2006-02-18 02:58:29 UTC
Hi,

how to reproduce this:
# cat foo.c 
#include <inttypes.h>
uint64_t foo(double a) { return a; }
# gcc -c -Wall foo.c
# ghci foo.o
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.4.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
Loading object (static) foo.o ... done
final link ... ghc-6.4.1: foo.o: unknown symbol `__fixunsdfdi'
ghc-6.4.1: linking extra libraries/objects failed
# gcc --version
gcc (GCC) 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)

Quick fix:
ghci foo.o -lgcc_s

Btw, ghc does not have this problem ('ghc Main foo.o' works).

Please check, if this is a bug. If this is not Gentoo specific, please report it upstream.

Regards
Georg Sauthoff
Comment 1 Duncan Coutts (RETIRED) gentoo-dev 2006-02-18 04:30:30 UTC
Hi Georg,

I don't think ghci is expected to be able to load up arbitrary .o files produces by gcc. What you should do is to create a ghc or Cabal package which tells ghc which extra libraries need to be loaded.

The reason it happens to work with ghc in batch mode is that ghc gets gcc to do the linking ang gcc knows about libgcc_s.

GHC packages:
http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html

Cabal packages (which are basically the same thing but more convenient and more portable between Haskell compilers):
http://www.haskell.org/ghc/docs/latest/html/Cabal/index.html

You may also want to read a guide on the Haskell FFI and how to link to C code.