Are libpq and libpqxx equivalent?

You have a problem with Salix? Post here and we'll do what we can to help.
User avatar
Themis
Posts: 72
Joined: 27. Feb 2016, 22:17
Location: France

Are libpq and libpqxx equivalent?

Post by Themis »

Hello,

I’m planning to learn part of the SQL language properly (need it for study purpose, also), and after installing PostgreSQL 10.1, which I hope I did properly though following the installation doc, I’m planning to install pgModeler. I first tried to install pgAdmin 4, but that was “meh”, and a friend of mine told me version 4 is not obviously the best. Unfortunately, version 3 is not supported anymore, so that friend suggested me to give pgModeler a try.
After checking the installation doc (https://www.pgmodeler.com.br/support/installation), I now encounter a stupid problem. It’s said we need libpq. I have ibpqxx installed… would that be OK? :|
User avatar
gapan
Salix Wizard
Posts: 6238
Joined: 6. Jun 2009, 17:40

Re: Are libpq and libpqxx equivalent?

Post by gapan »

No, they are not. libpq is a C library and is included in the postgresql source tarball. So you don't need it separately. libpqxx is a C++ library.
Image
Image
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Are libpq and libpqxx equivalent?

Post by mimosa »

In general, that -xx- thing in the name means it's C++, that way, the name keeps within naming conventions. Imagine it rotated ninety degrees.
User avatar
gapan
Salix Wizard
Posts: 6238
Joined: 6. Jun 2009, 17:40

Re: Are libpq and libpqxx equivalent?

Post by gapan »

mimosa wrote:Imagine it rotated ninety degrees.
45. :mrgreen:
Image
Image
User avatar
Themis
Posts: 72
Joined: 27. Feb 2016, 22:17
Location: France

Re: Are libpq and libpqxx equivalent?

Post by Themis »

Oh, I didn’t know that. Thanks for the explanation. :)
So, if this is supposed to be provided by PostgreSQL, is it normal that it’s not finding it?

Code: Select all

$ pkg-config libpq --cflags --libs
Package libpq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpq' found

Code: Select all

$ find / -name libpq.pc
/usr/local/pgsql/lib/pkgconfig/libpq.pc
I’ve made a quick search and found that it might be because I run a 64bit distro. Is that so? I’m not yet familiar with environment variables and all. Is there a way to make pkg-config find libpq properly?

(I got The Linux Command Line book for Christmas, so within a few months I should be able to not bother you that much anymore with all that. :) )
User avatar
gapan
Salix Wizard
Posts: 6238
Joined: 6. Jun 2009, 17:40

Re: Are libpq and libpqxx equivalent?

Post by gapan »

Code: Select all

/usr/local/pgsql/lib
Well, that's definitely not right. How have you installed postgresql and why didn't you use the package in the repositories? If you have installed it manually, you should do as the message reads: "add the directory containing `libpq.pc' to the PKG_CONFIG_PATH environment variable"
Image
Image
User avatar
Themis
Posts: 72
Joined: 27. Feb 2016, 22:17
Location: France

Re: Are libpq and libpqxx equivalent?

Post by Themis »

Hi,

Actually, this is because I’ve started learning with the Practical SQL book in early access, and it’s based on PostgreSQL 10.

Here is what I did to install it after downloading the tar.bz2.

Code: Select all

cd dev/postgresql10/
bunzip2 postgresql-10.1.tar.bz2 
tar xf postgresql-10.1.tar 
cd postgresql-10.1
./configure
make
make check
sudo make install
make clean
DidierSpaier
Posts: 518
Joined: 20. Jun 2016, 20:15

Re: Are libpq and libpqxx equivalent?

Post by DidierSpaier »

Themis wrote:Hi,

Actually, this is because I’ve started learning with the Practical SQL book in early access, and it’s based on PostgreSQL 10.

Here is what I did to install it after downloading the tar.bz2.

Code: Select all

cd dev/postgresql10/
bunzip2 postgresql-10.1.tar.bz2 
tar xf postgresql-10.1.tar 
cd postgresql-10.1
./configure
make
make check
sudo make install
make clean
Doing so you will soon have an unmanageable system.

Just get the source files from https://slackbuilds.org/repository/14.2 ... ostgresql/ or http://slackware.uk/salix/x86_64/extra- ... ostgresql/, put the source tarball in the same directory, set VERSION accordingly and run the SlackBuild.
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Are libpq and libpqxx equivalent?

Post by mimosa »

In general, it is very important to always stay within the package management system unless you know what you are doing. If you build from source like that and just do make install, you will quickly break your system, besides losing the advantages of using it as intended.

Please have a look at Chapter Three of the Salix Startup Guide, on package management, if you have not already. Or just have another look as a refresher ;)
User avatar
Themis
Posts: 72
Joined: 27. Feb 2016, 22:17
Location: France

Re: Are libpq and libpqxx equivalent?

Post by Themis »

Thank you, both of you.
Yes, I had read this chapter, but apparently I need to read it again.
So is it a clean way to undo what I’ve done? The README file from the PostgreSQL 10 sources is pretty succinct. I’ve found this thread on the PostgreSQL community… but apparently, even following the PostgreSQL install instructions, I ended up having it not exactly where it should have been installed, if I understand properly.
Post Reply