Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,252
    • Issues 4,252
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 398
    • Merge Requests 398
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #1883

Closed
Open
Opened Nov 13, 2007 by m4dc4p@trac-m4dc4p

GHC can't find library using "short" name

I wanted to build HDBC-postgresql 1.0.1[1] today, and ran into a problem where my test program would not load and instead gave this error:

  can't load .so/.DLL for: pq (addDLL: unknown error)

I traced this to the 'extra-libraries' directive in the .cabal file. It read

Extra-Libraries: pq

When I changed it to

Extra-Libraries: libpq

The error went away. Somehow "pq" is not enough to get "libpq.dll" loaded.

Note that building on Windows required some other changes.[2]

This was using Cabal 1.1

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-postgresql-1.0.1.0

[2] From http://software.complete.org/hdbc/wiki/FrequentlyAskedQuestions

To build on Windows, you must specify where the postgresql include and library files are. Follow these two steps:

  1. Ensure the files are NOT installed in a directory with spaces in the name (e.g. "C:\Program Files"). For example, install them in c:\pgsql.
  2. Assuming postgresql is installed in C:\pgsql, add the following information to the .cabal file:
      include-dirs: C:\pgsql\include, C:\pgsql\include\server, .
      extra-lib-dirs: C:\pgsql\bin

Notice the "." at the end of include-dirs to ensure the current directory is also searched. Also notice "bin" directory is specified in "extra-lib-dirs." This is important in the next step.

  1. HDBC-postgresl depends on "libpa.dll" in the bin directory above. The .cabal file refers to the "pq", but that doesn't work on Windows. Change it to libpq like so:

Extra-Libraries: libpq

Trac metadata
Trac field Value
Version 6.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
8.0.1
Milestone
8.0.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#1883