dlopen() errors reported badly
(BTW, shouldn't there be a category in the sourceforge
bug-reporting page for "ghci"?)
ghci reports all dlopen() errors as "Can't find
(dynamic) ...". This misleading error message wasted
quite a bit of my time trying to figure out why it
couldn't find the library that was "right there".
For example:
galaxy% ghci -lXpm
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version
5.02, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package std ... linking ... done.
Loading object (dynamic) Xpm ... failed.
Can't find (dynamic) Xpm in directories:
ghc-5.02: user specified .o/.so/.DLL could not be
loaded.
galaxy%
ghci reported that it couldn't find a dynamic libXpm.
However, a little peeking with ltrace reveals the real
problem:
galaxy% ltrace -e 'dlerror,dlopen' -s 300
/usr/lib/ghc-5.02/ghc-5.02 -B/usr/lib/ghc-5.02
--interactive -lXpm
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version
5.02, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
dlopen(NULL, 1) =
0x400153d8
Loading package std ... --- SIGVTALRM (Virtual timer
expired) ---
--- SIGVTALRM (Virtual timer expired) ---
linking ... --- SIGVTALRM (Virtual timer expired) ---
--- SIGVTALRM (Virtual timer expired) ---
--- SIGVTALRM (Virtual timer expired) ---
--- SIGVTALRM (Virtual timer expired) ---
done.
Loading object (dynamic) Xpm ... dlopen("libXpm.so",
258) = NULL
dlerror() =
"/usr/X11R6/lib/libXpm.so: undefined symbol:
XDefaultScreen"
failed.
Can't find (dynamic) Xpm in directories:
ghc-5.02: user specified .o/.so/.DLL could not be
loaded.
Armed with the real error message from dlerror()
("undefined symbol: XDefaultScreen"), I can deduce that
I really need to use -lX11 as well.
galaxy% ghci -lXpm -lX11
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version
5.02, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package std ... linking ... done.
Loading object (dynamic) X11 ... done
Loading object (dynamic) Xpm ... done
final link ... done.
Prelude>
As expected, this works fine.
galaxy% uname -a
Linux galaxy 2.4.14-pre6 #1 Thu Nov 1 02:23:35 PST 2001
i686 unknown
galaxy% gcc -v
Reading specs from
/usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011006 (Debian prerelease)
Trac metadata
Trac field |
Value |
Version |
5.02 |
Type |
Bug |
TypeOfFailure |
OtherFailure |
Priority |
normal |
Resolution |
ResolvedFixed |
Component |
Driver |
Test case |
|
Differential revisions |
|
BlockedBy |
|
Related |
|
Blocking |
|
CC |
|
Operating system |
|
Architecture |
|