What other libs to link with Libpq in Ubuntu?
Hi,
Just started testing the latest Ubuntu.
I'd like to port an app I wrote that is sort of working in Windows, using Libpq
because I gave up long ago trying to make a driver to Postgrees. It's too late to change now (at least for a while, I dont have the time).
Has anyone written an app to run with Libpq?
In my windows file Libs += ...\Libpq.a
works fine
but in Ubuntu I get hundreds of undefined symbols.
thankyou
Henri
Re: What other libs to link with Libpq in Ubuntu?
Quote:
Originally Posted by
feraudyh
In my windows file Libs += ...\Libpq.a works fine
If you mean the operating system Windows, then I seriously doubt that line works!
Re: What other libs to link with Libpq in Ubuntu?
yeah, right, I got the wrong extension, I meant libpq.lib.
here's the bottom of my qmake file:
win32 {
LIBS += "C:\Progra~1\PostgreSQL\8.4\lib\libpq.lib"
INCLUDEPATH += "C:\Progra~1\PostgreSQL\8.4\include"
}
linux-g++ {
LIBS += /usr/lib/libpq.a
INCLUDEPATH += /usr/include/postgresql
}
Re: What other libs to link with Libpq in Ubuntu?
Are you using a static postgresql library?
Re: What other libs to link with Libpq in Ubuntu?
To be honest I dont know. I just use the defaults and a qmake file that ends like above.
How can I find out if it's static?
I think the extension really is ".a". Doesnt that tell you?
If I could solve my problem by moving to a non-static library I would.
Re: What other libs to link with Libpq in Ubuntu?
You should be aware of the tools you are using. Use of static libraries is completely different than use of dynamic ones so first decide whether you want to use statically or dynamically linked libs and only then actually start trying to use them. Licencing issues are a concern here as well.
Re: What other libs to link with Libpq in Ubuntu?
We're getting off the subject.
Re: What other libs to link with Libpq in Ubuntu?
No, we are not. The dynamic version of libpq requires the following libraries:
Code:
linux-gate.so.1 => (0xffffe000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0xb76ba000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0xb74f9000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0xb74b0000)
libc.so.6 => /lib/i686/libc.so.6 (0xb735e000)
libdl.so.2 => /lib/libdl.so.2 (0xb7359000)
libpthread.so.0 => /lib/i686/libpthread.so.0 (0xb7341000)
/lib/ld-linux.so.2 (0xb776a000)
The static one requires all undefined symbols to be defined. You can use nm and grep to see what they are.
Re: What other libs to link with Libpq in Ubuntu?
Well, if there are two choices it's not hard to give an answer as you have indeed shown.
So grep is used in this case to look inside binaries, right?
Now I dont know if the dynamic libraries involve the same licencing conditions, or more to the point, where can I find out for this case?
Thanks.
Re: What other libs to link with Libpq in Ubuntu?
Quote:
Originally Posted by
feraudyh
So grep is used in this case to look inside binaries, right?
No, it's used to filter out results of nm.
Quote:
Now I dont know if the dynamic libraries involve the same licencing conditions, or more to the point, where can I find out for this case?
As far as I remember PostgreSQL is LGPL which means that if you are writing a closed-source application, you can't link it statically. But feel free to check it on PostgreSQL website.
Re: What other libs to link with Libpq in Ubuntu?
Wow, the difference between linking statically and dynamically really seems like splitting hairs, but I will look up the postgres site.
You have given me very useful advice.
Re: What other libs to link with Libpq in Ubuntu?
Quote:
Originally Posted by
feraudyh
Wow, the difference between linking statically and dynamically really seems like splitting hairs
If you are talking about the licences, then no, this is not splitting hairs.
In one case you only link (read: include) your own code, in the other case you link (read: include) the code of someone else.
In the professional world this is a huge difference.
Re: What other libs to link with Libpq in Ubuntu?
It's also a difference when it comes to deploying your program. Either you need to deploy the library with your program (when linking dynamically) or not (when linking statically) at a cost of increased binary size.
Re: What other libs to link with Libpq in Ubuntu?
I get it, when you are deploying the library, someone else can start developing with it too, if he has the documentation.
Re: What other libs to link with Libpq in Ubuntu?
Quote:
Originally Posted by
feraudyh
I get it, when you are deploying the library, someone else can start developing with it too, if he has the documentation.
No, that's not what we meant.