Friday, July 25th 2008, 2:42am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, March 21st 2008, 12:31am

PSQL problem

Hey guys,

I downloaded and installed qt-win-opensource-4.3.4-mingw.exe.
O.S.: Windows Vista
QT: 4.3.4
PSQL: 8.2
I open 'Qt 4.3.4 Command Prompt' and entered:

C:\Qt\4.3.4\src\plugins\sqldrivers\psql>qmake -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\liblibpq.a" psql.pro

And after that:

C:\Qt\4.3.4\src\plugins\sqldrivers\psql>make

...

ERROR:
tmp/obj/release_shared/qsql_psql.o(.text+0x54):qsql_psql.cpp: undefined reference to `PQerrorMessage'
tmp/obj/release_shared/qsql_psql.o(.text+0x32b):qsql_psql.cpp: undefined reference to `PQresultStatus'
tmp/obj/release_shared/qsql_psql.o(.text+0x4f0):qsql_psql.cpp: undefined reference to `PQntuples'
tmp/obj/release_shared/qsql_psql.o(.text+0x834):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0xb34):qsql_psql.cpp: undefined reference to `PQntuples'
tmp/obj/release_shared/qsql_psql.o(.text+0xbac):qsql_psql.cpp: undefined reference to `PQnfields'
tmp/obj/release_shared/qsql_psql.o(.text+0xc22):qsql_psql.cpp: undefined reference to `PQftype'
tmp/obj/release_shared/qsql_psql.o(.text+0xc61):qsql_psql.cpp: undefined reference to `PQgetvalue'
tmp/obj/release_shared/qsql_psql.o(.text+0xc95):qsql_psql.cpp: undefined reference to `PQgetisnull'
tmp/obj/release_shared/qsql_psql.o(.text+0xe2c):qsql_psql.cpp: undefined reference to `PQunescapeBytea'
tmp/obj/release_shared/qsql_psql.o(.text+0xe6b):qsql_psql.cpp: undefined reference to `PQfreemem'
tmp/obj/release_shared/qsql_psql.o(.text+0x15d9):qsql_psql.cpp: undefined reference to `PQgetvalue'
tmp/obj/release_shared/qsql_psql.o(.text+0x15f8 ):qsql_psql.cpp: undefined reference to `PQgetisnull'
tmp/obj/release_shared/qsql_psql.o(.text+0x1765):qsql_psql.cpp: undefined reference to `PQexec'
tmp/obj/release_shared/qsql_psql.o(.text+0x1936):qsql_psql.cpp: undefined reference to `PQcmdTuples'
tmp/obj/release_shared/qsql_psql.o(.text+0x1a6f):qsql_psql.cpp: undefined reference to `PQoidValue'
tmp/obj/release_shared/qsql_psql.o(.text+0x1c1a):qsql_psql.cpp: undefined reference to `PQnfields'
tmp/obj/release_shared/qsql_psql.o(.text+0x1cc2):qsql_psql.cpp: undefined reference to `PQfname'
tmp/obj/release_shared/qsql_psql.o(.text+0x1d3a):qsql_psql.cpp: undefined reference to `PQftype'
tmp/obj/release_shared/qsql_psql.o(.text+0x1d6a):qsql_psql.cpp: undefined reference to `PQfsize'
tmp/obj/release_shared/qsql_psql.o(.text+0x1d8b):qsql_psql.cpp: undefined reference to `PQfmod'
tmp/obj/release_shared/qsql_psql.o(.text+0x1e0d):qsql_psql.cpp: undefined reference to `PQftype'
tmp/obj/release_shared/qsql_psql.o(.text+0x1e83):qsql_psql.cpp: undefined reference to `PQfname'
tmp/obj/release_shared/qsql_psql.o(.text+0x1f45):qsql_psql.cpp: undefined reference to `PQexec'
tmp/obj/release_shared/qsql_psql.o(.text+0x1f53):qsql_psql.cpp: undefined reference to `PQresultStatus'
tmp/obj/release_shared/qsql_psql.o(.text+0x1f7c):qsql_psql.cpp: undefined reference to `PQgetvalue'
tmp/obj/release_shared/qsql_psql.o(.text+0x1fa8 ):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0x27cb):qsql_psql.cpp: undefined reference to `PQfinish'
tmp/obj/release_shared/qsql_psql.o(.text+0x289b):qsql_psql.cpp: undefined reference to `PQfinish'
tmp/obj/release_shared/qsql_psql.o(.text+0x296b):qsql_psql.cpp: undefined reference to `PQfinish'
tmp/obj/release_shared/qsql_psql.o(.text+0x2eab):qsql_psql.cpp: undefined reference to `PQconnectdb'
tmp/obj/release_shared/qsql_psql.o(.text+0x2efc):qsql_psql.cpp: undefined reference to `PQstatus'
tmp/obj/release_shared/qsql_psql.o(.text+0x2f4f):qsql_psql.cpp: undefined reference to `PQexec'
tmp/obj/release_shared/qsql_psql.o(.text+0x2f5d):qsql_psql.cpp: undefined reference to `PQresultStatus'
tmp/obj/release_shared/qsql_psql.o(.text+0x2f71):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0x2fa4):qsql_psql.cpp: undefined reference to `PQexec'
tmp/obj/release_shared/qsql_psql.o(.text+0x2fb2):qsql_psql.cpp: undefined reference to `PQresultStatus'
tmp/obj/release_shared/qsql_psql.o(.text+0x2fc3):qsql_psql.cpp: undefined reference to `PQerrorMessage'
tmp/obj/release_shared/qsql_psql.o(.text+0x2fed):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0x35c8 ):qsql_psql.cpp: undefined reference to `PQfinish'
tmp/obj/release_shared/qsql_psql.o(.text+0x373b):qsql_psql.cpp: undefined reference to `PQfinish'
tmp/obj/release_shared/qsql_psql.o(.text+0x38cc):qsql_psql.cpp: undefined reference to `PQexec'
tmp/obj/release_shared/qsql_psql.o(.text+0x38db):qsql_psql.cpp: undefined reference to `PQresultStatus'
tmp/obj/release_shared/qsql_psql.o(.text+0x3900):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0x3a0d):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0x3abc):qsql_psql.cpp: undefined reference to `PQexec'
tmp/obj/release_shared/qsql_psql.o(.text+0x3acb):qsql_psql.cpp: undefined reference to `PQresultStatus'
tmp/obj/release_shared/qsql_psql.o(.text+0x3ae4):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0x3bfd):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0x3cac):qsql_psql.cpp: undefined reference to `PQexec'
tmp/obj/release_shared/qsql_psql.o(.text+0x3cbb):qsql_psql.cpp: undefined reference to `PQresultStatus'
tmp/obj/release_shared/qsql_psql.o(.text+0x3d74):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0x3dec):qsql_psql.cpp: undefined reference to `PQclear'
tmp/obj/release_shared/qsql_psql.o(.text+0x8048 ):qsql_psql.cpp: undefined reference to `PQescapeBytea'
tmp/obj/release_shared/qsql_psql.o(.text+0x80a4):qsql_psql.cpp: undefined reference to `PQfreemem'
tmp/obj/release_shared/qsql_psql.o(.text+0x8612):qsql_psql.cpp: undefined reference to `PQstatus'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlpsql4.dll] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/4.3.4/src/plugins/sqldrivers/psql'
mingw32-make: *** [release] Error 2

Please, I really need help!

Thanks.

This post has been edited 1 times, last edit by "LoneWolf" (Mar 21st 2008, 12:38am)

  • Go to the top of the page

2

Monday, March 24th 2008, 12:06am

Please guys,

I really need to solve this problem. :(

Thanks.
  • Go to the top of the page

Messenger

Intermediate

Posts: 329

Location: Lt

3

Monday, March 24th 2008, 9:25am

Try to edit pqsl.pro (win32 part). Don't forget to make a backup copy.

Quoted


win32:!contains(LIBS, .*pq.* ) {
INCLUDEPATH += C:\psql\include
!win32-g++:LIBS *= -llibpq
win32-g++:LIBS *= -LC:\psql\lib -llibpq
LIBS *= -lws2_32 -ladvapi32
}

Or something alike.
>qmake
>mingw32-make

postgres binaries are compiled with msvc or with mingw32? Have you correctly converted msvc .lib file to mingw32 .a file? Check with objdump.exe.
Fighting fire with fire.
  • Go to the top of the page

4

Monday, March 24th 2008, 10:36am

Hello,

I edited psql.pro and...

C:\Qt\4.3.4\src\plugins\sqldrivers\psql>qmake

C:\Qt\4.3.4\src\plugins\sqldrivers\psql>mingw32-make

Same ERROR.


I downloaded and installed qt-win-opensource-4.3.4-mingw.exe...so I think that it is compiled with mingw32, right?

It appears when I open Qt 4.3.4 Command Prompt:
"Setting up a MinGW/Qt only environment...
-- QTDIR set to C:\Qt\4.3.4
-- PATH set to C:\Qt\4.3.4\bin
-- Adding C:\MinGW\bin to PATH
-- Adding C:\Windows\System32 to PATH
-- QMAKESPEC set to win32-g++"

And about .lib and .a I did:
reimp libpq.lib and it created liblibpq.a, is it right?

How do I use objdump.exe?

Thanks for helping....
Hugs.
  • Go to the top of the page

Messenger

Intermediate

Posts: 329

Location: Lt

5

Monday, March 24th 2008, 12:15pm

>>reimp libpq.lib and it created liblibpq.a, is it right?
Well, actually two tools are used to create .a from msvc .lib.
http://qtnode.net/wiki?title=Qt4_on_Windows
At the end

Quoted


reimp -d libmysql.lib
dlltool -k -d libmysql.def -l libmysql.a
Fighting fire with fire.
  • Go to the top of the page

6

Monday, March 24th 2008, 11:55pm

gcc: installation problem, cannot exec `cc1': No such file or directory
mingw32-make[2]: *** [tmp/obj/release_shared/adler32.o] Error 1
mingw32-make[2]: Leaving directory `C:/Qt/4.3.4/src/tools/rcc'
mingw32-make[1]: *** [release] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/4.3.4/src/tools/rcc'
mingw32-make: *** [sub-rcc-make_default-ordered] Error 2

cc1.exe is in mingw/libexec/gcc/3.4.2
  • Go to the top of the page

7

Wednesday, March 26th 2008, 12:48pm

I added the following line in the Qt\bin\qtvars.bat :

SET PATH=%PATH%;C:\gcc\mingw\libexec\gcc\mingw32\3.4.2

And tried again....
configure is ok...
make...

ERROR:

In file included from ..\..\3rdparty\zlib\crc32.c:29:
..\..\3rdparty\zlib\/zutil.h:21:24: stddef.h: No such file or directory
..\..\3rdparty\zlib\/zutil.h:23:22: string.h: No such file or directory
..\..\3rdparty\zlib\/zutil.h:24:22: stdlib.h: No such file or directory
..\..\3rdparty\zlib\/zutil.h:38:23: errno.h: No such file or directory
..\..\3rdparty\zlib\crc32.c:36:24: limits.h: No such file or directory
mingw32-make[2]: *** [tmp/obj/release_shared/crc32.o] Error 1
mingw32-make[2]: Leaving directory `C:/Qt/4.3.4/src/tools/rcc'
mingw32-make[1]: *** [release] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/4.3.4/src/tools/rcc'
mingw32-make: *** [debug-C__Qt_4_3_4_src_tools_rcc] Error 2

???
  • Go to the top of the page

8

Thursday, March 27th 2008, 2:08am

I did somethings...
After mingw and qt installation:

C:\Qt\4.3.4\src\plugins\sqldrivers\psql>qmake -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\libpq.lib" psql.pro

C:\Qt\4.3.4\src\plugins\sqldrivers\psql>make


Output:
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Qt/4.3.4/src/plugins/sqldrivers/psql'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
-DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -
I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\psql\include" -I"c:\Qt\4.3.4\include\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\release_shared\main.o main.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
-DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -
I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\psql\include" -I"c:\Qt\4.3.4\include\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\release_shared\qsql_psql.o ..\..\..\sql\drivers\psql\qsql_psql.cpp
C:/Qt/4.3.4/bin/moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -
DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE
_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include\QtSql" -I"..\..\..\.
.\include" -I"c:\psql\include" -I"c:\Qt\4.3.4\include\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"..\..\..\..\mkspecs\win32-g++" -D__GNUC__ -DWIN32 ..\..\..\sql\drivers\psql\qsql_psql.h -o tmp\moc\release_shared\moc_qsql_psql.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
-DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -
I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\psql\include" -I"c:\Qt\4.3.4\include\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"..\..\..\..\mkspecs\win32-g++" -o tmp
\obj\release_shared\moc_qsql_psql.o tmp\moc\release_shared\moc_qsql_psql.cpp
windres -i qsqlpsql_resource.rc -o tmp\obj\release_shared\qsqlpsql_resource_res.o --include-dir=.
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -shared -Wl,--out-implib,c:\Qt\4.3.4\plugins\sqldrivers\
libqsqlpsql4.a -o ..\..\..\..\plugins\sqldrivers\qsqlpsql4.dll tmp/obj/release_shared/main.o tmp/obj/release_shared/qsql_psql.o tmp/obj/release_shared/moc_qsql_psql.o -L"c:\Qt\4.3.4\lib" -L"c:\Qt\4.3.4\lib" tmp\obj\release_shared\qsqlpsql_resource_res.o C:\psql\lib\libpq.lib -lQtSql4 -lQtCore4
Creating library file: c:\Qt\4.3.4\plugins\sqldrivers\libqsqlpsql4.a
mingw32-make[1]: Leaving directory `C:/Qt/4.3.4/src/plugins/sqldrivers/psql'


Is everything right?

Do I need to do something more? Because it continues: "Driver not loaded Driver not loaded" when I try to run 'release\database.exe'.

Thanks.
  • Go to the top of the page

Messenger

Intermediate

Posts: 329

Location: Lt

9

Thursday, March 27th 2008, 5:57am

Try [qt base]\demos\sqlbrowser.
In order psql plugin to work all needed dll's (see with depends.exe http://www.dependencywalker.com/ or in psdk bin if you have one) (path C:\psql\lib) must be on %PATH% or possible beside plugin dll?.
Maybe you will need to remove some Trolltech registry keys or values.
Fighting fire with fire.
  • Go to the top of the page

10

Thursday, March 27th 2008, 12:49pm

I copied all asked dlls to qtdir\plugins\sqldrivers...
Now dependency walker says: "Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module."

is it ok?
"Driver not loaded Driver not loaded" continues and sqlbrowser doesnt show psql.
What do you have to do now?

Thanks.
Hugs.
  • Go to the top of the page

11

Friday, March 28th 2008, 4:20pm

Somebody help me, please. :(
  • Go to the top of the page

12

Monday, March 31st 2008, 2:47pm

Somebody there??
  • Go to the top of the page

Messenger

Intermediate

Posts: 329

Location: Lt

13

Tuesday, April 1st 2008, 8:04am

Try the following
run regedt32 goto "HKEY_CURRENT_USER\Software\Trolltech\OrganizationDefaults\Qt Plugin Cache 4.3.false\C:\qt\plugins\sqldrivers" (the registry key can differ)
and delete psql dll entry.
Rerun sqlbrowser demo.
Fighting fire with fire.
  • Go to the top of the page

14

Tuesday, April 1st 2008, 4:30pm

RE: PSQL problem

I am not sure if this will help you but i use Xp and the following qt configuration:

configure -I C:\PostgreSQL\8.2\include -L C:\PostgreSQL\8.2\lib -L C:\PostgreSQL\8.2\lib\ms -lpq -qt-sql-psql -static


i am not sure how can you transfer these in the .pro files but maybe you know better

Hope i helped
  • Go to the top of the page

15

Wednesday, April 2nd 2008, 1:15am

Messenger:

Delete only dll or .a also? I deleted dll psql and rerun...same thing...just qsqlite and qodbc.

qsqlpsql4.dll Data: 0 1 unknown 2008-04-01T21:05:49
qsqlodbc4.dll Data: 40304 0 Windows mingw release full-config 2008-02-19T16:40:36
qsqlite4.dll Data: 40304 0 Windows mingw release full-config 2008-02-19T16:40:52

is it normal?

iltzortz:

I dont have \ms in C:\psql\lib. Do I have to create?

Thanks.
Hugs.
  • Go to the top of the page

Messenger

Intermediate

Posts: 329

Location: Lt

16

Wednesday, April 2nd 2008, 9:11am

It seems you need to add [postgres dir]\bin and []\lib to %PATH% variable. Moving dlls next to the plugin was my bad (sorry sorry) idea.

I have downloaded latest postgress. Unzipped.
Edited qt postgres plugin project. Now it contains apoppriate include path library path and link library.
qmake
nmake (I have used msvc)
Corrected %PATH% variable
Deleted registry key
Now sqlbrowser shows postgres plugin.
Fighting fire with fire.
  • Go to the top of the page

17

Wednesday, April 2nd 2008, 12:09pm

Hi,

How and where do I do all this?

Thanks.
  • Go to the top of the page

Messenger

Intermediate

Posts: 329

Location: Lt

18

Wednesday, April 2nd 2008, 12:30pm

What exactly?
To change PATH variable there is two ways:

Use windows help or google (i've searched for environment variables).
in xp:

Quoted


To add or change the values of environment variables
Open System in Control Panel.
On the Advanced tab, click Environment Variables, then click the name of the user variable or system variable you want to change, as follows. Click:
New to add a new variable name and value.
Edit to change a current variable name and value.
Delete to remove a variable name and value.
Notes

If you are not logged on as administrator to the local computer, the only environment variables you can change are user variables.
To open System, click Start, click Control Panel, click Performance and Maintenance, and then click System.
Windows saves changes in the registry so they are available automatically the next time you start your computer.
You might have to close and reopen running programs for the new settings to take effect.
Related Topics


or you can write .bat file and set there variables and do shortcut to it. The shortcut's command line like [%windir%\system32\cmd.exe /k "C:\qt\mingw\real\gcc.bat"]
example bat (see qt base directory)

Quoted

@set PATH=C:\qt\mingw\real\bin;C:\qt\real\bin;C:\qt\real\lib;C:\qt\pgsql\lib;C:\qt\pgsql\bin;%PATH%


run shortcut and run applications from openned console. Do not forget to delete invalid registry key.
I have xp, qt 4.3.4.
Fighting fire with fire.
  • Go to the top of the page

19

Wednesday, April 2nd 2008, 2:01pm

I edited psql.pro from %qtdir%\src\plugins\sqldrivers\psql:

win32:!contains(LIBS, .*pq.* ) {
INCLUDEPATH += C:\psql\include
!win32-g++:LIBS *= -llibpq
win32-g++:LIBS *= -LC:\psql\lib -llibpq
LIBS *= -lws2_32 -ladvapi32
}

After that:

>qmake -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\libpq.lib" psql.pro
>make

it created qpsql .dll and .a.

I went to the environment variables, system variables, edited variable 'Path':

In the final of the value, I put: C:\psql\bin;C:\psql\lib;

Deleted .dll and .a from the regedt32 and rerun sqlbrowser...

it shows only qodbc and qsqlite. :(

Did I do all right?
  • Go to the top of the page

Messenger

Intermediate

Posts: 329

Location: Lt

20

Wednesday, April 2nd 2008, 2:21pm

tryied on vista, yes I have no postgres plugin too. on xp though works.

well, installed vcredist_x86.exe for msvc 2005 (installs msvc 80 dlls), deleted registry key and now works on vista.
see the qt postgres plugin with depends.exe.
Fighting fire with fire.

This post has been edited 3 times, last edit by "Messenger" (Apr 2nd 2008, 2:34pm)

  • Go to the top of the page

Rate this thread