Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 123244 - ghci 6.4.1 (-r1) has problems with symbols from libgcc_s (unknown)
Summary: ghci 6.4.1 (-r1) has problems with symbols from libgcc_s (unknown)
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-18 02:58 UTC by Georg Sauthoff
Modified: 2006-02-18 04:30 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.