Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,250
    • Issues 5,250
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 561
    • Merge requests 561
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #24
Closed
Open
Issue created Nov 16, 2001 by cwitty@trac-cwitty

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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking