Score:3

pkg-config indicates libxml2 not found

de flag

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?

Someone avatar
my flag
Have you tried doing the same command after rebooting your pc ?
de flag
Yes, just retried it, same result.
hr flag
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.
de flag
@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?
Score:4
zw flag

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
de flag
@ 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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.