building psycopg2 on windows using mingw, "cannot find -lpq"

Discussion in 'Python' started by GHUM, Jan 21, 2008.

  1. GHUM

    GHUM Guest

    The compile works, BUT linking fails:

    2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc:
    \python25\PCBuild -Lc:/p
    ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build
    \lib.win32-2.5\psy
    copg2\_psycopg.pyd
    c:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
    cannot find -lpq
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1

    if I google for the error

    "ld.exe: cannot find -lpq"

    there is allways the information that the lib-dir of libpq is missing;
    but :

    -Lc:/postgres/83RC2/lib

    is clearly in the commandline, and within c:/postgres/83RC2/lib
    there is one libqp.lib

    What am I missing? any hints?

    Best wishes,

    Harald

    (complete output:
    c:\mingw\bin\gcc.exe -mno-cygwin -shared -s build
    \temp.win32-2.5\Release\psycopg
    \psycopgmodule.o build\temp.win32-2.5\Release\psycopg\pqpath.o build
    \temp.win32-
    2.5\Release\psycopg\typecast.o build\temp.win32-2.5\Release\psycopg
    \microprotoco
    ls.o build\temp.win32-2.5\Release\psycopg\microprotocols_proto.o build
    \temp.win3
    2-2.5\Release\psycopg\connection_type.o build\temp.win32-2.5\Release
    \psycopg\con
    nection_int.o build\temp.win32-2.5\Release\psycopg\cursor_type.o build
    \temp.win3
    2-2.5\Release\psycopg\cursor_int.o build\temp.win32-2.5\Release\psycopg
    \lobject_
    type.o build\temp.win32-2.5\Release\psycopg\lobject_int.o build
    \temp.win32-2.5\R
    elease\psycopg\adapter_qstring.o build\temp.win32-2.5\Release\psycopg
    \adapter_pb
    oolean.o build\temp.win32-2.5\Release\psycopg\adapter_binary.o build
    \temp.win32-
    2.5\Release\psycopg\adapter_asis.o build\temp.win32-2.5\Release\psycopg
    \adapter_
    list.o build\temp.win32-2.5\Release\psycopg\adapter_datetime.o build
    \temp.win32-
    2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc:
    \python25\PCBuild -Lc:/p
    ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build
    \lib.win32-2.5\psy
    copg2\_psycopg.pyd
    c:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
    cannot find -lpq
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    )
     
    GHUM, Jan 21, 2008
    #1
    1. Advertising

  2. GHUM

    Tom Brown Guest

    On Mon, 2008-01-21 at 01:57 -0800, GHUM wrote:
    > What am I missing? any hints?


    I use psycopg2 all the time on windows. I use the binary installer
    instead of source. Works great for me.

    -Tom
     
    Tom Brown, Jan 21, 2008
    #2
    1. Advertising

  3. GHUM wrote:

    > The compile works, BUT linking fails:
    >
    > 2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc:
    > \python25\PCBuild -Lc:/p
    > ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build
    > \lib.win32-2.5\psy
    > copg2\_psycopg.pyd
    > c:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
    > cannot find -lpq
    > collect2: ld returned 1 exit status
    > error: command 'gcc' failed with exit status 1
    >
    > if I google for the error
    >
    > "ld.exe: cannot find -lpq"
    >
    > there is allways the information that the lib-dir of libpq is missing;
    > but :
    >
    > -Lc:/postgres/83RC2/lib
    >
    > is clearly in the commandline, and within c:/postgres/83RC2/lib
    > there is one libqp.lib
    >
    > What am I missing? any hints?


    Are you sure using forward slashes in the path works here?

    Diez
     
    Diez B. Roggisch, Jan 21, 2008
    #3
  4. GHUM

    GHUM Guest

    > > The compile works, BUT linking fails:
    >
    > > 2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc:
    > > \python25\PCBuild -Lc:/p
    > > ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build

    >
    > >  -Lc:/postgres/83RC2/lib

    >
    > Are you sure using forward slashes in the path works here?


    Not at all. But that commandline is generated by setup.py, not by me :
    (
    and setup.py extracts the paths from pg_config

    so: I have no idea how to make it use backslash :(

    Thanks for the idea,

    Harald
     
    GHUM, Jan 22, 2008
    #4
  5. GHUM

    GHUM Guest

    > I use psycopg2 all the time on windows. I use the binary installer
    > instead of source. Works great for me.
    >
    > -Tom

    Me2. Just in 7 out of 200 it does not work with the currently
    available binary installer, on some startups, so I decided to follow a
    recommendation out of the psycopg2 list to compile it from trunk :(

    Harald
     
    GHUM, Jan 22, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sam Smith
    Replies:
    0
    Views:
    1,189
    Sam Smith
    Oct 18, 2004
  2. mrstephengross

    MinGW building with Python 2.4

    mrstephengross, Mar 22, 2005, in forum: Python
    Replies:
    2
    Views:
    442
    mrstephengross
    Mar 23, 2005
  3. xeno fears
    Replies:
    1
    Views:
    502
    Martin v. Löwis
    Oct 4, 2009
  4. ASh
    Replies:
    10
    Views:
    2,443
    Anton Shishkov
    Mar 31, 2010
  5. mrdrew
    Replies:
    5
    Views:
    2,752
    Dennis Lee Bieber
    Apr 5, 2010
Loading...

Share This Page