4

I've installed libxml2-dev in my Ubuntu 20.04 terminal (under WSL), as it's a requirement for pgModeler. I used sudo apt-get install libxml2-dev and it seemed to install ok. The pgModeler instruction includes "To check if the library is correctly installed" run this command: pkg-config libxml­2.0 --cflags --libs For me, this gives:

Package libxml2.0 was not found in the pkg-config search path. 
Perhaps you should add the directory containing 'libxml2.0.pc'
to the PKG_CONFIG_PATH environment variable 
No package 'libxml2.0' found

Answers to some questions suggest adding the path to PKG_CONFIG_PATH. To determine what path to check, I installed locate (sudo apt install mlocate) and using locate libxml | grep '\.pc', I found that this file exists:

/usr/lib/x86_64-linux-gnu/pkgconfig/libxml-2.0.pc

Then running pkg-config --variable pc_path pkg-config gives (my highlighting):

/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig

which indicates to me that /usr/lib/x86_64-linux-gnu/pkgconfig is already in the default path for pkg-config.

So, why would I get "No package 'libxml2.0' found", and how might I fix this?

Colin Frame
  • 41
  • 1
  • 5
  • Have you tried doing the same command after rebooting your pc ? – Error404 Nov 02 '21 at 09:58
  • Yes, just retried it, same result. – Colin Frame Nov 02 '21 at 11:04
  • 2
    The command should probably have been `pkg-config --cflags --libs libxml-2.0` or perhaps better `pkg-config --modversion libxml-2.0`. Note the hyphen. – steeldriver Nov 02 '21 at 12:28
  • 1
    @steeldriver Thanks - that answers my original question. I've corrected -libs to --libs (initial error from copying and pasting via MS Word). Could you please promote your comment as an answer so I can mark it as such? – Colin Frame Nov 02 '21 at 13:27

1 Answers1

6

You have to ignore the suggestion from pgModeler documentation.

Correct name of the libxml2 configuration file for pkg-config is libxml-2.0.pc, you have already installed it from libxml2-dev package.

Simply proceed with the compilation:

sudo apt-get install git build-essential libxml2-dev qt5-default libpqxx-dev libpq-dev libqt5svg5-dev qttools5-dev

cd ~/Downloads
git clone https://github.com/pgmodeler/pgmodeler.git -b master
cd pgmodeler
git clone https://github.com/pgmodeler/plugins -b master
qmake PREFIX+=/usr/local -r pgmodeler.pro
make -j$(nproc)
sudo make install

Also you should know that pgModeler 0.9.2 is packaged in Ubuntu 20.04 LTS at https://packages.ubuntu.com/focal/pgmodeler, so it installable as simple as

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install pgmodeler
N0rbert
  • 97,162
  • 34
  • 239
  • 423
  • @ N0rbert - that's really useful information and is helping me progress, thanks. I'm hitting other issues now, will post a separate question if I can't work round these. – Colin Frame Nov 02 '21 at 13:30